TypeDB 3.0 is live! Get started for free.

TypeDB Cloud API Reference

Authorization

Token Exchange

Exchange an API token’s client ID and client secret for a short-lived access token to authenticate against the rest of the API.

Required access

None

Method

POST

URL

/api/auth

Request body

None

Request headers

Authorization: Basic CLIENT_ID:CLIENT_SECRET

Responses:

200: OK

This response will contain only the access token

Response format:

string
400: Bad Request

Possible causes:

  • Incorrectly formatted request (e.g. Authorization header missing a token)

  • Invalid client ID

  • Invalid client secret

Response format:

{
    "code": string,
    "message": string
}

Example request:

  • curl

  • Python

  • Rust

curl --request POST \
    --url https://cloud.typedb.com/api/auth \
    --header 'Authorization: Basic {CLIENT_ID}:{CLIENT_SECRET}'
import requests

url = "https://cloud.typedb.com/api/auth"

headers = {
    "Authorization": "Basic {CLIENT_ID}:{CLIENT_SECRET}"
}

response = requests.post(url, headers=headers)
use reqwest;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::new();
    let resp = client
        .post("https://cloud.typedb.com/api/auth")
        .header(reqwest::header::AUTHORIZATION, "Basic {CLIENT_ID}:{CLIENT_SECRET}")
        .send().await;
    Ok(())
}

Example response:

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c

API Token Access Levels

When generating your API token, you will grant it a certain access level to a project of your choice. It will be able to perform the actions within that project as described below:

Project access level Available cluster actions

Admin

Destroy

Write

Deploy, Suspend, Resume

Read

Get, List

Clusters

Deploy

Required access

write to org/ORG_ID/projects/PROJECT_ID

Method

POST

URL

/api/org/ORG_ID/projects/PROJECT_ID/clusters/deploy

Request body

{
    "id": string,
    "serverCount": number,
    "storageSizeGB":number,
    "provider": string,
    "region": string,
    "isFree": boolean,
    "machineType": string,
    "storageType": string,
    "version":string
}

Request headers

Authorization: Bearer ACCESS_TOKEN

Responses:

200: OK

Response format:

{
    "id": string,
    "serverCount": number,
    "storageSizeGB": number,
    "isFree": boolean,
    "status": string,
    "createdAt": number,
    "organization": string,
    "project": string,
    "version": string,
    "provider": string,
    "region": string,
    "machineType": string,
    "storageType": string,
    "servers": [
        {
          "address": string,
          "status": string
        }
    ]
}
400: Bad Request

Possible causes:

  • Incorrectly formatted request (e.g. Authorization header missing a token)

Response format:

{
    "code": string,
    "message": string
}
401: Unauthorized

Possible causes:

  • Invalid token

  • Expired token

Response format:

{
    "code": string,
    "message": string
}
403: Forbidden

Possible causes:

  • The supplied access token lacks the required access level for the request

Response format:

{
    "code": string,
    "message": string
}
404: Not Found

Possible causes:

  • One or more resources referenced in the request could not be found

Response format:

{
    "code": string,
    "message": string
}
409: Conflict

Possible causes:

  • Attempting to create a resource with an already-in-use ID

Response format:

{
    "code": string,
    "message": string
}
500: Internal Server Error

Possible causes:

  • An unexpected error prevented TypeDB Cloud from serving your request

Response format:

{
    "code": string,
    "message": string
}

Clusters deployed through the API will have a default user with the username admin and the password password. We recommend updating the default password before using the cluster - which can also be done through the TypeDB Cloud UI by clicking the "Connect" button on the cluster’s page.

Example request:

  • curl

  • Python

  • Rust

  • Request Body

curl --request POST \
    --url https://cloud.typedb.com/api/org/ORG_ID/projects/PROJECT_ID/clusters/deploy \
    --header 'Authorization: Bearer {ACCESS-TOKEN}' \
    --json '{"id":"api-cluster","serverCount":1,"storageSizeGB":10,"provider":"gcp","region":"europe-west2","isFree":true,"machineType":"c2d-highcpu-2","storageType":"standard-rwo","version":"3.0.6"}'
import requests

url = "https://cloud.typedb.com/api/org/ORG_ID/projects/PROJECT_ID/clusters/deploy[https://cloud.typedb.com/api/auth]"

headers = {
    "Authorization": "Bearer {ACCESS-TOKEN}"
}

body = {
    "id": "api-cluster",
    "serverCount": 1,
    "storageSizeGB": 10,
    "provider": "gcp",
    "region": "europe-west2",
    "isFree": True,
    "machineType": "c2d-highcpu-2",
    "storageType": "standard-rwo",
    "version": "3.0.6"
}

response = requests.post(url, headers=headers, json=body)
use reqwest;
use serde::Serialize;

#[derive(Serialize)]
struct ClusterDeploy {
    id: String,
    serverCount: i32,
    storageSizeGB: i32,
    provider: String,
    region: String,
    isFree: bool,
    machineType: String,
    storageType: String,
    version: String
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let cluster_deploy = ClusterDeploy {
        id: "api-cluster".into(),
        serverCount: 1,
        storageSizeGB: 10,
        provider: "gcp".into(),
        region: "europe-west2".into(),
        isFree: true,
        machineType: "c2d-highcpu-2".into(),
        storageType: "standard-rwo".into(),
        version: "3.0.6".into()
    };
    let client = reqwest::Client::new();
    let resp = client
        .post("https://cloud.typedb.com/api/org/ORG_ID/projects/PROJECT_ID/clusters/deploy")
        .header(reqwest::header::AUTHORIZATION, "Bearer {ACCESS-TOKEN}")
        .json(&cluster_deploy)
        .send().await;
    Ok(())
}
{
    "id":"api-cluster",
    "serverCount":1,
    "storageSizeGB":10,
    "provider":"gcp",
    "region":"europe-west2",
    "isFree":true,
    "machineType":"c2d-highcpu-2",
    "storageType":"standard-rwo",
    "version":"3.0.6"
}

Example response:

{
    "id":"api-cluster",
    "serverCount":1,
    "storageSizeGB":10,
    "isFree":true,
    "status":"starting",
    "createdAt":1738256490070,
    "organizationID":"new-organization",
    "projectID":"default",
    "version":"3.0.6",
    "provider":"gcp",
    "region":"europe-west2",
    "machineType":"c2d-highcpu-2",
    "storageType":"standard-rwo",
    "servers": [
        {
          "address": "abc123-0.cluster.typedb.com:80",
          "status": "pending"
        }
    ]
}
Field Allowed Values

id

The cluster’s ID must be unique within its project, and consist only of lowercase alphanumeric characters, optionally separated by underscores and hyphens.

serverCount

An odd integer value between 1 and 9. TypeDB version 3.0 and onwards can currently only have one server.

storageSizeGB

An integer value between 10 and 1000.

provider

Must be either gcp, aws, or azure

isFree

If set to true, must use a valid free machine type, and have at most 1 server and 10GB of storage. You may only have one free cluster per organization.

If set to false, there must be a valid payment method on the organization.

region

See below

machineType

See below

storageType

See below

version

Currently available versions are:

  • 2.29.3

  • 3.0.6

GCP regions and machine types
Machine Types Free Available Regions

c2d-highcpu-2

Yes

  • europe-west2

  • europe-west3

  • us-west4

  • us-east1

c2d-highcpu-4

No

  • europe-west2

  • europe-west3

  • us-west4

  • us-east1

c2d-highcpu-8

No

  • europe-west2

  • europe-west3

  • us-west4

  • us-east1

c2d-highcpu-16

No

  • europe-west2

  • europe-west3

  • us-west4

  • us-east1

AWS regions and machine types
Machine Types Free Available Regions

c7g.large

Yes

  • eu-west-2

c7g.xlarge

No

  • eu-west-2

c7g.2xlarge

No

  • eu-west-2

c7g.4xlarge

No

  • eu-west-2

c8g.large

Yes

  • us-west-2

  • us-east-1

  • eu-central-1

c8g.xlarge

No

  • us-west-2

  • us-east-1

  • eu-central-1

c8g.2xlarge

No

  • us-west-2

  • us-east-1

  • eu-central-1

c8g.4xlarge

No

  • us-west-2

  • us-east-1

  • eu-central-1

Azure regions and machine types
Machine Types Free Available Regions

Standard_F2s_v2

Yes

  • East US

  • West US 3

  • Germany West Central

Standard_F4s_v2

No

  • East US

  • West US 3

  • Germany West Central

Standard_F8s_v2

No

  • East US

  • West US 3

  • Germany West Central

Standard_F16s_v2

No

  • East US

  • West US 3

  • Germany West Central

Storage types
Provider Storage Type

GCP

standard-rwo

AWS

gp2

Azure

default

Get

Required access

read to org/ORG_ID/projects/PROJECT_ID

Method

GET

URL

/api/org/ORG_ID/projects/PROJECT_ID/clusters/CLUSTER_ID

Request body

None

Request headers

Authorization: Bearer ACCESS_TOKEN

Responses:

200: OK

Response format:

{
    "id": string,
    "serverCount": number,
    "storageSizeGB": number,
    "isFree": boolean,
    "status": string,
    "createdAt": number,
    "organization": string,
    "project": string,
    "version": string,
    "provider": string,
    "region": string,
    "machineType": string,
    "storageType": string,
    "servers": [
        {
          "address": string,
          "status": string
        }
    ]
}
400: Bad Request

Possible causes:

  • Incorrectly formatted request (e.g. Authorization header missing a token)

Response format:

{
    "code": string,
    "message": string
}
401: Unauthorized

Possible causes:

  • Invalid token

  • Expired token

Response format:

{
    "code": string,
    "message": string
}
403: Forbidden

Possible causes:

  • The supplied access token lacks the required access level for the request

Response format:

{
    "code": string,
    "message": string
}
404: Not Found

Possible causes:

  • One or more resources referenced in the request could not be found

Response format:

{
    "code": string,
    "message": string
}
500: Internal Server Error

Possible causes:

  • An unexpected error prevented TypeDB Cloud from serving your request

Response format:

{
    "code": string,
    "message": string
}

Example request:

  • curl

  • Python

  • Rust

curl --request GET \
    --url https://cloud.typedb.com/api/org/ORG_ID/projects/PROJECT_ID/clusters/CLUSTER_ID \
    --header 'Authorization: Bearer {ACCESS-TOKEN}'
import requests

url = "https://cloud.typedb.com/api/org/ORG_ID/projects/PROJECT_ID/clusters/CLUSTER_ID"

headers = {
    "Authorization": "Bearer {ACCESS-TOKEN}"
}

response = requests.get(url, headers=headers)
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::new();
    let resp = client
        .get("https://cloud.typedb.com/api/org/ORG_ID/projects/PROJECT_ID/clusters/CLUSTER_ID")
        .header(reqwest::header::AUTHORIZATION, "Bearer {ACCESS-TOKEN}")
        .send().await;
    Ok(())
}

Example response:

{
    "id":"new-cluster",
    "serverCount":1,
    "storageSizeGB":10,
    "isFree":true,
    "status":"running",
    "createdAt":1738256490070,
    "organizationID":"new-organization",
    "projectID":"default",
    "version":"3.0.6",
    "provider":"gcp",
    "region":"europe-west2",
    "machineType":"c2d-highcpu-2",
    "storageType":"standard-rwo",
    "servers": [
        {
          "address": "abc123-0.cluster.typedb.com:80",
          "status": "running"
        }
    ]
}

List

Required access

read to org/ORG_ID/projects/PROJECT_ID

Method

GET

URL

/api/org/ORG_ID/projects/PROJECT_ID/clusters

Request body

None

Request headers

Authorization: Bearer ACCESS_TOKEN

Responses:

200: OK

Response format:

[
    {
        "id": string,
        "serverCount": number,
        "storageSizeGB": number,
        "isFree": boolean,
        "status": string,
        "createdAt": number,
        "organization": string,
        "project": string,
        "version": string,
        "provider": string,
        "region": string,
        "machineType": string,
        "storageType": string,
        "servers": [
            {
              "address": string,
              "status": string
            }
        ]
    }
]
400: Bad Request

Possible causes:

  • Incorrectly formatted request (e.g. Authorization header missing a token)

Response format:

{
    "code": string,
    "message": string
}
401: Unauthorized

Possible causes:

  • Invalid token

  • Expired token

Response format:

{
    "code": string,
    "message": string
}
403: Forbidden

Possible causes:

  • The supplied access token lacks the required access level for the request

Response format:

{
    "code": string,
    "message": string
}
404: Not Found

Possible causes:

  • One or more resources referenced in the request could not be found

Response format:

{
    "code": string,
    "message": string
}
500: Internal Server Error

Possible causes:

  • An unexpected error prevented TypeDB Cloud from serving your request

Response format:

{
    "code": string,
    "message": string
}

Example request:

  • curl

  • Python

  • Rust

curl --request GET \
    --url https://cloud.typedb.com/api/org/ORG_ID/projects/PROJECT_ID/clusters \
    --header 'Authorization: Bearer {ACCESS-TOKEN}'
import requests

url = "https://cloud.typedb.com/api/org/ORG_ID/projects/PROJECT_ID/clusters"

headers = {
    "Authorization": "Bearer {ACCESS-TOKEN}"
}

response = requests.get(url, headers=headers)
use reqwest;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::new();
    let resp = client
        .get("https://cloud.typedb.com/api/org/ORG_ID/projects/PROJECT_ID/clusters")
        .header(reqwest::header::AUTHORIZATION, "Bearer {ACCESS-TOKEN}")
        .send().await;
    Ok(())
}

Example response:

[
    {
        "id":"new-cluster",
        "serverCount":1,
        "storageSizeGB":10,
        "isFree":true,
        "status":"running",
        "createdAt":1738256490070,
        "organizationID":"new-organization",
        "projectID":"default",
        "version":"3.0.6",
        "provider":"gcp",
        "region":"europe-west2",
        "machineType":"c2d-highcpu-2",
        "storageType":"standard-rwo",
        "servers": [
            {
              "address": "abc123-0.cluster.typedb.com:80",
              "status": "running"
            }
        ]
    },
    {
        "id":"cluster-two",
        "serverCount":1,
        "storageSizeGB":10,
        "isFree":false,
        "status":"suspended",
        "createdAt":1738256490090,
        "organizationID":"new-organization",
        "projectID":"default",
        "version":"3.0.6",
        "provider":"aws",
        "region":"eu-west-2",
        "machineType":"c7g.large",
        "storageType":"gp2",
        "servers": []
    }
]

Suspend

Required access

write to org/ORG_ID/projects/PROJECT_ID

Method

POST

URL

/api/org/ORG_ID/projects/PROJECT_ID/clusters/CLUSTER_ID/suspend

Request body

None

Request headers

Authorization: Bearer ACCESS_TOKEN

Responses:

200: OK

Response format:

{
    "id": string,
    "serverCount": number,
    "storageSizeGB": number,
    "isFree": boolean,
    "status": string,
    "createdAt": number,
    "organization": string,
    "project": string,
    "version": string,
    "provider": string,
    "region": string,
    "machineType": string,
    "storageType": string,
    "servers": [
        {
          "address": string,
          "status": string
        }
    ]
}
400: Bad Request

Possible causes:

  • Incorrectly formatted request (e.g. Authorization header missing a token)

Response format:

{
    "code": string,
    "message": string
}
401: Unauthorized

Possible causes:

  • Invalid token

  • Expired token

Response format:

{
    "code": string,
    "message": string
}
403: Forbidden

Possible causes:

  • The supplied access token lacks the required access level for the request

Response format:

{
    "code": string,
    "message": string
}
404: Not Found

Possible causes:

  • One or more resources referenced in the request could not be found

Response format:

{
    "code": string,
    "message": string
}
500: Internal Server Error

Possible causes:

  • An unexpected error prevented TypeDB Cloud from serving your request

Response format:

{
    "code": string,
    "message": string
}

Example request:

  • curl

  • Python

  • Rust

curl --request POST \
    --url https://cloud.typedb.com/api/org/ORG_ID/projects/PROJECT_ID/clusters/CLUSTER_ID/suspend \
    --header 'Authorization: Bearer {ACCESS-TOKEN}'
import requests

url = "https://cloud.typedb.com/api/org/ORG_ID/projects/PROJECT_ID/clusters/CLUSTER_ID/suspend"

headers = {
    "Authorization": "Bearer {ACCESS-TOKEN}"
}

response = requests.post(url, headers=headers)
use reqwest;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::new();
    let resp = client
        .post("https://cloud.typedb.com/api/org/ORG_ID/projects/PROJECT_ID/clusters/CLUSTER_ID/suspend")
        .header(reqwest::header::AUTHORIZATION, "Bearer {ACCESS-TOKEN}")
        .send().await;
    Ok(())
}

Example response:

{
    "id":"new-cluster",
    "serverCount":1,
    "storageSizeGB":10,
    "isFree":true,
    "status":"suspending",
    "createdAt":1738256490070,
    "organizationID":"new-organization",
    "projectID":"default",
    "version":"3.0.6",
    "provider":"gcp",
    "region":"europe-west2",
    "machineType":"c2d-highcpu-2",
    "storageType":"standard-rwo",
    "servers": [
        {
          "address": "abc123-0.cluster.typedb.com:80",
          "status": "running"
        }
    ]
}

Resume

Required access

write to org/ORG_ID/projects/PROJECT_ID

Method

POST

URL

/api/org/ORG_ID/projects/PROJECT_ID/clusters/CLUSTER_ID/resume

Request body

None

Request headers

Authorization: Bearer ACCESS_TOKEN

Responses:

200: OK

Response format:

{
    "id": string,
    "serverCount": number,
    "storageSizeGB": number,
    "isFree": boolean,
    "status": string,
    "createdAt": number,
    "organization": string,
    "project": string,
    "version": string,
    "provider": string,
    "region": string,
    "machineType": string,
    "storageType": string,
    "servers": [
        {
          "address": string,
          "status": string
        }
    ]
}
400: Bad Request

Possible causes:

  • Incorrectly formatted request (e.g. Authorization header missing a token)

Response format:

{
    "code": string,
    "message": string
}
401: Unauthorized

Possible causes:

  • Invalid token

  • Expired token

Response format:

{
    "code": string,
    "message": string
}
403: Forbidden

Possible causes:

  • The supplied access token lacks the required access level for the request

Response format:

{
    "code": string,
    "message": string
}
404: Not Found

Possible causes:

  • One or more resources referenced in the request could not be found

Response format:

{
    "code": string,
    "message": string
}
500: Internal Server Error

Possible causes:

  • An unexpected error prevented TypeDB Cloud from serving your request

Response format:

{
    "code": string,
    "message": string
}

Example request:

  • curl

  • Python

  • Rust

curl --request POST \
    --url https://cloud.typedb.com/api/org/ORG_ID/projects/PROJECT_ID/clusters/CLUSTER_ID/resume \
    --header 'Authorization: Bearer {ACCESS-TOKEN}'
import requests

url = "https://cloud.typedb.com/api/org/ORG_ID/projects/PROJECT_ID/clusters/CLUSTER_ID/resume"

headers = {
    "Authorization": "Bearer {ACCESS-TOKEN}"
}

response = requests.post(url, headers=headers)
use reqwest;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::new();
    let resp = client
        .post("https://cloud.typedb.com/api/org/ORG_ID/projects/PROJECT_ID/clusters/CLUSTER_ID/resume")
        .header(reqwest::header::AUTHORIZATION, "Bearer {ACCESS-TOKEN}")
        .send().await;
    Ok(())
}

Example response:

{
    "id":"new-cluster",
    "serverCount":1,
    "storageSizeGB":10,
    "isFree":true,
    "status":"resuming",
    "createdAt":1738256490070,
    "organizationID":"new-organization",
    "projectID":"default",
    "version":"3.0.6",
    "provider":"gcp",
    "region":"europe-west2",
    "machineType":"c2d-highcpu-2",
    "storageType":"standard-rwo",
    "servers": [
        {
          "address": "abc123-0.cluster.typedb.com:80",
          "status": "pending"
        }
    ]
}

Destroy

Required access

admin to org/ORG_ID/projects/PROJECT_ID

Method

DELETE

URL

/api/org/ORG_ID/projects/PROJECT_ID/clusters/CLUSTER_ID

Request body

None

Request headers

Authorization: Bearer ACCESS_TOKEN

Responses:

200: OK

Response format:

{
    "id": string,
    "serverCount": number,
    "storageSizeGB": number,
    "isFree": boolean,
    "status": string,
    "createdAt": number,
    "organization": string,
    "project": string,
    "version": string,
    "provider": string,
    "region": string,
    "machineType": string,
    "storageType": string,
    "servers": [
        {
          "address": string,
          "status": string
        }
    ]
}
400: Bad Request

Possible causes:

  • Incorrectly formatted request (e.g. Authorization header missing a token)

Response format:

{
    "code": string,
    "message": string
}
401: Unauthorized

Possible causes:

  • Invalid token

  • Expired token

Response format:

{
    "code": string,
    "message": string
}
403: Forbidden

Possible causes:

  • The supplied access token lacks the required access level for the request

Response format:

{
    "code": string,
    "message": string
}
404: Not Found

Possible causes:

  • One or more resources referenced in the request could not be found

Response format:

{
    "code": string,
    "message": string
}
500: Internal Server Error

Possible causes:

  • An unexpected error prevented TypeDB Cloud from serving your request

Response format:

{
    "code": string,
    "message": string
}

Example request:

  • curl

  • Python

  • Rust

curl --request DELETE \
    --url https://cloud.typedb.com/api/org/ORG_ID/projects/PROJECT_ID/clusters/CLUSTER_ID \
    --header 'Authorization: Bearer {ACCESS-TOKEN}'
import requests

url = "https://cloud.typedb.com/api/org/ORG_ID/projects/PROJECT_ID/clusters/CLUSTER_ID"

headers = {
    "Authorization": "Bearer {ACCESS-TOKEN}"
}

response = requests.delete(url, headers=headers)
use reqwest;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::new();
    let resp = client
        .delete("https://cloud.typedb.com/api/org/ORG_ID/projects/PROJECT_ID/clusters/CLUSTER_ID")
        .header(reqwest::header::AUTHORIZATION, "Bearer {ACCESS-TOKEN}")
        .send().await;
    Ok(())
}

Example response:

{
    "id":"new-cluster",
    "serverCount":1,
    "storageSizeGB":10,
    "isFree":true,
    "status":"destroying",
    "createdAt":1738256490070,
    "organizationID":"new-organization",
    "projectID":"default",
    "version":"3.0.6",
    "provider":"gcp",
    "region":"europe-west2",
    "machineType":"c2d-highcpu-2",
    "storageType":"standard-rwo",
    "servers": [
        {
          "address": "abc123-0.cluster.typedb.com:80",
          "status": "running"
        }
    ]
}