Documents API
Manage your saved documents programmatically
The Documents API allows you to create, retrieve, update, and list your saved documents.
Authentication
All endpoints require an API key in the Authorization
header:
Authorization: your-api-key-here
Get your API key from Account Settings in the editor.
Endpoints
Get Document
Retrieve a specific document by ID.
GET /api/document?id={documentId}
Parameters:
Field | Type | Required | Description |
---|---|---|---|
id | string | Yes | Document ID (query parameter) |
Response:
{
"id": "abc123",
"name": "My Diagram",
"content": "{ \"user\": \"John\" }",
"format": "json",
"owner_id": "user-uuid",
"visibility": "private",
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T14:20:00Z"
}
Create Document
Create a new document.
POST /api/document
Content-Type: application/json
{
"name": "My New Diagram",
"content": "{ \"user\": \"John\" }",
"format": "json",
"private": true
}
Parameters:
Field | Type | Required | Description |
---|---|---|---|
name | string | Yes | Document name |
content | string | Yes | Document content |
format | string | No | Format: json , yaml , xml , csv , custom , mermaid (default: json ) |
private | boolean | No | Deprecated. Use visibility instead |
visibility | string | No | private , public , or team (default: private ) |
Response:
{
"id": "abc123"
}
Update Document
Update an existing document.
PUT /api/document
Content-Type: application/json
{
"id": "abc123",
"name": "Updated Name",
"content": "{ \"user\": \"Jane\" }",
"format": "json"
}
Parameters:
Field | Type | Required | Description |
---|---|---|---|
id | string | Yes | Document ID |
name | string | No | New document name |
content | string | No | New document content |
format | string | No | New format: json , yaml , xml , csv , custom , mermaid |
visibility | string | No | private , public , or team |
Response:
{
"id": "abc123"
}