Workspaces

Read a file

Other errors (500, 502, 503, 504) are on Errors.

POST
/v1/workspaces/{id}/tools/read-file

Other errors (500, 502, 503, 504) are on Errors.

Authorization

bearerAuth
AuthorizationBearer <token>

Your API key, sent as Authorization: Bearer nace_sk_...

  • Where: the dashboard's API Keys page. It is shown once, when you create it.
  • Format: nace_sk_ followed by 43 URL-safe characters (A-Z, a-z, 0-9, _ and -).
  • Limit: an account can hold at most 3 active keys.
  • Wrong or missing key: returns 401 authentication_error.

In: header

Path Parameters

idstringrequired

The workspace's workspace_id.

Header Parameters

Idempotency-Keystring

Up to 200 characters, unique per account. A call that timed out keeps running: send it again with the same key and body to get its answer instead of running it twice.

Lengthlength <= 200

Request Body

application/json

pathstringrequired

The file's path in the workspace, as it was uploaded.

Length1 <= length
pagesarray | null

Pages to read, 1-based; leave it out for every page. Spreadsheets have no pages: name a tab with component.

Show variants
componentstring | null

One tab or section to read; leave it out for the whole file.

Show variants
max_charsinteger

The most characters to return; past it, truncated is true.

Range1 <= value <= 1000000
Default200000
line_startinteger | null

The first line to return, 1-based, counted in the text this read returns without a line span. Leave it out for line 1.

Range1 <= value
Show variants
line_endinteger | null

The last line to return, inclusive. Leave it out for the last line.

Range1 <= value
Show variants

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/workspaces/string/tools/read-file" \  -H "Content-Type: application/json" \  -d '{    "path": "reports/2024/annual-report.pdf",    "pages": [      41,      42    ]  }'
{  "path": "string",  "file_id": "string",  "content": "string",  "pages_returned": [    0  ],  "truncated": true,  "components_returned": [    "string"  ],  "components_omitted": [    "string"  ],  "sql_tables": [    "string"  ],  "line_start": 0,  "line_end": 0,  "line_count": 0,  "table": {    "first_line": 0,    "last_line": 0,    "title": "string",    "header": "string",    "rows": 0  },  "job_id": "string"}