Help & Guides

REST API

Access your documents programmatically from any service

Access your Syncpen documents programmatically using the REST API. Use it with Zapier, Make.com, n8n, custom scripts, or any HTTP client.

Authentication

All API requests require authentication using an API key. Include your key in the Authorization header as a Bearer token:

Authorization: Bearer sp_your_api_key_here

Generate API keys in Settings → API Keys.

Base URL

https://www.syncpen.io/api/mcp

Endpoints

List Documents

Get a list of your documents.

GET /api/mcp/documents

# Optional query parameters:
#   folderId - Filter by folder ID
#   limit    - Max results (1-100, default 50)

Example:

curl -H "Authorization: Bearer sp_your_key" \
  "https://www.syncpen.io/api/mcp/documents?limit=10"

Response:

{
  "documents": [
    {
      "id": "doc_abc123",
      "title": "My Document",
      "isOwner": true,
      "folderId": "folder_xyz",
      "createdAt": "2024-01-15T10:30:00.000Z",
      "updatedAt": "2024-01-20T14:45:00.000Z"
    }
  ]
}

Create Document

Create a new document with optional content.

POST /api/mcp/documents

# JSON body:
#   title    - Document title (optional, default "Untitled")
#   content  - Markdown content (optional)
#   folderId - Folder ID to add document to (optional)

Example:

curl -X POST -H "Authorization: Bearer sp_your_key" \
  -H "Content-Type: application/json" \
  -d '{"title": "New Document", "content": "# Hello\n\nWorld"}' \
  "https://www.syncpen.io/api/mcp/documents"

Response:

{
  "document": {
    "id": "doc_new123",
    "title": "New Document",
    "folderId": null,
    "createdAt": "2024-01-20T15:00:00.000Z",
    "updatedAt": "2024-01-20T15:00:00.000Z"
  }
}

Read Document

Get a document's content as markdown.

GET /api/mcp/documents/:id

Example:

curl -H "Authorization: Bearer sp_your_key" \
  "https://www.syncpen.io/api/mcp/documents/doc_abc123"

Response:

{
  "document": {
    "id": "doc_abc123",
    "title": "My Document",
    "content": "# Heading\n\nDocument content in markdown...",
    "isOwner": true,
    "createdAt": "2024-01-15T10:30:00.000Z",
    "updatedAt": "2024-01-20T14:45:00.000Z"
  }
}

Update Document

Update a document's title and/or content, and/or move it to a folder. Content updates are applied to the document's live collaborative state, so changes appear instantly for anyone with it open.

PUT /api/mcp/documents/:id

# JSON body (provide at least one):
#   title    - New title (optional)
#   content  - New markdown content (optional)
#   folderId - Folder id to move into, or null to move to root (optional)

Example:

curl -X PUT -H "Authorization: Bearer sp_your_key" \
  -H "Content-Type: application/json" \
  -d '{"title": "Updated Title", "content": "# Updated\n\nNew content"}' \
  "https://www.syncpen.io/api/mcp/documents/doc_abc123"

Response:

{
  "document": {
    "id": "doc_abc123",
    "title": "Updated Title",
    "isOwner": true,
    "updatedAt": "2024-01-20T16:00:00.000Z"
  }
}

Move Document

Move a document into a folder, or to the root with null.

curl -X PUT -H "Authorization: Bearer sp_your_key" \
  -H "Content-Type: application/json" \
  -d '{"folderId": "folder_xyz"}' \
  "https://www.syncpen.io/api/mcp/documents/doc_abc123"

Delete Document

Soft-delete a document (moves it to trash). Owner only.

curl -X DELETE -H "Authorization: Bearer sp_your_key" \
  "https://www.syncpen.io/api/mcp/documents/doc_abc123"

List Folders

Get a list of your folders.

GET /api/mcp/folders

Example:

curl -H "Authorization: Bearer sp_your_key" \
  "https://www.syncpen.io/api/mcp/folders"

Response:

{
  "folders": [
    {
      "id": "folder_xyz",
      "name": "Projects",
      "order": 0,
      "documentCount": 5,
      "createdAt": "2024-01-10T08:00:00.000Z"
    }
  ]
}

Create Folder

Create a folder, optionally nested under a parent (up to 5 levels deep).

POST /api/mcp/folders

# JSON body:
#   name     - Folder name (required)
#   parentId - Parent folder id for nesting (optional; omit/null = root)
curl -X POST -H "Authorization: Bearer sp_your_key" \
  -H "Content-Type: application/json" \
  -d '{"name": "Q1 Drafts", "parentId": "folder_xyz"}' \
  "https://www.syncpen.io/api/mcp/folders"

Rename or Move Folder

Rename a folder and/or re-parent it. Pass parentId: null to move it to the root. Circular moves and depth-limit violations are rejected.

PUT /api/mcp/folders/:id

# JSON body (provide at least one):
#   name     - New folder name (optional)
#   parentId - New parent id, or null for root (optional)
curl -X PUT -H "Authorization: Bearer sp_your_key" \
  -H "Content-Type: application/json" \
  -d '{"name": "Archive", "parentId": null}' \
  "https://www.syncpen.io/api/mcp/folders/folder_xyz"

Delete Folder

Soft-delete a folder, its subfolders, and the documents you own within them (moved to trash).

curl -X DELETE -H "Authorization: Bearer sp_your_key" \
  "https://www.syncpen.io/api/mcp/folders/folder_xyz"

Search Documents

Search documents by title.

GET /api/mcp/search

# Query parameters:
#   query    - Search term (required)
#   folderId - Filter by folder ID (optional)
#   limit    - Max results (1-100, default 50)

Example:

curl -H "Authorization: Bearer sp_your_key" \
  "https://www.syncpen.io/api/mcp/search?query=meeting%20notes"

Response:

{
  "query": "meeting notes",
  "results": [
    {
      "id": "doc_def456",
      "title": "Team Meeting Notes - January",
      "isOwner": true,
      "folderId": null,
      "createdAt": "2024-01-18T09:00:00.000Z",
      "updatedAt": "2024-01-18T10:30:00.000Z"
    }
  ]
}

Error Responses

All errors return a JSON object with error and message fields:

{
  "error": "Unauthorized",
  "message": "Invalid or missing API key"
}
StatusMeaning
401Invalid or missing API key
403Access denied to the resource
404Resource not found
500Internal server error

Rate Limits

The API is rate limited to prevent abuse. If you exceed the limit, you'll receive a 429 Too Many Requests response. Wait a moment and retry.

Use Cases

  • Zapier/Make.com: Automate workflows with your documents
  • Static site generators: Pull content for your blog or docs site
  • Backup scripts: Export all documents periodically
  • Custom integrations: Build your own tools with Syncpen data

Need help? If you have questions about the API or need additional endpoints, reach out to us!