---
title: "Share a database"
method: POST
path: "/spaces/{space_id}/databases/{database_ref}/share"
---

# Share a database

`POST /spaces/{space_id}/databases/{database_ref}/share`

Creates a shareable snapshot of a database. Returns a share token that can be used to create a new database from the snapshot in another space.

## Path parameters

- `space_id` string, required
- `database_ref` string, required

## Request body

- ShareDatabaseRequest — Options for creating a database share.
  - `expires_at` string, date-time — Time after which the share expires. If omitted, the share does not expire.

## Response `201`

Share created

- DatabaseShare — A shareable snapshot of a database. Can be used to create a new database from the snapshot in another space.
  - `share_token` string, required — Token passed to `createDatabase` (via `share_token`) to create a new database from the shared snapshot in another space. Also used to revoke the share via `revokeShare`. Always begins with `gs_`.
  - `database_id` string, required — ID of the source database.
  - `database_name` string, required — Name of the source database.
  - `created_at` string, date-time, required — Time the share was created.
  - `expires_at` string, date-time — Time the share expires. Absent if the share does not expire.
  - `revoked_at` string, date-time — Time the share was revoked. Absent if the share is still active.

## Other responses

- `default` — Error response

---

[API](https://skmtc.net/timescale/apis/ghost-api.md) · [All operations](https://skmtc.net/timescale/apis/ghost-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/timescale/ghost-api/versions/808022f897be/schema)
