API Reference
Every endpoint of the SwarmV REST API. The SDKs wrap all of it; use this page when calling the API from another language or checking exact behaviour.
Basics
- Base URL:
https://api.swarmv.dev. Requests and responses are JSON. - Authentication:
Authorization: Bearer <credential>, either an API key (backend only,evx_live_…) or a user token from Create a user token. Each API key belongs to one index. See Authentication. - Status: swarmv.dev/status shows whether search, writes and access control are working right now; the same data is at GET /v1/health for monitoring.
- Errors: JSON
{ error, code? }for most, plain text for authentication failures. Temporary failures (429,503) includeRetry-After; the SDKs retry them for you. The full list is in the error table.
Vectors
Insert or update a vector
/v1/insertWrites one record. If the id exists it's replaced, but only within the same container: an id can't move to another container. Writes are accepted at once and become searchable everywhere within seconds to about a minute; use fresh: true on search or fetch to read them immediately.
SDK: insert() in TypeScript, insert() in Python.
Request body
| Field | Type | Description |
|---|---|---|
| id*string (id) | string (id) | Document id: an unsigned 32-bit integer (0 to 4294967295), sent as a string. "007" and "7" are the same document. |
| vector*array of number | array of number | Finite numbers. Every vector in an index has the same length (set by the first insert). |
| metadataobject (metadata) | object (metadata) | Flat key/value pairs (string, number or boolean), at most 8 KB in total, without the bytes \x00-\x02. Values come back as strings. container_id decides who can see the record. |
| auth_user_idstring | string | Write as this user (needs vector:impersonate). User tokens always write as their own user. |
curl -X POST https://api.swarmv.dev/v1/insert \
-H "Authorization: Bearer $SWARMV_API_KEY" \
-H "Content-Type: application/json" \
-d '{"id": "4021", "vector": [0.12, -0.04, 0.33], "metadata": {"container_id": "container:handbook", "text": "Employees get 25 days of paid leave."}}'{
"status": "accepted"
}Errors
| 400 | Invalid id, vector or metadata; with a user token, metadata.container_id is missing; or a vector whose length differs from the index's (code dimension_mismatch).dimension_mismatch |
| 401 | Missing, invalid, expired, rotated or revoked key or token (plain text body). |
| 402 | No active plan (code plan_required), or the Basic plan's monthly reads or writes are used up (code plan_limit).plan_requiredplan_limit |
| 403 | Missing vector:write scope; the user can't edit the container; or the id already belongs to another container (code container_limit_exceeded when the user reaches over 1,000 containers).container_limit_exceeded |
| 413 | Metadata over 8 KB, or the index is full (code index_full).index_full |
| 429 | Too many requests for this key (6,000 per minute; plain text). Retry-After says how many seconds until the window resets. |
| 503 | Temporary: the write backlog is full, the index is catching up with recent writes (code index_busy), or the index is being migrated (code migrating) or is frozen (code store_frozen). Retry after the Retry-After header.migratingstore_frozenstore_movedindex_busy |
Insert or update up to 500 vectors
/v1/upsert-batchLike insert, for up to 500 records at once. The batch is checked as a whole before anything is written: if any record is rejected, none are, and the error names the record (index). Also served at /upsert-batch for older clients. The SDKs' insertMany / insert_many use it.
SDK: insertMany() in TypeScript, insert_many() in Python.
Request body
| Field | Type | Description |
|---|---|---|
| vectors*array of VectorRecord | array of VectorRecord | up to 500 items |
| vectors[].id*string (id) | string (id) | Document id: an unsigned 32-bit integer (0 to 4294967295), sent as a string. "007" and "7" are the same document. |
| vectors[].vector*array of number | array of number | Finite numbers. Every vector in an index has the same length (set by the first insert). |
| vectors[].metadataobject (metadata) | object (metadata) | Flat key/value pairs (string, number or boolean), at most 8 KB in total, without the bytes \x00-\x02. Values come back as strings. container_id decides who can see the record. |
| vectors[].auth_user_idstring | string | Write as this user (needs vector:impersonate). User tokens always write as their own user. |
curl -X POST https://api.swarmv.dev/v1/upsert-batch \
-H "Authorization: Bearer $SWARMV_API_KEY" \
-H "Content-Type: application/json" \
-d '{"vectors": [{"id": "4021", "vector": [0.12, -0.04, 0.33], "metadata": {"container_id": "container:handbook"}}]}'{
"success": true,
"inserted": 2
}Errors
| 400 | A record is invalid; the response's index says which; or a vector whose length differs from the index's (code dimension_mismatch).dimension_mismatch |
| 401 | Missing, invalid, expired, rotated or revoked key or token (plain text body). |
| 402 | No active plan (code plan_required), or the Basic plan's monthly reads or writes are used up (code plan_limit).plan_requiredplan_limit |
| 403 | Same rules as insert, for any record in the batch.container_limit_exceeded |
| 413 | More than 500 records, metadata over 8 KB, or the index is full (code index_full).index_full |
| 429 | Too many requests for this key (6,000 per minute; plain text). Retry-After says how many seconds until the window resets. |
| 503 | Temporary: the write backlog is full, the index is catching up with recent writes (code index_busy), or the index is being migrated (code migrating) or is frozen (code store_frozen). Retry after the Retry-After header.migratingstore_frozenstore_movedindex_busy |
Bulk import up to 2,000 records per request
/v1/importFor loading large datasets: up to 2,000 records per request in a compact binary chunk, with the same checks and ownership rules as upsert-batch (if any record is rejected, none are). Imported records become searchable once merged, usually within a minute; they are not visible to fresh searches before that. Backend API keys only (not user tokens). Each record counts as one write.
Body (application/octet-stream, little-endian): the 4 bytes EVI1, u32 dimension, u32 record count, then for each record: u32 id, the vector as f32 × dimension, u32 metadata length n, and n bytes of metadata as a UTF-8 JSON object (n = 0: no metadata). At most 16 MB. scripts/bulk-load.ts in the repository shows how to build chunks.
Query parameters
| Field | Type | Description |
|---|---|---|
| bulkstring | string | First load of a new index: stage this chunk under a bulk session instead of merging it. When every chunk is uploaded, POST /v1/import/commit builds the whole index in one pass (much faster for large loads). Only for an index with no records yet (409 bulk_needs_new_index otherwise). |
curl -X POST https://api.swarmv.dev/v1/import \ -H "Authorization: Bearer $SWARMV_API_KEY" \ -H "Content-Type: application/octet-stream" \ --data-binary @chunk-0001.evi
{
"success": true,
"accepted": 2000
}Errors
| 400 | Not a valid chunk (code invalid_import), a record is invalid (the response's index says which), or a vector whose length differs from the index's (code dimension_mismatch).invalid_importdimension_mismatch |
| 401 | Missing, invalid, expired, rotated or revoked key or token (plain text body). |
| 402 | No active plan (code plan_required), or the Basic plan's monthly reads or writes are used up (code plan_limit).plan_requiredplan_limit |
| 403 | Missing vector:write scope, a user token (bulk import needs a backend API key), or a record id that already exists in a different container. |
| 409 | bulk_needs_new_index: ?bulk on an index that already has records; bulk_build_in_progress: a bulk build is running for this index (other writes wait for it). |
| 413 | More than 500 records, metadata over 8 KB, or the index is full (code index_full).index_full |
| 429 | Too many requests for this key (6,000 per minute; plain text). Retry-After says how many seconds until the window resets. |
| 503 | Temporary: the write backlog is full, the index is catching up with recent writes (code index_busy), or the index is being migrated (code migrating) or is frozen (code store_frozen). Retry after the Retry-After header.migratingstore_frozenstore_movedindex_busy |
Delete a vector
/v1/deleteDeletes one record by id. With a user token, pass the record's container in metadata.container_id; the user needs editor access to it.
SDK: delete() in TypeScript, delete() in Python.
Request body
| Field | Type | Description |
|---|---|---|
| id*string (id) | string (id) | Document id: an unsigned 32-bit integer (0 to 4294967295), sent as a string. "007" and "7" are the same document. |
| metadataobject | object | The document's container. Required with user tokens (the user needs editor access to it). |
| auth_user_idstring | string | Delete as this user (needs vector:impersonate). |
curl -X POST https://api.swarmv.dev/v1/delete \
-H "Authorization: Bearer $SWARMV_API_KEY" \
-H "Content-Type: application/json" \
-d '{"id": "4021", "metadata": {"container_id": "container:handbook"}}'{
"status": "accepted"
}Errors
| 400 | Invalid id; with a user token, metadata.container_id is missing. |
| 401 | Missing, invalid, expired, rotated or revoked key or token (plain text body). |
| 402 | No active plan (code plan_required), or the Basic plan's monthly reads or writes are used up (code plan_limit).plan_requiredplan_limit |
| 403 | Missing vector:write scope, the record is in another container, or the user can't edit its container.container_limit_exceeded |
| 404 | With a user token: no such document. |
| 409 | The document's owner changed while the request ran (it was deleted or claimed by another container). Retry.conflict |
| 429 | Too many requests for this key (6,000 per minute; plain text). Retry-After says how many seconds until the window resets. |
| 503 | Temporary: the write backlog is full, or the index is being migrated (code migrating) or is frozen (code store_frozen). Retry after the Retry-After header.migratingstore_frozenstore_moved |
Search by vector, keyword or both
/v1/searchReturns the best-matching records. mode picks how they're matched:
vector(default): the closest vectors toquery.keyword: records whose metadatatextcontains the words intext(BM25 ranking; accents and case ignored, common English and Portuguese words dropped). No embedding needed.hybrid: both, fused with Reciprocal Rank Fusion;keyword_weightsets the balance.
With a user token (or auth_user_id), only records in containers that user can view are considered, in every mode: access control is applied inside the search, not by filtering results afterwards. Keyword and hybrid results carry score and match; vector results are unchanged. Keyword matching covers records once they're merged (seconds); fresh: true also matches writes that aren't merged yet. Counts as one read.
SDK: search() · searchText() · hybridSearch() in TypeScript, search() · search_text() · hybrid_search() in Python.
Request body
| Field | Type | Description |
|---|---|---|
| mode"vector" | "keyword" | "hybrid" | "vector" | "keyword" | "hybrid" | How records are matched. Sending text alone doesn't change the mode.default "vector" |
| textstring | string | The query as words. Required for keyword and hybrid modes. Matched against each record's metadata text.up to 2000 characters |
| queryarray of number | array of number | Query vector, same length as the index's vectors. Required for vector and hybrid modes. |
| top_kinteger | integer | default 10, 1–100 |
| nprobeinteger | integer | How many clusters to search in compressed indexes: higher is more accurate and slower. The SDKs send 4.default 16, 1–64 |
| filterobject | object | Metadata conditions, all of which must hold. A plain value means equals; operators: $eq, $ne, $in, $nin (up to 100 values), $gt, $gte, $lt, $lte, $exists. $or takes up to 8 filters (other fields apply to every branch). Numbers compare numerically, text byte-wise (ISO-8601 dates sort correctly). $ne and $nin also match records without the field. Only values up to 128 bytes can be filtered. |
| include_metadataboolean | boolean | default true |
| freshboolean | boolean | Also return writes that aren't in the edge index yet (read-your-own-writes), at a little extra latency.default false |
| auth_user_idstring | string | Search as this user (needs vector:impersonate). User tokens always search as their own user. |
| keyword_weightnumber | number | Hybrid mode: how much keyword matches count against vector matches (0 = vector only, 1 = keyword only).default 0.5, 0–1 |
curl -X POST https://api.swarmv.dev/v1/search \
-H "Authorization: Bearer $SWARMV_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query": [0.12, -0.04, 0.33], "top_k": 5}'
# Hybrid: vector + keywords
curl -X POST https://api.swarmv.dev/v1/search \
-H "Authorization: Bearer $SWARMV_API_KEY" \
-H "Content-Type: application/json" \
-d '{"mode": "hybrid", "query": [0.12, -0.04, 0.33], "text": "refund policy", "top_k": 5}'
# Keyword only: no embedding needed
curl -X POST https://api.swarmv.dev/v1/search \
-H "Authorization: Bearer $SWARMV_API_KEY" \
-H "Content-Type: application/json" \
-d '{"mode": "keyword", "text": "ERR_4021", "top_k": 5}'[
{
"id": "4021",
"distance": 0.084,
"metadata": {
"container_id": "container:handbook",
"text": "Employees get 25 days of paid leave."
}
}
]Errors
| 400 | Invalid query vector, a dimension mismatch with the index, an invalid filter (code invalid_filter), or an invalid mode, text (missing, or over 2,000 characters) or keyword_weight.invalid_filter |
| 401 | Missing, invalid, expired, rotated or revoked key or token (plain text body). |
| 402 | No active plan (code plan_required), or the Basic plan's monthly reads or writes are used up (code plan_limit).plan_requiredplan_limit |
| 403 | Missing vector:read scope, auth_user_id without vector:impersonate, or the user reaches over 1,000 containers.container_limit_exceeded |
| 404 | The index has no data yet (plain text). |
| 429 | Too many requests for this key (6,000 per minute; plain text). Retry-After says how many seconds until the window resets. |
| 503 | Keyword search is briefly unavailable (keyword mode only; hybrid falls back to vector results). Retry shortly. |
| 507 | The index is too large to search at the edge (code index_too_large).index_too_large |
Get records by id
/v1/fetchReturns up to 100 records by id, with their metadata and optionally their vectors. Same visibility as search: records the caller can't see are listed as missing, never as forbidden, so ids in other containers can't be probed. Includes writes that aren't merged yet. Counts as one read.
SDK: fetchRecords() in TypeScript, fetch_records() in Python.
Request body
| Field | Type | Description |
|---|---|---|
| ids*array of string (id) | array of string (id) | up to 100 items |
| include_metadataboolean | boolean | default true |
| include_vectorboolean | boolean | default false |
| auth_user_idstring | string | Fetch as this user (needs vector:impersonate). User tokens always fetch as their own user. |
curl -X POST https://api.swarmv.dev/v1/fetch \
-H "Authorization: Bearer $SWARMV_API_KEY" \
-H "Content-Type: application/json" \
-d '{"ids": ["4021", "4022"]}'{
"records": [
{
"id": "4021",
"metadata": {
"container_id": "container:handbook",
"text": "Employees get 25 days of paid leave."
}
}
],
"missing": [
"4022"
]
}Errors
| 400 | ids missing, empty or not 32-bit integers. |
| 401 | Missing, invalid, expired, rotated or revoked key or token (plain text body). |
| 402 | No active plan (code plan_required), or the Basic plan's monthly reads or writes are used up (code plan_limit).plan_requiredplan_limit |
| 403 | Missing vector:read scope, auth_user_id without vector:impersonate, or the user reaches over 1,000 containers.container_limit_exceeded |
| 413 | More than 100 ids. |
| 429 | Too many requests for this key (6,000 per minute; plain text). Retry-After says how many seconds until the window resets. |
List records
/v1/recordsPages through the index's records in id order (merged records: writes from the last few seconds may not be listed yet; deleted records are not listed). Backend API keys only, since the list isn't limited to a user's containers. Indexes created before October 2026 answer 404 (code not_clustered).
Query parameters
| Field | Type | Description |
|---|---|---|
| afterstring (id) | string (id) | List ids after this one (the previous page's next). |
| limitinteger | integer | Page size.default 50, 1–200 |
| containerstring | string | Only records in this container. |
curl "https://api.swarmv.dev/v1/records?limit=100" \ -H "Authorization: Bearer $SWARMV_API_KEY"
{
"records": [
{
"id": "4021",
"container": "container:handbook"
},
{
"id": "4022",
"container": null
}
],
"next": "4022"
}Errors
| 401 | Missing, invalid, expired, rotated or revoked key or token (plain text body). |
| 402 | No active plan (code plan_required), or the Basic plan's monthly reads or writes are used up (code plan_limit).plan_requiredplan_limit |
| 403 | A user token, or a key without vector:read. |
| 404 | The index uses the older format (code not_clustered).not_clustered |
| 429 | Too many requests for this key (6,000 per minute; plain text). Retry-After says how many seconds until the window resets. |
Build a new index from a bulk import session
/v1/import/commitStarts building the index from every chunk uploaded with /v1/import?bulk=<session>, in one pass: lists are trained for the whole load and written once, so large loads are searchable much sooner than through merges. Records with the same id keep their newest copy. The build runs in the background; poll GET /v1/import/status. Other writes to the index wait (409 bulk_build_in_progress) until it is done. Backend API keys only.
Request body
| Field | Type | Description |
|---|---|---|
| session*string | string |
Errors
| 400 | Invalid session, or no chunks uploaded for it (bulk_empty) |
| 409 | bulk_needs_new_index or bulk_build_in_progress |
Progress of a bulk import build
/v1/import/statusState of the build started by /v1/import/commit: building (with step once records are searchable and keyword text is being indexed), done (with records), or failed (with error; commit the session again, or start a new one).
Query parameters
| Field | Type | Description |
|---|---|---|
| sessionstring | string |
Errors
| 404 | No build for this session |
Auth
Create a user token
/v1/auth/tokenCreates a short-lived token (at most 1 hour) that acts as one user: it can only search, fetch and write within the containers that user can access. Call it from your backend with an API key, and give the token, not the key, to agents, MCP servers and browsers. Tokens can't create tokens.
SDK: generateUserToken() in TypeScript, generate_user_token() in Python.
Request body
| Field | Type | Description |
|---|---|---|
| user_id*string | string | |
| expires_ininteger | integer | Lifetime in seconds; longer values are capped at 3600.default 3600, 1–3600 |
| scopesarray of "vector:read" | "vector:write" | array of "vector:read" | "vector:write" | A subset of the key's scopes. Defaults to the key's vector scopes. graph:*, vector:impersonate and keys:admin are never allowed in tokens. |
curl -X POST https://api.swarmv.dev/v1/auth/token \
-H "Authorization: Bearer $SWARMV_API_KEY" \
-H "Content-Type: application/json" \
-d '{"user_id": "user:dave", "expires_in": 900}'{
"token": "eyJhbGciOiJIUzI1NiIs..."
}Errors
| 400 | user_id isn't a user: id, or expires_in isn't a positive integer (plain text). |
| 401 | Missing, invalid, expired, rotated or revoked key or token (plain text body). |
| 402 | No active plan (code plan_required), or the Basic plan's monthly reads or writes are used up (code plan_limit).plan_requiredplan_limit |
| 403 | Called with a token, or asked for a scope the key doesn't have or that tokens can't hold (plain text). |
| 429 | Too many requests for this key (6,000 per minute; plain text). Retry-After says how many seconds until the window resets. |
Access graph
List relationships
/v1/graph/edgesPages through your account's relationships, optionally filtered.
SDK: graph.listRelations() in TypeScript, list_relations() in Python.
Query parameters
| Field | Type | Description |
|---|---|---|
| subjectstring | string | Only this subject. |
| objectstring | string | Only this object. |
| relation"member" | "viewer" | "editor" | "parent" | "member" | "viewer" | "editor" | "parent" | Only this relation. |
| qstring | string | Text search: part of a subject, relation or object. |
| limitinteger | integer | Page size.default 50, 1–200 |
| offsetinteger | integer | Rows to skip.default 0 |
curl -X GET https://api.swarmv.dev/v1/graph/edges?object=group:engineering \ -H "Authorization: Bearer $SWARMV_API_KEY"
{
"edges": [
{
"subject": "user:dave",
"relation": "member",
"object": "group:engineering"
}
],
"total": 1,
"limit": 50,
"offset": 0
}Errors
| 401 | Missing, invalid, expired, rotated or revoked key or token (plain text body). |
| 402 | No active plan (code plan_required), or the Basic plan's monthly reads or writes are used up (code plan_limit).plan_requiredplan_limit |
| 403 | Missing graph:read (or graph:admin) scope, or called with a user token (plain text). |
| 429 | Too many requests for this key (6,000 per minute; plain text). Retry-After says how many seconds until the window resets. |
Add a relationship
/v1/graph/edgeAdds one relationship, e.g. a user joining a group or a group becoming viewer of a folder. Permissions at the edge update within seconds. Re-sending an existing relationship is harmless and refreshes the affected permissions.
SDK: graph.createRelation() in TypeScript, create_relation() in Python.
Request body
| Field | Type | Description |
|---|---|---|
| subject*string | string | A node with a type prefix: user:, group:, folder: or container:.up to 256 characters |
| relation*"member" | "viewer" | "editor" | "parent" | "member" | "viewer" | "editor" | "parent" | |
| object*string | string | A node with a type prefix: user:, group:, folder: or container:.up to 256 characters |
curl -X POST https://api.swarmv.dev/v1/graph/edge \
-H "Authorization: Bearer $SWARMV_API_KEY" \
-H "Content-Type: application/json" \
-d '{"subject": "user:dave", "relation": "member", "object": "group:engineering"}'{
"success": true,
"changed": true
}Errors
| 400 | Missing fields, an unknown relation, or a node without a valid prefix (plain text). |
| 401 | Missing, invalid, expired, rotated or revoked key or token (plain text body). |
| 402 | No active plan (code plan_required), or the Basic plan's monthly reads or writes are used up (code plan_limit).plan_requiredplan_limit |
| 403 | Missing graph:admin scope, or the plan's relationship limit is reached (code relationship_limit).relationship_limit |
| 429 | Too many requests for this key (6,000 per minute; plain text). Retry-After says how many seconds until the window resets. |
Remove a relationship
/v1/graph/edgeRemoves one relationship. Access that depended on it ends everywhere within seconds.
SDK: graph.deleteRelation() in TypeScript, delete_relation() in Python.
Request body
| Field | Type | Description |
|---|---|---|
| subject*string | string | A node with a type prefix: user:, group:, folder: or container:.up to 256 characters |
| relation*"member" | "viewer" | "editor" | "parent" | "member" | "viewer" | "editor" | "parent" | |
| object*string | string | A node with a type prefix: user:, group:, folder: or container:.up to 256 characters |
curl -X DELETE https://api.swarmv.dev/v1/graph/edge \
-H "Authorization: Bearer $SWARMV_API_KEY" \
-H "Content-Type: application/json" \
-d '{"subject": "user:dave", "relation": "member", "object": "group:engineering"}'{
"success": true,
"changed": true
}Errors
| 400 | Missing fields, an unknown relation, or a node without a valid prefix (plain text). |
| 401 | Missing, invalid, expired, rotated or revoked key or token (plain text body). |
| 402 | No active plan (code plan_required), or the Basic plan's monthly reads or writes are used up (code plan_limit).plan_requiredplan_limit |
| 403 | Missing graph:admin scope (plain text). |
| 429 | Too many requests for this key (6,000 per minute; plain text). Retry-After says how many seconds until the window resets. |
Check and explain access
/v1/graph/checkAnswers whether a subject can view (or edit) an object, and through which chain of relations. Reads the graph directly, so it reflects changes immediately.
SDK: graph.checkAccess() in TypeScript, check_access() in Python.
Request body
| Field | Type | Description |
|---|---|---|
| subject*string | string | A node with a type prefix: user:, group:, folder: or container:.up to 256 characters |
| object*string | string | A node with a type prefix: user:, group:, folder: or container:.up to 256 characters |
| relation"viewer" | "editor" | "viewer" | "editor" | default "viewer" |
curl -X POST https://api.swarmv.dev/v1/graph/check \
-H "Authorization: Bearer $SWARMV_API_KEY" \
-H "Content-Type: application/json" \
-d '{"subject": "user:dave", "object": "container:apollo"}'{
"allowed": true,
"granted": "viewer",
"path": [
{
"node": "user:dave"
},
{
"node": "group:engineering",
"relation": "member"
},
{
"node": "folder:handbook",
"relation": "viewer"
},
{
"node": "container:apollo",
"relation": "parent"
}
]
}Errors
| 400 | Invalid subject, object or relation. |
| 401 | Missing, invalid, expired, rotated or revoked key or token (plain text body). |
| 402 | No active plan (code plan_required), or the Basic plan's monthly reads or writes are used up (code plan_limit).plan_requiredplan_limit |
| 403 | Missing graph:read (or graph:admin) scope (plain text). |
| 429 | Too many requests for this key (6,000 per minute; plain text). Retry-After says how many seconds until the window resets. |
Change many relationships at once
/v1/graph/edges/batchAdds and removes up to 500 relationships in one all-or-nothing step. Pro and Enterprise.
SDK: graph.batch() in TypeScript, batch_relations() in Python.
Headers
| Field | Type | Description |
|---|---|---|
| Idempotency-Keystring | string | Retrying with the same key within 24 hours returns the first result instead of applying the change again.up to 128 characters |
Request body
| Field | Type | Description |
|---|---|---|
| operations*array of Relationship & object | array of Relationship & object | up to 500 items |
| operations[].subject*string | string | A node with a type prefix: user:, group:, folder: or container:.up to 256 characters |
| operations[].relation*"member" | "viewer" | "editor" | "parent" | "member" | "viewer" | "editor" | "parent" | |
| operations[].object*string | string | A node with a type prefix: user:, group:, folder: or container:.up to 256 characters |
| operations[].op*"add" | "remove" | "add" | "remove" | |
| dry_runboolean | boolean | default false |
curl -X POST https://api.swarmv.dev/v1/graph/edges/batch \
-H "Authorization: Bearer $SWARMV_API_KEY" \
-H "Content-Type: application/json" \
-d '{"operations": [{"op": "add", "subject": "user:ana", "relation": "member", "object": "group:engineering"}]}'{
"success": true,
"dry_run": false,
"added": 1,
"removed": 1,
"unchanged": 0
}Errors
| 400 | Invalid operations; index names the first bad one. |
| 401 | Missing, invalid, expired, rotated or revoked key or token (plain text body). |
| 402 | No active plan (code plan_required), or the Basic plan's monthly reads or writes are used up (code plan_limit).plan_requiredplan_limit |
| 403 | Missing graph:admin scope, the Basic plan (code plan_feature), or the relationship limit (code relationship_limit). Nothing was changed.plan_featurerelationship_limit |
| 429 | Too many requests for this key (6,000 per minute; plain text). Retry-After says how many seconds until the window resets. |
Make an object's members exactly a list
/v1/graph/syncSets who has one relation to one object, e.g. the full member list of a group from your directory: missing subjects are added, others removed. Safe to re-run. Pro and Enterprise.
SDK: graph.sync() in TypeScript, sync_relations() in Python.
Headers
| Field | Type | Description |
|---|---|---|
| Idempotency-Keystring | string | Retrying with the same key within 24 hours returns the first result instead of applying the change again.up to 128 characters |
Request body
| Field | Type | Description |
|---|---|---|
| object*string | string | A node with a type prefix: user:, group:, folder: or container:.up to 256 characters |
| relation*"member" | "viewer" | "editor" | "parent" | "member" | "viewer" | "editor" | "parent" | |
| subjects*array of string | array of string | The complete list: subjects not in it lose this relation.up to 10000 items |
| dry_runboolean | boolean | default false |
| allow_large_removalboolean | boolean | Required when a sync would remove more than 20% of 10 or more current subjects.default false |
curl -X POST https://api.swarmv.dev/v1/graph/sync \
-H "Authorization: Bearer $SWARMV_API_KEY" \
-H "Content-Type: application/json" \
-d '{"object": "group:engineering", "relation": "member", "subjects": ["user:ana", "user:dave"], "dry_run": true}'{
"success": true,
"dry_run": true,
"current": 2,
"would_add": 1,
"would_remove": 1
}Errors
| 400 | Invalid object, relation or subjects. |
| 401 | Missing, invalid, expired, rotated or revoked key or token (plain text body). |
| 402 | No active plan (code plan_required), or the Basic plan's monthly reads or writes are used up (code plan_limit).plan_requiredplan_limit |
| 403 | Missing graph:admin scope, the Basic plan (code plan_feature), or the relationship limit (code relationship_limit).plan_featurerelationship_limit |
| 409 | The sync would remove more than 20% of the current subjects; resend with allow_large_removal: true (code large_removal).large_removal |
| 429 | Too many requests for this key (6,000 per minute; plain text). Retry-After says how many seconds until the window resets. |
Service
Service health
/v1/healthPublic, no key needed. The same data, for people, is at https://swarmv.dev/status. Checks each storage dependency and reports the last synthetic check, which writes a record and reads it back every 5 minutes. 200 when everything is fine, 503 otherwise. Rate-limited per IP; results are cached for 10 seconds.
curl https://api.swarmv.dev/v1/health
{
"status": "ok",
"checks": {
"kv": {
"ok": true,
"ms": 4
},
"r2": {
"ok": true,
"ms": 21
},
"d1": {
"ok": true,
"ms": 9
},
"catalog": {
"ok": true,
"ms": 6
}
},
"synthetic": {
"ok": true,
"at": 1792104837716,
"write_ms": 41,
"search_ms": 33
},
"time": "2026-10-15T22:54:06.906Z"
}Errors
| 429 | Too many requests for this key (6,000 per minute; plain text). Retry-After says how many seconds until the window resets. |
| 503 | Something is failing; the body names it. |