Skip to content

REST API Reference

Base URL: https://api.deeplake.ai

All authenticated endpoints require a Bearer token:

headers = {"Authorization": f"Bearer {TOKEN}"}

Authentication

Get current user

requests.get(f"{API_URL}/me", headers=headers)

List organizations

requests.get(f"{API_URL}/organizations", headers=headers)

Health

Health check

requests.get(f"{API_URL}/health")

Ready status

requests.get(f"{API_URL}/ready")

Organizations

Get organization

requests.get(f"{API_URL}/organizations/{org_id}", headers=headers)

Create organization

requests.post(
    f"{API_URL}/organizations",
    headers={**headers, "Content-Type": "application/json"},
    json={"id": "my-org", "name": "My Organization"},
)

Update organization

requests.patch(
    f"{API_URL}/organizations/{org_id}",
    headers={**headers, "Content-Type": "application/json"},
    json={"name": "New Name"},
)

Delete organization

requests.delete(f"{API_URL}/organizations/{org_id}", headers=headers)

List members

requests.get(f"{API_URL}/organizations/{org_id}/members", headers=headers)

Invite member

requests.post(
    f"{API_URL}/organizations/{org_id}/members",
    headers={**headers, "Content-Type": "application/json"},
    json={"email": "user@example.com", "role": "member"},
)

Update member role

requests.patch(
    f"{API_URL}/organizations/{org_id}/members/{user_id}",
    headers={**headers, "Content-Type": "application/json"},
    json={"role": "admin"},
)

Remove member

requests.delete(
    f"{API_URL}/organizations/{org_id}/members/{user_id}",
    headers=headers,
)

Workspaces

List workspaces

requests.get(f"{API_URL}/workspaces", headers=headers)

Get workspace

requests.get(f"{API_URL}/workspaces/{workspace}", headers=headers)

Create workspace

requests.post(
    f"{API_URL}/workspaces",
    headers={**headers, "Content-Type": "application/json"},
    json={"id": "my-workspace", "name": "My Workspace"},
)

Update workspace

requests.patch(
    f"{API_URL}/workspaces/{workspace}",
    headers={**headers, "Content-Type": "application/json"},
    json={"name": "New Name"},
)

Delete workspace

requests.delete(f"{API_URL}/workspaces/{workspace}", headers=headers)

Tables

List tables

requests.get(f"{API_URL}/workspaces/{workspace}/tables", headers=headers)

Get table details

requests.get(f"{API_URL}/workspaces/{workspace}/tables/{table}", headers=headers)

Create table from file

requests.post(
    f"{API_URL}/workspaces/{workspace}/tables",
    headers=headers,
    files={
        "file": open("data.csv", "rb"),
        "filename": (None, "data.csv"),
        "table_name": (None, "my_table"),
    },
)

Drop table

requests.delete(f"{API_URL}/workspaces/{workspace}/tables/{table}", headers=headers)

SQL Queries

All SQL goes through a single endpoint.

Execute query

requests.post(
    f"{API_URL}/workspaces/{workspace}/tables/query",
    headers={**headers, "Content-Type": "application/json"},
    json={"query": "SELECT * FROM \"my_table\" LIMIT 10"},
)

Parameterized query

requests.post(
    f"{API_URL}/workspaces/{workspace}/tables/query",
    headers={**headers, "Content-Type": "application/json"},
    json={
        "query": "INSERT INTO \"my_table\" (title, content) VALUES ($1, $2)",
        "params": ["My Title", "My Content"],
    },
)

Batch query

requests.post(
    f"{API_URL}/workspaces/{workspace}/tables/query/batch",
    headers={**headers, "Content-Type": "application/json"},
    json={
        "query": "INSERT INTO \"my_table\" (title, content) VALUES ($1, $2)",
        "params_batch": [
            ["Title A", "Content A"],
            ["Title B", "Content B"],
        ],
    },
)

Files

List files

requests.get(
    f"{API_URL}/workspaces/{workspace}/files?limit=20&offset=0",
    headers=headers,
)

Get file info

requests.get(f"{API_URL}/workspaces/{workspace}/files/{file_id}", headers=headers)

Download file

requests.get(f"{API_URL}/workspaces/{workspace}/files/{file_id}/content", headers=headers)

Upload file

Multipart form-data. Do not set Content-Type: application/json.

requests.post(
    f"{API_URL}/workspaces/{workspace}/files",
    headers=headers,
    files={"file": ("myfile.png", open("myfile.png", "rb"), "image/png")},
)

Delete file

requests.delete(f"{API_URL}/workspaces/{workspace}/files/{file_id}", headers=headers)

Endpoint summary

Category Method Endpoint Count
Auth GET /me, /organizations 2
Health GET /health, /ready 2
Organizations GET/POST/PATCH/DELETE /organizations/{id} 4
Org Members GET/POST/PATCH/DELETE /organizations/{id}/members 4
Workspaces GET/POST/PATCH/DELETE /workspaces/{id} 5
Tables GET/POST/DELETE /workspaces/{id}/tables 4
SQL POST /workspaces/{id}/tables/query[/batch] 3
Files GET/POST/DELETE /workspaces/{id}/files 5
Total 29