Skip to main content
A typical scenario for processing documents using separate API calls (for creating a transaction, uploading a file, and starting a transaction) consists of the following steps:
  1. Receiving a list of all available skills
  2. Creating an empty transaction
  3. Adding a set of files to be processed in the transaction
  4. Starting the transaction
  5. Monitoring the transaction status
  6. Downloading source files and result files
Each request to the server must include authentication information (such as an access token). For more information, see Authentication.

Receiving a list of all available skills

To do so, send a GET request to the skills resource:
GET https://your-server/api/publicapi/v1/skills
Run the following command: For Windows:
curl -X GET "https://your-server/api/publicapi/v1/skills" \
-H "Authorization: Bearer token"
For Linux:
curl -X GET 'https://your-server/api/publicapi/v1/skills' \
-H 'Authorization: Bearer token'
As a result, you will receive information about all the skills added to the application instance.

Creating an empty transaction

To do so, send the following POST request to the transactions resource:
POST https://your-server/api/publicapi/v1/transactions
Run the following command: For Windows:
curl -X POST "https://your-server/api/publicapi/v1/transactions" \
-H "accept: */*" \
-H "Authorization: Bearer token" \
-H "Content-Type: application/json" \
-d "{
  \"skillId\": \"00000000-0000-0000-0000-000000000001\"
}"
For Linux:
curl -X POST 'https://your-server/api/publicapi/v1/transactions' \
-H 'accept: */*' \
-H 'Authorization: Bearer token' \
-H 'Content-Type: application/json' \
-d '{
  "skillId": "00000000-0000-0000-0000-000000000001"
}'
In the body of the request specify the skillId parameter, which was returned by the previous API call. As a result, you will receive a response containing the id of the created transaction.

Adding a set of files to be processed in the transaction

Important! The maximum number of files in a transaction is 1000. A set of files can be added in two ways:

Adding files directly to the transaction

To do so, send a POST request to the transactions/<transaction-id>/files resource:
POST https://your-server/api/publicapi/v1/transactions/transaction-id/files
In the body of the request send the file to be processed. For details on the available parameters for customizing files, see the API Reference. Run the following command: For Windows:
curl -X POST "https://your-server/api/publicapi/v1/transactions/transaction-id/files" \
-H "accept: */*" \
-H "Authorization: Bearer token" \
-H "Content-Type: multipart/form-data" \
-F "Model={
   \"files\": [
     {
     }
   ]
}" \
-F "Files=@testImage.tif;type=image/tiff"
For Linux:
curl -X POST 'https://your-server/api/publicapi/v1/transactions/transaction-id/files' \
-H 'accept: */*' \
-H 'Authorization: Bearer token' \
-H 'Content-Type: multipart/form-data' \
-F 'Model={
   "files": [
     {
     }
   ]
}' \
-F 'Files=@testImage.tif;type=image/tiff'
As a result, you will receive a response with a list of added files and their identifiers. You can add as many files as you need by repeating this call multiple times. Additional options for uploading files:

Adding files to a document

First, create a document by sending a POST request to the transactions/<transaction-id>/documents resource:
POST https://your-server/api/publicapi/v1/transactions/transaction-id/documents
For Windows:
curl -X POST "https://your-server/api/publicapi/v1/transactions/transaction-id/documents" \
-H "accept: */*" \
-H "Authorization: Bearer token" \
-H "Content-Type: application/json" \
-d "{
  \"documents\": [
    {
    }
  ]
}"
For Linux:
curl -X POST 'https://your-server/api/publicapi/v1/transactions/transaction-id/documents' \
-H 'accept: */*' \
-H 'Authorization: Bearer token' \
-H 'Content-Type: application/json' \
-d '{
  "documents": [
    {
    }
  ]
}'
As a result, you will receive a response with the document identifier. Then add files to the document by sending a POST request to the transactions/<transaction-id>/documents/<document-id>/sourceFiles resource:
POST https://your-server/api/publicapi/v1/transactions/transaction-id/documents/document-id/sourceFiles
For Windows:
curl -X POST "https://your-server/api/publicapi/v1/transactions/transaction-id/documents/document-id/sourceFiles" \
-H "accept: */*" \
-H "Authorization: Bearer token" \
-H "Content-Type: multipart/form-data" \
-F "Model={
   \"files\": [
     {
     }
   ]
}" \
-F "Files=@testImage.tif;type=image/tiff"
For Linux:
curl -X POST 'https://your-server/api/publicapi/v1/transactions/transaction-id/documents/document-id/sourceFiles' \
-H 'accept: */*' \
-H 'Authorization: Bearer token' \
-H 'Content-Type: multipart/form-data' \
-F 'Model={
   "files": [
     {
     }
   ]
}' \
-F 'Files=@testImage.tif;type=image/tiff'

Starting the transaction

To start the transaction with the specified skill and files, send the following POST request to the transactions/<transaction-id>/start resource:
POST https://your-server/api/publicapi/v1/transactions/transaction-id/start
For Windows:
curl -X POST "https://your-server/api/publicapi/v1/transactions/transaction-id/start" \
-H "accept: */*" \
-H "Authorization: Bearer token"
For Linux:
curl -X POST 'https://your-server/api/publicapi/v1/transactions/transaction-id/start' \
-H 'accept: */*' \
-H 'Authorization: Bearer token'

Monitoring the transaction status

To start monitoring the transaction status by using a loop with a short timeout (we do not recommend checking the status more often than once per second), send a GET request to the transactions/<transaction_id> resource with the transaction identifier in the request URI:
GET https://your-server/api/publicapi/v1/transactions/transaction-id
For Windows:
curl -X GET "https://your-server/api/publicapi/v1/transactions/transaction-id" \
-H "Authorization: Bearer token"
For Linux:
curl -X GET 'https://your-server/api/publicapi/v1/transactions/transaction-id' \
-H 'Authorization: Bearer token'
As a result, you will receive a response containing the transaction status. Transaction processing may be in one of the following statuses:
  • New. The transaction was created but has not been queued for processing yet.
  • Queued. The transaction is queued for processing.
  • InProgress. The transaction is being processed.
  • Processed. The transaction was successfully processed.
  • ProcessedWithWarnings. The transaction was processed but warnings occurred.
  • NotProcessed. The transaction was not processed due to an error.
  • Deleted . The transaction was deleted by the user or automatically by the retention policy.
If the transaction status is Processed or ProcessedWithWarnings, go to step 6.

Downloading source files

To request a list of documents with their identifiers, send a GET request to the transactions/<transaction-id>/documents resource and specify the transaction identifier:
GET https://your-server/api/publicapi/v1/transactions/transaction-id/documents
For Windows:
curl -X GET "https://your-server/api/publicapi/v1/transactions/transaction-id/documents" \
-H "Authorization: Bearer token"
For Linux:
curl -X GET 'https://your-server/api/publicapi/v1/transactions/transaction-id/documents' \
-H 'Authorization: Bearer token'
As a result, you will receive a list of all the documents which have been created within this transaction. The response also contains the identifiers of these documents, which may be needed to request detailed information about specific documents. To request a list of files which were added to a specific document, send a GET request to the transactions/<transaction-id>/documents/<document-id> resource:
GET https://your-server/api/publicapi/v1/transactions/transaction-id/documents/document-id
For Windows:
curl -X GET "https://your-server/api/publicapi/v1/transactions/transaction-id/documents/document-id" \
-H "Authorization: Bearer token"
For Linux:
curl -X GET 'https://your-server/api/publicapi/v1/transactions/transaction-id/documents/document-id' \
-H 'Authorization: Bearer token'
As a result, you will receive information about the document. The response also contains identifiers of files added to the document. To download the source file, send a GET request to the transactions/<transaction-id>/files/<file-id>/download resource:
GET https://your-server/api/publicapi/v1/transactions/transaction-id/files/file-id/download
For Windows:
curl -X GET "https://your-server/api/publicapi/v1/transactions/transaction-id/files/file-id/download" \
-H "Authorization: Bearer token"
For Linux:
curl -X GET 'https://your-server/api/publicapi/v1/transactions/transaction-id/files/file-id/download' \
-H 'Authorization: Bearer token'