DevelopersHow to connect an assistantKeys
Reference/Files/Read

Read a document's text

GEThttps://api.getwerk.ai/api/v1/projects/{projectId}/cards/{cardId}/documents/{documentId}/pages

The text Werk read in a document, part by part.

Only a ready document has parts; any other answers its state with none. A cursor of an older revision answers cursor_expired.

Authorization

AuthorizationheaderRequired

Authorization: Bearer <key> Authentication

Path parameters

projectIdstring, uuidRequired

The project's id.

cardIdstring, uuidRequired

The card's id.

documentIdstring, uuidRequired

The document's id.

Query parameters

pageFrominteger

The first part to read, counted from 1.

At least 1
pageBeforeinteger

The first part left out.

At least 1
limitinteger

How many parts a page holds.

From 1 to 100
Default50
afterstring

The cursor from the previous page's nextCursor; left out, the first page.

From 1 to 512 characters

Response

200 The parts.

stateenum

The document's reading state.

Allowed valuesnot_readawaiting_confirmationreadingfailedready
revisioninteger

The revision these parts were read in.

At least 1
pagesarray of objects

The parts Werk read, in order.

Up to 100 items
Show properties of pagesHide properties of pages
pageinteger

The part, counted from 1 in Werk's own count.

At least 1
locationobject

Where in the file the part is.

Show properties of locationHide properties of location

One of 5 shapes, told apart by kind:

kindpdf_page
kindenum

Where in the file the part is: a PDF page, a section, a paragraph, a sheet's rows or a text's lines.

Allowed valuespdf_page
pageinteger

The PDF page.

At least 1
kindsection
kindenum

Where in the file the part is: a PDF page, a section, a paragraph, a sheet's rows or a text's lines.

Allowed valuessection
sectioninteger

The section, counted from 1.

At least 1
kindparagraph
kindenum

Where in the file the part is: a PDF page, a section, a paragraph, a sheet's rows or a text's lines.

Allowed valuesparagraph
paragraphinteger

The paragraph, counted from 1.

At least 1
kindsheet_rows
kindenum

Where in the file the part is: a PDF page, a section, a paragraph, a sheet's rows or a text's lines.

Allowed valuessheet_rows
sheetstring

The sheet's name.

At least 1 character
firstRowinteger

The part's first row.

At least 1
lastRowinteger

The part's last row.

At least 1
kindlines
kindenum

Where in the file the part is: a PDF page, a section, a paragraph, a sheet's rows or a text's lines.

Allowed valueslines
firstLineinteger

The part's first line.

At least 1
lastLineinteger

The part's last line.

At least 1
textstring

The text Werk read in the part.

nextCursorstring or null

The cursor that reads the next page as after, or null when none remains.

From 1 to 512 characters

Errors

400invalid_queryThe query is not in the form the route takes; the limit is in the unit of the input details.field names (characters for a text, entries for a list, the value for a number).
401session_revokedThe request carries no session the server holds, or its session has ended.
401session_expiredThe session has expired.
404conversation_not_foundThe project the request names, or its chat, is not one the signed-in person is in.
404item_not_foundThe card the request names, or its list, is not one the signed-in person can see.
404asset_not_foundThe file the request names is not one the signed-in person can reach where the request names it, or is no longer available.
409session_changedThe session changed while the request was in flight.
409cursor_expiredThe page cursor no longer fits the list as it stands or the arguments it was read with.
rate_limitedMore requests of this kind were sent than Werk takes within the time it counts them over.
500server_errorThe server could not complete the request, and it is not known whether a write it holds was made.
curl
curl "https://api.getwerk.ai/api/v1/projects/2f6c9e41-7a3b-4d58-9c1e-0b8d4f2a6e73/cards/3c9e5b17-8d2f-4a64-b1e3-7f5a0c9d2b48/documents/d7e1b5c3-9a4f-4e26-b8d0-2f6a4c8e1d59/pages?limit=10" \
  -H "Authorization: Bearer wk_key_..."
TypeScript
const res = await fetch("https://api.getwerk.ai/api/v1/projects/2f6c9e41-7a3b-4d58-9c1e-0b8d4f2a6e73/cards/3c9e5b17-8d2f-4a64-b1e3-7f5a0c9d2b48/documents/d7e1b5c3-9a4f-4e26-b8d0-2f6a4c8e1d59/pages?limit=10", {
  headers: {
    Authorization: "Bearer wk_key_...",
  },
});
const answer = await res.json();
200JSON
{
  "state": "ready",
  "revision": 1,
  "pages": [
    {
      "page": 1,
      "location": {
        "kind": "pdf_page",
        "page": 1
      },
      "text": "Stonecraft Supply. Quote Q-20931, November 17, 2026. Quartz countertop, 3 cm, polished edge."
    }
  ],
  "nextCursor": null
}