Search

Search across the canvases a person can open, through the host's own index, and extract a canvas's search text.

Search across canvases through the host (ADR-065); OpenCanvas keeps no index

Extract search.json

POST/api/v1/extract

The search.json of a .ocanvas (or Markdown) body: the same plain-text projection every save carries, for hosts that cannot open the zip or want to re-index old files. Stateless: nothing is stored. Up to 100 MB and 2 s; comments only with [host.search] comments = true. Changes nothing, so it takes no Idempotency-Key.

Credentials
Host key, or a user token with canvas:read.
Least role
view on the file (effective permission min(scope, role)).
Operation id
extract

Request body

Required, application/vnd.opencanvas+zip.

The file itself, as the raw body.

Example

<.ocanvas bytes>

Responses

200OK: search.json

Headers

HeaderDescription
RateLimit-PolicyToken buckets that apply: "subject";q=<burst>;w=<seconds to refill>, and "file-writes" on writes
RateLimitThe bucket closest to empty: "<name>";r=<remaining>;t=<seconds until full>

Body application/json

FieldTypeDescription
vrequiredinteger-
titlerequiredstring-
langstring-
blocksrequiredarray of object-
idstring-
typerequiredstring-
pathrequiredarray of string-
textrequiredstring-
doneboolean-
databasesrequiredarray of object-
idrequiredstring-
titlerequiredstring-
rowsrequiredarray of object-
idrequiredstring-
textrequiredstring-
boardsrequiredarray of object-
idrequiredstring-
textrequiredarray of string-
liverequiredarray of object-
commentsarray of object-
idstring-
textstring-
truncatedrequiredboolean-

Other members may appear; ignore the ones you do not know.

Example

{
  "v": 1,
  "title": "Sprint 42 planning",
  "blocks": [
    {
      "id": "b_9f2",
      "type": "heading",
      "path": [],
      "text": "Release 4.2"
    },
    {
      "id": "b_a10",
      "type": "todo",
      "path": [
        "Release 4.2"
      ],
      "text": "SSO set-up docs updated",
      "done": false
    }
  ],
  "databases": [
    {
      "id": "db_1",
      "title": "Sprint 42 backlog",
      "rows": [
        {
          "id": "r_1",
          "text": "Fix CSV export timeout · Marco Bianchi · In review"
        }
      ]
    }
  ],
  "boards": [
    {
      "id": "bd_1",
      "text": [
        "Hero copy is too long on phones"
      ]
    }
  ],
  "live": [],
  "truncated": false
}
401Unauthorized: UNAUTHENTICATED, TOKEN_INVALID, TOKEN_EXPIRED

Body application/problem+json

FieldTypeDescription
typerequiredstringFormat uri-reference.
titlerequiredstring-
statusrequiredinteger-
detailstring-
coderequiredstringMachine code (BLOCK_NOT_FOUND, STALE_BLOCK, ROLE_FORBIDDEN, …)
freshanySTALE_BLOCK: the current state to retry against

Other members may appear; ignore the ones you do not know.

Example

{
  "type": "urn:opencanvas:problem:unauthenticated",
  "title": "Unauthorized",
  "status": 401,
  "detail": "missing or wrong credentials",
  "code": "UNAUTHENTICATED"
}

Codes: UNAUTHENTICATED, TOKEN_INVALID, TOKEN_EXPIRED.

403Forbidden: ROLE_FORBIDDEN, SCOPE_REQUIRED, FILES_REQUIRED

Body application/problem+json

FieldTypeDescription
typerequiredstringFormat uri-reference.
titlerequiredstring-
statusrequiredinteger-
detailstring-
coderequiredstringMachine code (BLOCK_NOT_FOUND, STALE_BLOCK, ROLE_FORBIDDEN, …)
freshanySTALE_BLOCK: the current state to retry against

Other members may appear; ignore the ones you do not know.

Example

{
  "type": "urn:opencanvas:problem:scope-required",
  "title": "Forbidden",
  "status": 403,
  "detail": "SCOPE_REQUIRED: comment_add needs canvas:comment",
  "code": "SCOPE_REQUIRED"
}

Codes: SCOPE_REQUIRED.

404Not Found: API_OFF, BLOCK_NOT_FOUND, NOT_FOUND, …

Body application/problem+json

FieldTypeDescription
typerequiredstringFormat uri-reference.
titlerequiredstring-
statusrequiredinteger-
detailstring-
coderequiredstringMachine code (BLOCK_NOT_FOUND, STALE_BLOCK, ROLE_FORBIDDEN, …)
freshanySTALE_BLOCK: the current state to retry against

Other members may appear; ignore the ones you do not know.

Example

{
  "type": "urn:opencanvas:problem:api-off",
  "title": "Not Found",
  "status": 404,
  "detail": "the API is not enabled for this host ([host.flags] api_v1)",
  "code": "API_OFF"
}

Codes: API_OFF.

413Payload Too Large: DOC_TOO_LARGE, IMPORT_TOO_LARGE

Body application/problem+json

FieldTypeDescription
typerequiredstringFormat uri-reference.
titlerequiredstring-
statusrequiredinteger-
detailstring-
coderequiredstringMachine code (BLOCK_NOT_FOUND, STALE_BLOCK, ROLE_FORBIDDEN, …)
freshanySTALE_BLOCK: the current state to retry against

Other members may appear; ignore the ones you do not know.

Example

{
  "type": "urn:opencanvas:problem:body-too-large",
  "title": "Payload Too Large",
  "status": 413,
  "detail": "the request body is too large",
  "code": "BODY_TOO_LARGE"
}

Codes: BODY_TOO_LARGE.

415Unsupported Media Type: UNSUPPORTED_MEDIA_TYPE: send application/vnd.opencanvas+zip or text/markdown

Body application/problem+json

FieldTypeDescription
typerequiredstringFormat uri-reference.
titlerequiredstring-
statusrequiredinteger-
detailstring-
coderequiredstringMachine code (BLOCK_NOT_FOUND, STALE_BLOCK, ROLE_FORBIDDEN, …)
freshanySTALE_BLOCK: the current state to retry against

Other members may appear; ignore the ones you do not know.

Example

{
  "type": "string",
  "title": "string",
  "status": 0,
  "code": "string"
}
422Unprocessable Entity: IDEMPOTENCY_KEY_REUSED: the Idempotency-Key was used with a different request

Body application/problem+json

FieldTypeDescription
typerequiredstringFormat uri-reference.
titlerequiredstring-
statusrequiredinteger-
detailstring-
coderequiredstringMachine code (BLOCK_NOT_FOUND, STALE_BLOCK, ROLE_FORBIDDEN, …)
freshanySTALE_BLOCK: the current state to retry against

Other members may appear; ignore the ones you do not know.

Example

{
  "type": "urn:opencanvas:problem:not-ocanvas",
  "title": "Unprocessable Entity",
  "status": 422,
  "detail": "the body is not a .ocanvas file",
  "code": "NOT_OCANVAS"
}

Codes: NOT_OCANVAS, EXTRACT_TOO_SLOW.

429Too Many Requests: RATE_LIMITED, with Retry-After, RateLimit-Policy and RateLimit

Body application/problem+json

FieldTypeDescription
typerequiredstringFormat uri-reference.
titlerequiredstring-
statusrequiredinteger-
detailstring-
coderequiredstringMachine code (BLOCK_NOT_FOUND, STALE_BLOCK, ROLE_FORBIDDEN, …)
freshanySTALE_BLOCK: the current state to retry against

Other members may appear; ignore the ones you do not know.

Example

{
  "type": "urn:opencanvas:problem:rate-limited",
  "title": "Too Many Requests",
  "status": 429,
  "detail": "too many requests (subject limit); retry later",
  "code": "RATE_LIMITED"
}

Codes: RATE_LIMITED.

Errors

StatusCodeWhen
413BODY_TOO_LARGEThe request body is over the server's limit (at least 5 MiB, the import limit).
422NOT_OCANVASThe extract body is not a readable .ocanvas (or not UTF-8 Markdown).
422EXTRACT_TOO_SLOWExtraction has a 2 s budget per file.

Also, like every operation on a file: API_OFF, UNAUTHENTICATED, TOKEN_INVALID, TOKEN_EXPIRED, SCOPE_REQUIRED, RATE_LIMITED, INTERNAL.

GET/api/v1/search

Searches the canvases the token's user can open, through the host's own GET /search callback (the host indexes search.json; OpenCanvas keeps no index and caches nothing). Needs a user token: a host key gets 400 USER_TOKEN_REQUIRED. Hits on files the host's /access refuses are dropped. At most 10 searches a minute per user. The MCP tool canvas_search answers the same items.

Credentials
Host key, or a user token with canvas:read.
Least role
view on the file (effective permission min(scope, role)).
Operation id
search

Parameters

NameInTypeDescription
qrequiredquerystringThe words to look for (at most 200 bytes) At most 200 characters.
scopequerystringA scope id the host offered
cursorquerystringnext of the previous page
limitqueryintegerItems per page, 1-50 (default 20) 1 to 50.

Responses

200OK: Results

Headers

HeaderDescription
RateLimit-PolicyToken buckets that apply: "subject";q=<burst>;w=<seconds to refill>, and "file-writes" on writes
RateLimitThe bucket closest to empty: "<name>";r=<remaining>;t=<seconds until full>

Body application/json

FieldTypeDescription
itemsrequiredarray of objectAt most 50 items.
fileIdrequiredstring-
titlerequiredstring-
pathstring-
blockIdstring-
snippetrequiredstringPlain text; escape it before showing
updatedAtstring-
scopesrequiredarray of objectAt most 4 items.
idrequiredstring-
labelrequiredstring-
partialrequiredboolean-
nextrequiredstring | null-

Example

{
  "items": [
    {
      "fileId": "doc_8812",
      "title": "Sprint 42 planning",
      "path": "Engineering",
      "blockId": "b_3fQ1",
      "snippet": "Admins can sign in with SSO, and…",
      "updatedAt": "2026-11-26T09:41:00Z"
    }
  ],
  "scopes": [
    {
      "id": "all",
      "label": "All canvases"
    }
  ],
  "partial": false,
  "next": null
}
400Bad Request: BAD_INPUT, PATCH_INVALID, CURSOR_INVALID, IDEMPOTENCY_KEY_INVALID, …

Body application/problem+json

FieldTypeDescription
typerequiredstringFormat uri-reference.
titlerequiredstring-
statusrequiredinteger-
detailstring-
coderequiredstringMachine code (BLOCK_NOT_FOUND, STALE_BLOCK, ROLE_FORBIDDEN, …)
freshanySTALE_BLOCK: the current state to retry against

Other members may appear; ignore the ones you do not know.

Example

{
  "type": "urn:opencanvas:problem:bad-input",
  "title": "Bad Request",
  "status": 400,
  "detail": "rows[0].values must be an object",
  "code": "BAD_INPUT"
}

Codes: BAD_INPUT, USER_TOKEN_REQUIRED.

401Unauthorized: UNAUTHENTICATED, TOKEN_INVALID, TOKEN_EXPIRED

Body application/problem+json

FieldTypeDescription
typerequiredstringFormat uri-reference.
titlerequiredstring-
statusrequiredinteger-
detailstring-
coderequiredstringMachine code (BLOCK_NOT_FOUND, STALE_BLOCK, ROLE_FORBIDDEN, …)
freshanySTALE_BLOCK: the current state to retry against

Other members may appear; ignore the ones you do not know.

Example

{
  "type": "urn:opencanvas:problem:unauthenticated",
  "title": "Unauthorized",
  "status": 401,
  "detail": "missing or wrong credentials",
  "code": "UNAUTHENTICATED"
}

Codes: UNAUTHENTICATED, TOKEN_INVALID, TOKEN_EXPIRED.

403Forbidden: ROLE_FORBIDDEN, SCOPE_REQUIRED, FILES_REQUIRED

Body application/problem+json

FieldTypeDescription
typerequiredstringFormat uri-reference.
titlerequiredstring-
statusrequiredinteger-
detailstring-
coderequiredstringMachine code (BLOCK_NOT_FOUND, STALE_BLOCK, ROLE_FORBIDDEN, …)
freshanySTALE_BLOCK: the current state to retry against

Other members may appear; ignore the ones you do not know.

Example

{
  "type": "urn:opencanvas:problem:scope-required",
  "title": "Forbidden",
  "status": 403,
  "detail": "SCOPE_REQUIRED: comment_add needs canvas:comment",
  "code": "SCOPE_REQUIRED"
}

Codes: SCOPE_REQUIRED.

404Not Found: API_OFF, BLOCK_NOT_FOUND, NOT_FOUND, …

Body application/problem+json

FieldTypeDescription
typerequiredstringFormat uri-reference.
titlerequiredstring-
statusrequiredinteger-
detailstring-
coderequiredstringMachine code (BLOCK_NOT_FOUND, STALE_BLOCK, ROLE_FORBIDDEN, …)
freshanySTALE_BLOCK: the current state to retry against

Other members may appear; ignore the ones you do not know.

Example

{
  "type": "urn:opencanvas:problem:api-off",
  "title": "Not Found",
  "status": 404,
  "detail": "the API is not enabled for this host ([host.flags] api_v1)",
  "code": "API_OFF"
}

Codes: API_OFF, SEARCH_UNAVAILABLE.

429Too Many Requests: RATE_LIMITED, with Retry-After, RateLimit-Policy and RateLimit

Body application/problem+json

FieldTypeDescription
typerequiredstringFormat uri-reference.
titlerequiredstring-
statusrequiredinteger-
detailstring-
coderequiredstringMachine code (BLOCK_NOT_FOUND, STALE_BLOCK, ROLE_FORBIDDEN, …)
freshanySTALE_BLOCK: the current state to retry against

Other members may appear; ignore the ones you do not know.

Example

{
  "type": "urn:opencanvas:problem:rate-limited",
  "title": "Too Many Requests",
  "status": 429,
  "detail": "too many requests (subject limit); retry later",
  "code": "RATE_LIMITED"
}

Codes: RATE_LIMITED.

502Bad Gateway: HOST_UNAVAILABLE: your load or save callback failed

Body application/problem+json

FieldTypeDescription
typerequiredstringFormat uri-reference.
titlerequiredstring-
statusrequiredinteger-
detailstring-
coderequiredstringMachine code (BLOCK_NOT_FOUND, STALE_BLOCK, ROLE_FORBIDDEN, …)
freshanySTALE_BLOCK: the current state to retry against

Other members may appear; ignore the ones you do not know.

Example

{
  "type": "urn:opencanvas:problem:host-error",
  "title": "Bad Gateway",
  "status": 502,
  "detail": "the host answered 500 Internal Server Error",
  "code": "HOST_ERROR"
}

Codes: HOST_ERROR.

504HOST_TIMEOUT: the host did not answer in time

Body application/problem+json

FieldTypeDescription
typerequiredstringFormat uri-reference.
titlerequiredstring-
statusrequiredinteger-
detailstring-
coderequiredstringMachine code (BLOCK_NOT_FOUND, STALE_BLOCK, ROLE_FORBIDDEN, …)
freshanySTALE_BLOCK: the current state to retry against

Other members may appear; ignore the ones you do not know.

Example

{
  "type": "urn:opencanvas:problem:host-timeout",
  "title": "Error",
  "status": 504,
  "detail": "the host did not answer the search in time",
  "code": "HOST_TIMEOUT"
}

Codes: HOST_TIMEOUT.

Errors

StatusCodeWhen
400BAD_INPUTThe request is not what the operation takes: the body is not a JSON object, a field is missing or has the wrong type, an op, mode, format or event type is unknown, or fileId is longer than 1,024 bytes. detail says which.
400USER_TOKEN_REQUIREDSearch runs as a person, so the host's permissions apply; a host key has no person.
404SEARCH_UNAVAILABLEThe host has not turned on [host.search] callback, or its GET /search answered 404, 405 or 501.
504HOST_TIMEOUTThe host's search callback took longer than [host.search] timeout_ms (default 8 s).
502HOST_ERRORThe host's search callback failed or answered something that is not a search answer.

Also, like every operation on a file: API_OFF, UNAUTHENTICATED, TOKEN_INVALID, TOKEN_EXPIRED, SCOPE_REQUIRED, RATE_LIMITED.

Last changed .