---
title: "Inspect a space's database"
method: GET
path: "/v1/spaces/{spaceId}/db"
tags: ["Database"]
---

# Inspect a space's database

`GET /v1/spaces/{spaceId}/db`

## Request

- Base URL: `https://api.spacefast.com`
- URL: `https://api.spacefast.com/v1/spaces/{spaceId}/db`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer

Returns the declared tables and pending migration plan of the live version's database. This route is Zero-kind only because workers do not declare a table set. Use `db console` to read a worker's database directly. Returns `db_not_available` when the live version has no database. Returns `runtime_kind_mismatch` when the live version is a worker.

## Path parameters

- `spaceId` string, required

## Response `200`

Response for status 200

- object
  - `$schema` string, uri: Canonical JSON Schema URL for this response body. The server also sends it in the `Link: rel="describedby"` response header.
  - `data` object, required
    - `versionId` string, nullable, required
    - `artifactId` string, nullable, required
    - `backend` 'mysql', nullable, required
    - `migrationMode` 'safe' | 'drop' | 'rename', nullable, required
    - `schemaHash` string, nullable, required
    - `tables` object[], required
      - `name` string, required
      - `columns` object[], required
        - `name` string, required
        - `type` 'string' | 'boolean' | 'number' | 'json', required
        - `nullable` boolean, required
        - `optional` true
        - `userReference` true
        - `default` unknown
      - `indexes` object[], required
        - `name` string, required
        - `fields` string[], required
        - `unique` boolean
    - `migrations` union[], required
      - union
        - object
          - `op` 'create_table', required
          - `table` string, required
        - object
          - `op` 'add_column', required
          - `table` string, required
          - `column` object, required
            - `name` string, required
            - `type` 'string' | 'boolean' | 'number' | 'json', required
            - `nullable` boolean, required
            - `optional` true
            - `userReference` true
            - `default` unknown
        - object
          - `op` 'add_index', required
          - `table` string, required
          - `name` string, required
          - `columns` string[], required
          - `unique` boolean, required
        - object
          - `op` 'drop_index', required
          - `table` string, required
          - `name` string, required
          - `explicit` 'drop', required
        - object
          - `op` 'drop_table', required
          - `table` string, required
          - `explicit` 'drop', required
        - object
          - `op` 'drop_column', required
          - `table` string, required
          - `column` string, required
          - `explicit` 'drop', required
        - object
          - `op` 'rename_table', required
          - `from` string, required
          - `to` string, required
          - `explicit` 'rename', required
        - object
          - `op` 'rename_column', required
          - `table` string, required
          - `from` string, required
          - `to` string, required
          - `explicit` 'rename', required
    - `plan` object, nullable, required: Applied-state of the live version's migration plan. `null` when the live version declares no migration plan.
      - `applied` boolean, nullable, required: Whether this plan has been run against the space database. `null` when the control plane has no application record and cannot truthfully say.
      - `appliedSchemaHash` string, nullable, required: Schema hash recorded when a plan was last applied for this version, if any.
      - `pendingOperationCount` integer, required: Queued or running `db migrate` operations for this space. Non-zero means an apply is still waiting.

## Other responses

- `default`: Problem details (RFC 9457). Any 4xx/5xx response is one `application/problem+json` document.

---

[API](https://skmtc.dev/spacefast/apis/spacefast-api.md) · [All operations](https://skmtc.dev/spacefast/apis/spacefast-api/llms.txt) · [OpenAPI document](https://skmtc.dev/spacefast/apis/spacefast-api/revisions/bd165bc7c983?raw)
