← Back to Home

Agent API Reference

On this page

The Agent API allows external tools and AI agents to read, search, and write content in a Graphora space. All endpoints are authenticated with API tokens.

Base URL: https://api.graphora.app/agent


Authentication

All requests require a Bearer token in the Authorization header. Tokens are prefixed with gra_.

Authorization: Bearer gra_xxxxxxxxxxxxxxxxxxxxx

Each token is scoped to a single space and linked to exactly one scratchpad document. The scratchpad is a regular page in your space that the agent writes to — think of it as the agent’s notebook. Read endpoints (graph, doc, search) can read any document in the space, while write endpoints (PUT /agent/doc, PATCH /agent/doc/tasks/:uniqueId) always target the token’s scratchpad page.


Endpoints

GET /agent/graph

Returns the full knowledge graph for the space: all documents as nodes and their wiki-link connections as edges.

Response

{
  "nodes": [
    {
      "id": "uuid",
      "label": "Document Title",
      "isFavorite": false,
      "isJournal": false,
      "journalDate": null
    }
  ],
  "edges": [
    {
      "source": "uuid-of-source-doc",
      "target": "uuid-of-target-doc"
    }
  ]
}
FieldTypeDescription
nodes[].idstringDocument UUID
nodes[].labelstringDisplay name (or journal date, or "Untitled")
nodes[].isFavoritebooleanWhether the document is favorited
nodes[].isJournalbooleanWhether this is a journal entry
nodes[].journalDatestring | nullYYYY-MM-DD if journal, otherwise null
edges[].sourcestringSource document UUID
edges[].targetstringTarget document UUID

GET /agent/doc/:docId

Returns a single document with its content represented as an outline tree.

Path Parameters

ParameterTypeDescription
docIdstringDocument UUID

Response

{
  "id": "uuid",
  "displayName": "My Document",
  "isJournal": false,
  "journalDate": null,
  "createdAt": "2026-01-15T10:30:00.000Z",
  "updatedAt": "2026-04-01T14:22:00.000Z",
  "content": [
    {
      "text": "A bullet point with a [[Wiki Link]]",
      "children": [
        {
          "text": "A nested child item"
        }
      ]
    },
    {
      "text": "Buy groceries",
      "task": true,
      "checked": false,
      "scheduledFor": "2026-04-05",
      "dueDate": "2026-04-07"
    }
  ]
}
FieldTypeDescription
idstringDocument UUID
displayNamestring | nullDocument title
isJournalbooleanWhether this is a journal entry
journalDatestring | nullYYYY-MM-DD if journal
createdAtstringISO 8601 timestamp
updatedAtstringISO 8601 timestamp
contentOutlineItem[]Document content as an outline tree

OutlineItem

FieldTypeDescription
textstringPlain text content of the item. Wiki links appear as [[Label]]
childrenOutlineItem[](optional) Nested child items
taskboolean(optional) true if this is a task item
checkedboolean(optional) Whether the task is completed
scheduledForstring(optional) Scheduled date (YYYY-MM-DD)
dueDatestring(optional) Due date (YYYY-MM-DD)

Errors

StatusDescription
404Document not found in this space

GET /agent/search

Search documents by title or content.

Query Parameters

ParameterTypeDefaultDescription
qstring(required)Search query
limitnumber20Max results (1–100)

Response

[
  {
    "id": "uuid",
    "displayName": "Matching Document",
    "isJournal": false,
    "journalDate": null,
    "snippet": "First 200 characters of the document content..."
  }
]
FieldTypeDescription
idstringDocument UUID
displayNamestring | nullDocument title
isJournalbooleanWhether this is a journal entry
journalDatestring | nullYYYY-MM-DD if journal
snippetstringFirst 200 characters of plain text content

Returns an empty array if q is missing or empty.


PUT /agent/doc

Append content to the token’s linked scratchpad document. Wiki links in the text ([[Page Name]]) are automatically resolved to existing documents.

Request Body

{
  "content": [
    {
      "text": "A new bullet point"
    },
    {
      "text": "A task with a link to [[My Page]]",
      "task": true,
      "checked": false,
      "dueDate": "2026-04-10"
    },
    {
      "text": "Parent item",
      "children": [
        { "text": "Child item 1" },
        { "text": "Child item 2" }
      ]
    }
  ]
}
FieldTypeMax LengthDescription
contentOutlineItem[]Items to append
content[].textstring10,000Item text. Use [[Name]] for wiki links
content[].childrenOutlineItem[](optional) Nested children
content[].taskboolean(optional) Mark as task item
content[].checkedboolean(optional) Task completion state
content[].scheduledForstring(optional) YYYY-MM-DD
content[].dueDatestring(optional) YYYY-MM-DD

Response

{
  "id": "uuid-of-scratchpad-doc",
  "status": "appended"
}

Errors

StatusDescription
400Token has no linked scratchpad document

PATCH /agent/doc/tasks/:uniqueId

Update the checked state of a task item in the scratchpad document.

Path Parameters

ParameterTypeDescription
uniqueIdstringThe task item’s unique ID

Request Body

{
  "checked": true
}
FieldTypeDescription
checkedbooleanNew checked state

Response

{
  "id": "uuid-of-scratchpad-doc",
  "updated": true
}

Errors

StatusDescription
400Token has no linked scratchpad document

Common Errors

StatusDescription
401Missing, invalid, or expired API token

Examples

# Get the knowledge graph
curl -H "Authorization: Bearer gra_your_token_here" \
  https://api.graphora.app/agent/graph

# Read a document
curl -H "Authorization: Bearer gra_your_token_here" \
  https://api.graphora.app/agent/doc/DOCUMENT_UUID

# Search documents
curl -H "Authorization: Bearer gra_your_token_here" \
  "https://api.graphora.app/agent/search?q=meeting+notes&limit=10"

# Append content to scratchpad
curl -X PUT \
  -H "Authorization: Bearer gra_your_token_here" \
  -H "Content-Type: application/json" \
  -d '{"content": [{"text": "New insight from research", "task": true, "checked": false}]}' \
  https://api.graphora.app/agent/doc

# Check off a task
curl -X PATCH \
  -H "Authorization: Bearer gra_your_token_here" \
  -H "Content-Type: application/json" \
  -d '{"checked": true}' \
  https://api.graphora.app/agent/doc/tasks/TASK_UNIQUE_ID