SynapSynapDocs
Hub REST API

Documents

The Documents operations of the Hub REST API (6 operations).

For BuildersOpen-source podSynap CloudGenerated from Synap-core/backend@c31e261ab (main)

Create a document

POST
/documents

Authorization

bearerAuth
headerAuthorizationBearer <API key>

Pod API key (Bearer) issued via /api/hub/setup/agent or pod admin tooling. Browser/web clients may use the X-Session-Token header instead. See GET /api/hub/auth/status to introspect the calling key.

Request Body

application/json
  1. body
userId*string
workspaceId?string|null
title*string
content?string
type?DocumentType
Value in"text""markdown""code""html""pdf""docx"
reasoning?string
agentUserId?string
sourceMessageId?string
sessionId?string
expectedLabel?string
url?string
entityId?string
idempotencyKey?string

Response Body

Created document

application/json
  1. response
id*string
userId*string
workspaceId?string|null
title*string
content?string
type?DocumentType
Value in"text""markdown""code""html""pdf""docx"
createdAt?string|
updatedAt?string|
[key: string]?unknown
Example Request
curl -X POST 'https://pod.example.com/api/hub/documents' \  -H 'Content-Type: application/json' \  -d '{  "userId": "string",  "title": "string"}'
Example Response
{  "id": "string",  "userId": "string",  "workspaceId": "string",  "title": "string",  "content": "string",  "type": "text",  "createdAt": "string",  "updatedAt": "string",  "property1": null,  "property2": null}

Fetch a document

GET
/documents/{documentId}

Authorization

bearerAuth
headerAuthorizationBearer <API key>

Pod API key (Bearer) issued via /api/hub/setup/agent or pod admin tooling. Browser/web clients may use the X-Session-Token header instead. See GET /api/hub/auth/status to introspect the calling key.

Path Parameters

documentId*string

Query Parameters

userId*string
format?string
Value in"raw""readable"

Response Body

Document

application/json
  1. response
id*string
userId*string
workspaceId?string|null
title*string
content?string
type?DocumentType
Value in"text""markdown""code""html""pdf""docx"
createdAt?string|
updatedAt?string|
[key: string]?unknown
Example Request
curl -X GET 'https://pod.example.com/api/hub/documents/string?userId=string'
Example Response
{  "id": "string",  "userId": "string",  "workspaceId": "string",  "title": "string",  "content": "string",  "type": "text",  "createdAt": "string",  "updatedAt": "string",  "property1": null,  "property2": null}
PATCH
/documents/{documentId}

Authorization

bearerAuth
headerAuthorizationBearer <API key>

Pod API key (Bearer) issued via /api/hub/setup/agent or pod admin tooling. Browser/web clients may use the X-Session-Token header instead. See GET /api/hub/auth/status to introspect the calling key.

Path Parameters

documentId*string

Request Body

application/json
  1. body
userId*string
title?string
content?string
baseRevision?integer
Range0 <= value
allowRemovingEmbeds?boolean
agentUserId?string
sourceMessageId?string
sessionId?string

Response Body

Updated document

application/json
  1. response
id*string
userId*string
workspaceId?string|null
title*string
content?string
type?DocumentType
Value in"text""markdown""code""html""pdf""docx"
createdAt?string|
updatedAt?string|
[key: string]?unknown
Example Request
curl -X PATCH 'https://pod.example.com/api/hub/documents/string' \  -H 'Content-Type: application/json' \  -d '{  "userId": "string"}'
Example Response
{  "id": "string",  "userId": "string",  "workspaceId": "string",  "title": "string",  "content": "string",  "type": "text",  "createdAt": "string",  "updatedAt": "string",  "property1": null,  "property2": null}
POST
/documents/proposals

Authorization

bearerAuth
headerAuthorizationBearer <API key>

Pod API key (Bearer) issued via /api/hub/setup/agent or pod admin tooling. Browser/web clients may use the X-Session-Token header instead. See GET /api/hub/auth/status to introspect the calling key.

Request Body

application/json
  1. body
documentId*string
userId*string
agentUserId?string
sourceMessageId?string
sessionId?string
proposedContent*string
baseRevision?integer
Range0 <= value
allowRemovingEmbeds?boolean
reasoning?string

Response Body

Created proposal

application/json
  1. response
id*string
status?string
[key: string]?unknown
Example Request
curl -X POST 'https://pod.example.com/api/hub/documents/proposals' \  -H 'Content-Type: application/json' \  -d '{  "documentId": "string",  "userId": "string",  "proposedContent": "string"}'
Example Response
{  "id": "string",  "status": "string",  "property1": null,  "property2": null}
GET
/documents/{documentId}/raw

Authorization

bearerAuth
headerAuthorizationBearer <API key>

Pod API key (Bearer) issued via /api/hub/setup/agent or pod admin tooling. Browser/web clients may use the X-Session-Token header instead. See GET /api/hub/auth/status to introspect the calling key.

Path Parameters

documentId*string

Query Parameters

userId*string

Response Body

Raw document bytes

response?stringapplication/json
Example Request
curl -X GET 'https://pod.example.com/api/hub/documents/string/raw?userId=string'
Example Response
"string"

Edit a document with ops

POST
/documents/{documentId}/patch

Authorization

bearerAuth
headerAuthorizationBearer <API key>

Pod API key (Bearer) issued via /api/hub/setup/agent or pod admin tooling. Browser/web clients may use the X-Session-Token header instead. See GET /api/hub/auth/status to introspect the calling key.

Path Parameters

documentId*string

Request Body

application/json
  1. body
userId?string
agentUserId?string
sourceMessageId?string
sessionId?string
baseRevision?integer
Range0 <= value
ops*array<|||>
Items1 <= items <= 50
allowRemovingEmbeds?boolean
reasoning?string

Response Body

Applied (or proposed — 202)

application/json
  1. response
status*string
[key: string]?unknown
Example Request
curl -X POST 'https://pod.example.com/api/hub/documents/string/patch' \  -H 'Content-Type: application/json' \  -d '{  "ops": [    {      "op": "upsert_section",      "id": "string",      "title": "string",      "body": "string"    }  ]}'
Example Response
{  "status": "string",  "property1": null,  "property2": null}