curl --request GET \
--url https://api.watchdog.no/v1/documents/{id}/download \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.watchdog.no/v1/documents/{id}/download', 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}/download"
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
},
"download_url": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"content_type": "text/markdown",
"origin": "extracted",
"file_name": "<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": "content_not_ready",
"message": "With format=text. content_not_ready: no text exists yet; start an extraction. source_unavailable: the uploaded file is missing or has changed.",
"request_id": "req_example"
}
}{
"error": {
"code": "unsupported_media_type",
"message": "With format=text: this document type cannot be extracted. Extraction supports PDF, DOCX, XLSX, EML, MSG, PNG and JPEG, judged by the declared MIME type.",
"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"
}
}Get a link to download a document
Returns a five-minute link to the uploaded file, or with format=text to its extracted text as a Markdown file. Fetch download_url before expires_at; the link needs no authentication. format=text does not start extraction: when no text exists yet it returns 409 content_not_ready, so call POST /v1/documents//extract first. To read the text in the response without a download, use GET /v1/documents//text.
curl --request GET \
--url https://api.watchdog.no/v1/documents/{id}/download \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.watchdog.no/v1/documents/{id}/download', 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}/download"
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
},
"download_url": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"content_type": "text/markdown",
"origin": "extracted",
"file_name": "<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": "content_not_ready",
"message": "With format=text. content_not_ready: no text exists yet; start an extraction. source_unavailable: the uploaded file is missing or has changed.",
"request_id": "req_example"
}
}{
"error": {
"code": "unsupported_media_type",
"message": "With format=text: this document type cannot be extracted. Extraction supports PDF, DOCX, XLSX, EML, MSG, PNG and JPEG, judged by the declared MIME type.",
"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
original is the uploaded file. text is its extracted text as Markdown; a CSV, TSV or plain-text file is its own text.
original, text With format=text: the text from this extraction strategy. Omit for the best available text.
ocr, deterministic Response
The link, its expiry and a file name. origin is extracted when the link gives extracted text, which also names the strategy that produced it.
- Option 1
- Option 2
ocr, deterministic Show child attributes
Show child attributes
text/markdown extracted