Get document information via API

To start with, receive document details with the GET document method using a document id. For a document created before the 76th release (December 6th 2018), the document id will look a bit different (e.g. 3391124_25) than in the example.

See our document example

Request URL: 
https://smartcat.ai/api/integration/v1/document?documentId=ac63c097c60c1d1bb54f1760_25

Headers:
Authorization: Basic ZG0wMTpRd2VydHkxMjM=

Response:
{
     "id": "ac63c097c60c1d1bb54f1760_25",
     "name": "test",
     "creationDate": "2018-12-17T23:32:04.508Z",
     "sourceLanguage": "en",
     "documentDisassemblingStatus": "success",
     "targetLanguage": "ru",
     "status": "inProgress",
     "wordsCount": 1,
     "statusModificationDate": "2018-12-17T23:32:47.528Z",
     "pretranslateCompleted": false,
     "workflowStages": [
        {
           "progress": 100,
           "wordsTranslated": 1,
           "unassignedWordsCount": 0,
           "status": "completed",
           "executives": [
           {
              "assignedWordsCount": 1,
              "progress": 100,
              "id": "92ebc7bb-9c8c-4516-b88e-ca4c753aca57"
           }
           ]
        }
     ],
     "externalId": "ac63c097c60c1d1bb54f1760",
     "placeholdersAreEnabled": true
}

Not enough details? Then you can go deeper and calculate the document statistics. Use GET document/statistics that first will respond with a "200 Build statistics in progress" message, and then in some time after you push the method again, the request will respond with the actual statistics.

See our document/statistics example

Request URL: 
https://smartcat.ai/api/integration/v1/document/statistics?documentId=e88fa692ba1c1d1bb54f07f8_25

Headers:
Authorization: Basic ZG0wMTpRd2VydHkxMjM=

Response:
  {
     "name": "test",
     "statistics": [
     {
        "name": "total",
        "words": 1,
        "percent": 100,
        "segments": 1,
        "pages": 0,
        "charsWithoutSpaces": 4,
        "charsWithSpaces": 4,
        "effectiveWordsForBilling": 0
     },
     {
        "name": "newWords",
        "words": 1,
        "percent": 100,
        "segments": 1,
        "pages": 0,
        "charsWithoutSpaces": 4,
        "charsWithSpaces": 4
     },
...
     {
        "name": "match_75_84",
        "words": 0,
        "percent": 0,
        "segments": 0,
        "pages": 0,
        "charsWithoutSpaces": 0,
        "charsWithSpaces": 0
     },
     {
        "name": "match_50_74",
        "words": 0,
        "percent": 0,
        "segments": 0,
        "pages": 0,
        "charsWithoutSpaces": 0,
        "charsWithSpaces": 0
     }
     ]
}

Afterward, the document will be most likely sent to translation, and once the translation is ready, you can check out our Smartcat integration 101 to see how you can get it.