Skip to main content

Get Document

GET /v1/documents/{document_id}
Retrieve a document and all its blocks. Requires the documents:read role.

Request

Headers

HeaderRequiredDescription
X-API-KeyYesYour API key

Path Parameters

ParameterTypeDescription
document_idstringThe document ID

Example

curl https://api.surfacedocs.dev/v1/documents/doc_abc123 \
  -H "X-API-Key: sd_live_..."

Response

Status: 200 OK
{
  "id": "doc_abc123",
  "url": "https://app.surfacedocs.dev/d/doc_abc123",
  "folder_id": "fld_xyz",
  "title": "API Guide",
  "content_type": "markdown",
  "metadata": null,
  "visibility": "private",
  "blocks": [
    {
      "id": "blk_001",
      "order": 0,
      "type": "heading",
      "content": "Overview",
      "metadata": {"level": 1}
    },
    {
      "id": "blk_002",
      "order": 1,
      "type": "paragraph",
      "content": "Welcome to the API.",
      "metadata": null
    }
  ],
  "created_at": "2025-01-15T10:30:00Z",
  "updated_at": "2025-01-15T10:30:00Z"
}

Errors

CodeDescription
404Document not found
403Access denied (not the document owner)