Skip to main content
Skip table of contents

Work with external APIs

This article describes the general principles of working with the Schrift API. If you have any questions, please contact Schrift technical support.

Work with Schrift API

BaseURL to call the API must contain the company's domain name.

All APIs must be called using this URL.
https://{{company_domain}}.ostrean.com/api/v1/External

To authorize by API key, use a valid employee API key, passing it as the request header: X-API-KEY : {{EmployeeAPIKey}}

Creating a document using API

The main parameters of a document when it is created are Subject, Table of Contents, Template, File, and Access. A document can be created without files or contain several files. To upload a file to the server, make an http request:

CODE
curl --location  '{{baseUrl}}/file-storage' ^
--header 'X-API-KEY: {{EmployeeAPIKey}}' ^
--header 'X-FileType: DocumFile' ^
--header 'Content-Type: multipart/form-data' ^
--header 'Accept: text/plain' ^
--form 'file=@"{{FilePath}}"'

The request will return the GUID of the file, {{FileGUID}}, which you need to pass when creating the document.

To add a document, make an http request:

CODE
curl --location  '{{baseUrl}}/Documents' ^
--header 'X-API-KEY: {{EmployeeAPIKey}}' ^
--header 'Content-Type: application/json' ^
--header 'Accept: text/plain' ^
--data '{
    "AccessLevel": 30, 
    "TemplateId": "{{TemplateId}}",   
    "Subject": "Доручення №123 01.01.2030 Назва компанії - Назва контрагента",
    "Description": "Інвойс на поставку товарів та матеріалів",
"Files": [
{ 
"GUID": {{FileGUID}},
    "Type": 0
    "Date": {{DateNow}},
    "Name": {{FileName}},
    "Hash": {{FileHash}},
    "Size": {{FileSize}},
    "UseInDescription": true
   }
 ],
"Targets": [
    {
      "AccessType": 30,
      "TargetType": 20,
      "RecordId": {{PositionID1}}
    },
    {
      "AccessType": 50,
      "TargetType": 20,
      "RecordId": {{PositionID2}}
    }
  ]
}

{{Hash}} Hash file in the format sha256.
{{Date}} The date of creation of the file must be transmitted in the format «YYYYY-MM-DDDTHH:mm:SSZ»

{{TemplateId}} When creating documents, it is important to specify the appropriate document template. Depending on the template, the document you create may have a different log, distribution and signature composition, access parameters, etc. The ID of the required template can be found in the template directory.

{{PositionID1}} {{PositionID2}} You can specify access parameters for a document in the template or specify a list of IDs of the required positions separately. If you do not specify Targets, the document will be available only to its creator. To determine the position ID, go to the organization structure directory.

CODE
"Targets": [
    {
      "AccessType": 30,
      "TargetType": 20,
      "RecordId": {{PositionID1}}
    },
    {
      "AccessType": 50,
      "TargetType": 20,
      "RecordId": {{PositionID2}}
    }
  ],

«AccessType» : 30 - opening access with a notification.
«AccessType» : 50 - opening access without notification.

For details on opening access with and without notice, see this article.

Update document status using API

To display information about the status of a document in Schrift, the integration module can make a request to receive the document and its list of signatures. To get the document, make an http request:

CODE
curl --location  '{{baseUrl}}/Documents/{{DocumentID}}' ^
--header 'Accept: text/plain' ^
--header 'X-API-KEY: {{EmployeeAPIKey}}'

“DocumentDate” - the date of the document
“DocumentFullNumber” - registration number of the document
“StateType” - the status of the document
“StateType": 0, 5 - Project
“StateType": 6 - Signed
“StateType": 8 - On registration
“StateType": 102,104,106,107,108,109 - Signed
“StateType": 110 - Registered.

To get the signature composition, make an http request:

CODE
curl --location  '{{baseUrl}}/Documents/{{DocumentID}}/Plans' ^
--header 'Accept: text/plain' ^
--header 'X-API-KEY: {{EmployeeAPIKey}}'

“SendType": 250 - Consent
“SendType": 260 - Approval
“SendType": 270 - Endorsement
“SendType": 280 - Signature
“TargetDescription” - the status of the signature in text format.

Schrift API Postman collection

To learn about and execute Schrift API queries in Postman. The Schrift API Postman collection contains basic examples of working with Schrift documents.

Links to our collection on the web.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.