APIBeta
Documents

A document of the team

GET
/v1/documents/{id}

An id that belongs to an older revision of the document answers 303 and points to the latest revision. Most HTTP clients follow it on their own, so the document you get may have another id than the one you asked for: compare them when the revision matters to you. Following the redirect is a second call, and counts against the rate limit like any other.

Authorization

apiKey
headerAuthorizationBearer <token>

The key the team leader created in Redokun, sent as Authorization: Bearer rdk_.... A read key is rejected on every call that writes (any method other than GET, HEAD or OPTIONS).

Path Parameters

id*integer

Identifier of the document

Range1 <= value <= 2147483647

Response Body

The document

application/json
  1. response
id*integer

Identifier of the document

filename*string

Name of the file as it was uploaded

fileType*string

Format of the file

wordCount*|

Words in the source text. Null until the document has been indexed

revision*integer

Revision number, starting at 1. Uploading a new version of the file adds one

status*string

Where the document is in its processing. INDEXING_ERROR occurs when something went wrong with the indexing process. UPLOADED occurs when the document has been uploaded but not yet indexed or indexing is still in progress. INDEXED occurs when the document has been indexed and translation can start.

Value in"UPLOADED""INDEXED""INDEXING_ERROR"
indexingError*|

Why the indexing failed, written for a person. Null unless the status is INDEXING_ERROR

createdAt*string

When the document was uploaded

Formatdate-time
updatedAt*|

When the document last changed. Null if it never did

Formatdate-time
language*

Language of the source text

links*array<>

The resources related to this one. Follow these links instead of building the URLs yourself, so a change of path does not break the client

Example Request
curl -X GET 'https://api.redokun.com/v1/documents/1'
Example Response
{  "id": 0,  "filename": "string",  "fileType": "string",  "wordCount": 0,  "revision": 0,  "status": "UPLOADED",  "indexingError": "string",  "createdAt": "2019-08-24T14:15:22Z",  "updatedAt": "2019-08-24T14:15:22Z",  "language": {    "name": "string",    "code": "string"  },  "links": [    {      "rel": "string",      "href": "string"    }  ]}

A translation of a document GET

The status and the progress of one language the document is translated into: the same item as in `GET /v1/documents/{id}/translations`. Poll it every 10 to 30 seconds while you wait for a single language. Each revision of the document has its own translations. The first upload of a document has them from the start, with no segments until the document is `INDEXED`: wait for that status of the document before you read the progress. A new revision has none until its indexing copies them from the previous revision, so until then the call answers 404. An id that belongs to an older revision of the document answers 303 and points to the same language in the latest revision. Following the redirect is a second call, and counts against the rate limit like any other.

Pre-translate a document POST

Fills the segments of some translations of the document with a pre-translation: first from the translation memories of the team, then with a machine translation, as each language asks. The document must be `INDEXED`, and each language must be one the document is translated into, with the status `CREATED` and not complete yet. The call is all or nothing: when one language cannot be pre-translated, nothing starts and the error names it. The pre-translation runs in the background. The answer holds the translations of the document, where the languages of this call are `PRE_TRANSLATING`. Poll the `self` link, the same list as `GET /v1/documents/{id}/translations`, every 10 to 30 seconds: a language is done when it is back to `CREATED`, with its new progress. A language can be in one pre-translation at a time, and the account of the key can run 2 pre-translations at once. Past either limit the call answers 409: retry when a running pre-translation ends.