Use the Core API
The Space Blocks Core API is used to manage tenants, users, projects, environments, space blocks and their configurations but does not with the single Space Blocks themselves.
The Core API is available at https://api.spaceblocks.cloud/public/
.
Authenticate against the Core API
Before communicating with the Core API, you need to authenticate against it. This is done by exchanging your Tenant's Admin Client ID and Secret for a JWT token. Each tenant has its own Admin Client ID and Secret.
- cURL
curl --location --request POST 'https://auth.spaceblocks.cloud/token-manager/token' \
--header 'Content-Type: application/json' \
--header "apiKey: <YOUR_API_KEY>" \
--data-raw '{
"client_id": "<YOUR_CLIENT_ID>",
"client_secret": "<YOUR_CLIENT_SECRET>",
"scope": "core:clients:read core:clients:write core:environments:read core:environments:write core:projects:read core:projects:write"
}'
This response looks similar to this and contains an access_token
property.
{
"access_token": "eyJhbGciOiJSUzI1NiIsIm...",
"expires_in": 3600,
"scope": "core:clients:read core:clients:write core:environments:read core:environments:write core:projects:read core:projects:write",
"token_type": "bearer"
}
This token can be uses to authenticate against the Core API by adding it to the Authorization
header of your request.
Authorization: Bearer <YOUR_ACCESS_TOKEN>
Call the Core API
Once authenticated, you can start calling the Core API with the Bearer token.
- cURL
curl --location --request POST 'https://api.spaceblocks.cloud/public/datacenters' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsIm...'