Retrieve document content

Returns extracted textual information for the given document.

The documents pipeline extracts up to 1MiB of textual information from each processed document. The search and list endpoints truncate the textual content of each document, in order to reduce the size of the returned payload. If you want the whole text for a document, you can use this endpoint.

The accept request header MUST be set to text/plain. Other values will give an HTTP 406 error.

Securityoidc-token or oauth2-client-credentials or oauth2-open-industrial-data or oauth2-auth-code
Request
path Parameters
id
required
integer <int64> (CogniteInternalId) [ 1 .. 9007199254740991 ]

A server-generated ID for the object.

Responses
200

OK

400

The response for a failed request.

get/documents/{id}/content
Request samples
content = client.documents.retrieve_content(id=123)
from pathlib import Path
with Path("my_file.txt").open("wb") as buffer:
    c.documents.retrieve_content_buffer(id=123, buffer=buffer)
Response samples
application/json
{
  • "error": {
    • "code": 401,
    • "message": "Could not authenticate.",
    • "missing": [
      ],
    • "duplicated": [
      ]
    }
}