curl --request GET \
--url https://api.watchdog.no/v1/documents/{id}/text \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.watchdog.no/v1/documents/{id}/text', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.watchdog.no/v1/documents/{id}/text"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"source_version": "<string>",
"strategy": "ocr",
"verification": {
"outcome": "verified",
"reason": "<string>",
"issue_count": 1,
"dropped_correction_count": 1
},
"content_type": "text/markdown",
"origin": "extracted",
"text": "<string>",
"offset": 1,
"next_offset": 1,
"total": 1,
"version": "<string>"
}{
"error": {
"code": "validation_error",
"message": "The request is invalid. details lists up to 20 field errors. Request bodies are limited to 2 MiB.",
"request_id": "req_example"
}
}{
"error": {
"code": "invalid_token",
"message": "The bearer token is missing or invalid.",
"request_id": "req_example"
}
}{
"error": {
"code": "forbidden",
"message": "Access denied. The error code says why: forbidden, token_disabled, organization_required, insufficient_role or mfa_required.",
"request_id": "req_example"
}
}{
"error": {
"code": "not_found",
"message": "The resource does not exist in the current organization.",
"request_id": "req_example"
}
}{
"error": {
"code": "conflict",
"message": "conflict: the text differs from expected_version, so read again from offset zero. source_unavailable: the text has no readable source; download the document instead. content_not_ready: no text exists yet; start an extraction.",
"request_id": "req_example"
}
}{
"error": {
"code": "document_text_too_large",
"message": "The text exceeds 4 MiB. Download it with format=text.",
"request_id": "req_example"
}
}{
"error": {
"code": "unsupported_media_type",
"message": "The text is not valid UTF-8. Download the document.",
"request_id": "req_example"
}
}{
"error": {
"code": "rate_limit_exceeded",
"message": "Too many requests. Wait for the Retry-After delay before retrying.",
"request_id": "req_example"
}
}{
"error": {
"code": "internal_error",
"message": "Unexpected server failure. Include the request ID when contacting support.",
"request_id": "req_example"
}
}{
"error": {
"code": "service_unavailable",
"message": "Temporarily unavailable. Retry after the Retry-After delay, when provided.",
"request_id": "req_example"
}
}Read the text of a document or agreement contract
Returns the text of a document, such as an agreement’s contract and terms, a price list or an invoice: its extracted Markdown, or the file itself for CSV, TSV and plain text. Use it to read whole clauses in context. One call returns up to 40,000 characters; continue with offset set to next_offset until it is null. Send version as expected_version to have the read fail if the text changed in between. To find what an agreement says about a subject, such as price adjustment or notice, use POST /v1/documents/search. Reading does not start extraction: when no text exists yet it returns 409 content_not_ready, so call POST /v1/documents//extract first. For the whole text as a file, use GET /v1/documents//download with format=text.
curl --request GET \
--url https://api.watchdog.no/v1/documents/{id}/text \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.watchdog.no/v1/documents/{id}/text', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.watchdog.no/v1/documents/{id}/text"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"source_version": "<string>",
"strategy": "ocr",
"verification": {
"outcome": "verified",
"reason": "<string>",
"issue_count": 1,
"dropped_correction_count": 1
},
"content_type": "text/markdown",
"origin": "extracted",
"text": "<string>",
"offset": 1,
"next_offset": 1,
"total": 1,
"version": "<string>"
}{
"error": {
"code": "validation_error",
"message": "The request is invalid. details lists up to 20 field errors. Request bodies are limited to 2 MiB.",
"request_id": "req_example"
}
}{
"error": {
"code": "invalid_token",
"message": "The bearer token is missing or invalid.",
"request_id": "req_example"
}
}{
"error": {
"code": "forbidden",
"message": "Access denied. The error code says why: forbidden, token_disabled, organization_required, insufficient_role or mfa_required.",
"request_id": "req_example"
}
}{
"error": {
"code": "not_found",
"message": "The resource does not exist in the current organization.",
"request_id": "req_example"
}
}{
"error": {
"code": "conflict",
"message": "conflict: the text differs from expected_version, so read again from offset zero. source_unavailable: the text has no readable source; download the document instead. content_not_ready: no text exists yet; start an extraction.",
"request_id": "req_example"
}
}{
"error": {
"code": "document_text_too_large",
"message": "The text exceeds 4 MiB. Download it with format=text.",
"request_id": "req_example"
}
}{
"error": {
"code": "unsupported_media_type",
"message": "The text is not valid UTF-8. Download the document.",
"request_id": "req_example"
}
}{
"error": {
"code": "rate_limit_exceeded",
"message": "Too many requests. Wait for the Retry-After delay before retrying.",
"request_id": "req_example"
}
}{
"error": {
"code": "internal_error",
"message": "Unexpected server failure. Include the request ID when contacting support.",
"request_id": "req_example"
}
}{
"error": {
"code": "service_unavailable",
"message": "Temporarily unavailable. Retry after the Retry-After delay, when provided.",
"request_id": "req_example"
}
}Authorizations
Personal API key sent as a bearer token, together with X-Organization-Id. The key must have at least the access level the endpoint requires (read, write or admin).
Headers
The organization to act in. Required for personal API keys; list the organizations you can access with GET /v1/organizations.
Path Parameters
Query Parameters
ocr, deterministic Where to start, in characters. Continue with next_offset from the preceding slice.
0 <= x <= 9007199254740991Maximum characters to return.
100 <= x <= 40000Version from the preceding slice. When sent, the read fails if the text has changed.
^[a-f0-9]{64}$Response
A slice of the text, where the next one starts and which extraction produced it.
- Option 1
- Option 2
1024ocr, deterministic Show child attributes
Show child attributes
text/markdown extracted 40000x >= 0x >= 0Length of the whole text, in characters.
x >= 0^[a-f0-9]{64}$