Get a Space's database - Spacefast Docs

Get a Space's database

Returns the tables and migration plan the live version declared, whether that plan has been applied, and how many applies are still queued. Only a Zero capsule declares a table set: a live worker that asked for database access returns runtime_kind_mismatch, and a Space whose live version has no database returns db_not_available. Open a database console to read a worker’s tables.

GET /v1/spaces/{spaceId}/db

Authorization

Authorization Bearer token · header required

Authorization: Bearer <key>

with the Space key (sfc_ prefix) of an unclaimed Space. The same key is the fragment of the claim URL and the token in the Space's /_/__/<key> sign-in URL.

or

Authorization Bearer token · header required

Authorization: Bearer <token>

with an API key (sfa_ prefix), an OAuth access token, a session token, or a Space machine credential (sfm_ prefix).

Path parameters

spaceId string required

Responses

200 Response for status 200

{
  "$schema": "string<uri>",
  "data": {
    "versionId": "string | any",
    "artifactId": "string | any",
    "backend": "string | any",
    "migrationMode": "string | any",
    "schemaHash": "string | any",
    "tables": [

],
    "migrations": [

],
    "plan": {
      "applied": true,
      "appliedSchemaHash": "string | any",
      "pendingOperationCount": 0
    }
  }
}

Error Response

{
  "$schema": "string<uri>",
  "type": "string",
  "title": "string",
  "status": 400,
  "detail": "string",
  "code": "string",
  "pointer": "string",
  "details": {
    "property1": null,
    "property2": null
  },
  "suggestions": [
    "string"
  ],
  "next": [
    "string"
  ],
  "requestId": "string"
}

Try it

Server

Base URL https://api.spacefast.com

Parameters

spaceId path *

Request Examples

cURL

curl -X GET "https://api.spacefast.com/v1/spaces/string/db" \
  -H "Authorization: Bearer YOUR_TOKEN"

JavaScript

const response = await fetch("https://api.spacefast.com/v1/spaces/string/db", {
  method: "GET",
  headers: {
    "Authorization": "Bearer YOUR_TOKEN"
  }
});

Python

import requests

response = requests.get(
    "https://api.spacefast.com/v1/spaces/string/db",
    headers={
        "Authorization": "Bearer YOUR_TOKEN"
    },
)