Datasette Cloud API documentation

Each Datasette Cloud space includes a JSON API for both accessing and modifying data hosted within that space.

See Getting started with the Datasette Cloud API for a tutorial introduction to the API, showing how it can be used to automatically import data from the US government Federal Register into Datasette Cloud.

The JSON API is described in detail in the Datasette 1.0 alpha documentation.

This page provides details that are specific to the Datasette Cloud implementation of the API.

Use-cases

The Datasette Cloud API can be used for a wide range of tasks, including:

Authentication

Any calls you make to the Datasette Cloud API - for both reading and writing data - must include an Authorization: Bearer <token> header containing a valid API token.

These tokens can be created and revoked from the API tokens page within your Datasette Cloud space.

Tokens you create will be able to act on your behalf - any action your user account can perform within a space - creating tables, inserting and updating rows, etc - will be inherited by the token.

You can limit the token to a subset of those abilities when you create it. For example, you could create a token that can only read data from a particular table.

Tokens can also be created with a limited lifespan - for example, you can create a token that expires in 2 hours.

This is good practice if you are creating a token to use for a specific, short-lived task, as opposed to tokens that will be used for long-running automations.