Use a Space Block
Get the URL
curl --location --request GET 'https://api.spaceblocks.cloud/public/projects/<PROJECT_ID>/environments/<STAGE_ID>' \
--header 'Authorization: Bearer eyJhbGciOiJS...'
Returns
{
"id": "abc123",
"name": "my-environment",
"projectId": "11111111-1111-1111-1111-111111111111",
"dataCenterId": "eu1",
"deployments": {
"subscriptions": {
"spaceBlockId": "subscriptions",
"url": "https://abc123.subscriptions.eu1.spaceblocks.cloud" # <- Your URL
}
}
}
Get the API Key
curl --location --request GET 'https://api.spaceblocks.cloud/public/projects/<PROJECT_ID>/environments/<STAGE_ID>/api-key' \
--header 'Authorization: Bearer eyJhbGciOiJS...'
Get the Access Token
Creata a Client
curl --location --request POST 'https://api.spaceblocks.cloud/clients' \
--header 'Authorization: Bearer eyJhbGciOiJS...' \
--header 'Content-Type: application/json' \
--data-raw '{
"spaceBlockSlugs": ["subscriptions"],
"redirectUris": ["https://spaceblocks.cloud"],
"scopes": ["subscriptions:management:read", "subscriptions:management:write"],
"projectId": "11111111-1111-1111-1111-111111111111",
"environmentId": "abc123"
}'
Responds with Client ID and Client Secret
Get an Access Token for the Client
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": "<CLIENT_ID>",
"client_secret": "<CLIENT_SECRET>",
"scope": "subscriptions:management:read subscriptions:management:write"
}'
Responds with a JWT Access Token
Make a request
curl \
--location \
--request GET 'https://abc123.subscriptions.eu1.spaceblocks.cloud/foo/bar' \
--header 'apiKey: <API_KEY>' \
--header 'Authorization: Bearer <ACCESS_TOKEN>'