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 |
|
URL |
|
Request body |
None |
Request headers |
|
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 |
---|---|
Method |
|
URL |
|
Request body |
|
Request headers |
|
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 |
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 |
---|---|
|
The cluster’s ID must be unique within its project, and consist only of lowercase alphanumeric characters, optionally separated by underscores and hyphens. |
|
An odd integer value between 1 and 9. TypeDB version 3.0 and onwards can currently only have one server. |
|
An integer value between 10 and 1000. |
|
Must be either |
|
If set to If set to |
|
See below |
|
See below |
|
See below |
|
Currently available versions are:
|
GCP regions and machine types
Machine Types | Free Available | Regions |
---|---|---|
c2d-highcpu-2 |
Yes |
|
c2d-highcpu-4 |
No |
|
c2d-highcpu-8 |
No |
|
c2d-highcpu-16 |
No |
|
AWS regions and machine types
Machine Types | Free Available | Regions |
---|---|---|
c7g.large |
Yes |
|
c7g.xlarge |
No |
|
c7g.2xlarge |
No |
|
c7g.4xlarge |
No |
|
c8g.large |
Yes |
|
c8g.xlarge |
No |
|
c8g.2xlarge |
No |
|
c8g.4xlarge |
No |
|
Azure regions and machine types
Machine Types | Free Available | Regions |
---|---|---|
Standard_F2s_v2 |
Yes |
|
Standard_F4s_v2 |
No |
|
Standard_F8s_v2 |
No |
|
Standard_F16s_v2 |
No |
|
Storage types
Provider | Storage Type |
---|---|
GCP |
standard-rwo |
AWS |
gp2 |
Azure |
default |
Get
Required access |
read to |
---|---|
Method |
|
URL |
|
Request body |
None |
Request headers |
|
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 |
---|---|
Method |
|
URL |
|
Request body |
None |
Request headers |
|
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 |
---|---|
Method |
|
URL |
|
Request body |
None |
Request headers |
|
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 |
---|---|
Method |
|
URL |
|
Request body |
None |
Request headers |
|
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 |
---|---|
Method |
|
URL |
|
Request body |
None |
Request headers |
|
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"
}
]
}