REST API Reference¶
Base URL: https://api.deeplake.ai
All authenticated endpoints require a Bearer token:
Authentication¶
Get current user¶
List organizations¶
Health¶
Health check¶
Ready status¶
Organizations¶
Get organization¶
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¶
List members¶
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¶
Workspaces¶
List workspaces¶
Get workspace¶
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¶
Tables¶
List tables¶
Get table details¶
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¶
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¶
Get file info¶
Download file¶
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¶
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 |