Skip to main content

NoSQL Tables

ZeroDB provides schema-free NoSQL tables for storing structured data alongside vectors and memory.

All table endpoints are project-scoped: /api/v1/projects/{project_id}/database/tables/...

Create a Table

curl -X POST https://api.ainative.studio/api/v1/projects/{project_id}/database/tables \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "customers",
"description": "Customer records"
}'

Insert a Row

Rows are inserted one at a time. The body key is row_data.

curl -X POST https://api.ainative.studio/api/v1/projects/{project_id}/database/tables/customers/rows \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"row_data": {"name": "Alice", "email": "alice@example.com", "plan": "pro"}
}'

Query Rows

curl -X POST https://api.ainative.studio/api/v1/projects/{project_id}/database/tables/customers/query \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"filters": {"plan": "pro"},
"limit": 10,
"skip": 0
}'

Update a Row

curl -X PUT https://api.ainative.studio/api/v1/projects/{project_id}/database/tables/customers/rows/{row_id} \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"row_data": {"plan": "business"}
}'

Bulk Update (filter-based)

curl -X PUT https://api.ainative.studio/api/v1/projects/{project_id}/database/tables/customers/rows/bulk \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"filter": {"plan": "free"},
"update": {"$set": {"plan": "starter"}}
}'

Delete a Row

curl -X DELETE https://api.ainative.studio/api/v1/projects/{project_id}/database/tables/customers/rows/{row_id} \
-H "Authorization: Bearer $TOKEN"

Python SDK

import requests

API_KEY = "your-api-key"
PROJECT_ID = "your-project-id"
headers = {"Authorization": f"Bearer {API_KEY}"}
base = f"https://api.ainative.studio/api/v1/projects/{PROJECT_ID}/database/tables"

# Create a table
requests.post(base, headers=headers, json={
"name": "user_profiles",
"description": "Agent user preferences"
})

# Insert a row — body key is row_data
requests.post(f"{base}/user_profiles/rows", headers=headers, json={
"row_data": {"name": "Alice", "role": "admin", "credits": 500}
})

# Query with filters and sorting
response = requests.post(f"{base}/user_profiles/query", headers=headers, json={
"filters": {"role": "developer", "credits": {"$gte": 100}},
"sort": {"credits": -1},
"limit": 10
})
for row in response.json()["rows"]:
print(f"{row['row_data']['name']}: {row['row_data']['credits']} credits")

Query Parameters

ParameterTypeRequiredDescription
filtersobjectNoMongoDB-style filter (e.g., {"role": "admin"})
limitintegerNoMax rows to return (default 100, max 1000)
skipintegerNoPagination offset
sortobjectNoSort order (e.g., {"credits": -1})
projectionstring[]NoFields to include in results

Endpoints

MethodPathDescription
POST/projects/{id}/database/tablesCreate a table
GET/projects/{id}/database/tablesList tables
POST/projects/{id}/database/tables/{name}/rowsInsert a row
GET/projects/{id}/database/tables/{name}/rowsList rows (paginated)
POST/projects/{id}/database/tables/{name}/queryQuery rows with filters
GET/projects/{id}/database/tables/{name}/rows/{row_id}Get a row by ID
PUT/projects/{id}/database/tables/{name}/rows/{row_id}Update a row by ID
PUT/projects/{id}/database/tables/{name}/rows/bulkBulk update with filter
DELETE/projects/{id}/database/tables/{name}/rows/{row_id}Delete a row
DELETE/projects/{id}/database/tables/{name}/rows/bulkBulk delete with filter
DELETE/projects/{id}/database/tables/{name}Delete a table