Create Document
Creates a draft document on behalf of the key’s owner (the owner becomes the initiator), either from a template (template_id) or from a file the caller uploaded with FileService (file_id). Route and sending are separate steps.
Required scope: documents:write
Error Codes:
- DEVELOPER.SCOPE_INSUFFICIENT: The key lacks the documents:write scope.
- INVALID_ARGUMENT: Neither or both of template_id and file_id, or invalid type or field values.
- FILE_NOT_FOUND: No upload with that id belongs to the key owner.
- FILE.INVALID_STATUS_TRANSITION: The upload was never confirmed.
- FILE.ALREADY_LINKED: The upload is already attached to a document.
- DOCUMENT_INITIATOR_NOT_FOUND: The key owner is not an employee of the tenant.
curl --request POST \
--url https://app.doodocs.kz/api/developer/v1/documents \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"title": "<string>",
"type_id": "<string>",
"date": "<string>",
"file_id": "<string>",
"number": "<string>",
"organization_id": "<string>",
"subject_employee_ids": [
"<string>"
],
"template_id": "<string>",
"template_values": {},
"template_version": 123
}
'import requests
url = "https://app.doodocs.kz/api/developer/v1/documents"
payload = {
"title": "<string>",
"type_id": "<string>",
"date": "<string>",
"file_id": "<string>",
"number": "<string>",
"organization_id": "<string>",
"subject_employee_ids": ["<string>"],
"template_id": "<string>",
"template_values": {},
"template_version": 123
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: '<string>',
type_id: '<string>',
date: '<string>',
file_id: '<string>',
number: '<string>',
organization_id: '<string>',
subject_employee_ids: ['<string>'],
template_id: '<string>',
template_values: {},
template_version: 123
})
};
fetch('https://app.doodocs.kz/api/developer/v1/documents', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.doodocs.kz/api/developer/v1/documents",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'title' => '<string>',
'type_id' => '<string>',
'date' => '<string>',
'file_id' => '<string>',
'number' => '<string>',
'organization_id' => '<string>',
'subject_employee_ids' => [
'<string>'
],
'template_id' => '<string>',
'template_values' => [
],
'template_version' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.doodocs.kz/api/developer/v1/documents"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"type_id\": \"<string>\",\n \"date\": \"<string>\",\n \"file_id\": \"<string>\",\n \"number\": \"<string>\",\n \"organization_id\": \"<string>\",\n \"subject_employee_ids\": [\n \"<string>\"\n ],\n \"template_id\": \"<string>\",\n \"template_values\": {},\n \"template_version\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.doodocs.kz/api/developer/v1/documents")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"type_id\": \"<string>\",\n \"date\": \"<string>\",\n \"file_id\": \"<string>\",\n \"number\": \"<string>\",\n \"organization_id\": \"<string>\",\n \"subject_employee_ids\": [\n \"<string>\"\n ],\n \"template_id\": \"<string>\",\n \"template_values\": {},\n \"template_version\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.doodocs.kz/api/developer/v1/documents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"<string>\",\n \"type_id\": \"<string>\",\n \"date\": \"<string>\",\n \"file_id\": \"<string>\",\n \"number\": \"<string>\",\n \"organization_id\": \"<string>\",\n \"subject_employee_ids\": [\n \"<string>\"\n ],\n \"template_id\": \"<string>\",\n \"template_values\": {},\n \"template_version\": 123\n}"
response = http.request(request)
puts response.read_body{
"document": {
"completed_at": "2023-11-07T05:31:56Z",
"create_time": "2023-11-07T05:31:56Z",
"date": "<string>",
"department_id": "<string>",
"files": [
{
"file_id": "<string>",
"file_type": "FILE_TYPE_UNSPECIFIED"
}
],
"id": "<string>",
"initiator_employee_id": "<string>",
"number": "<string>",
"organization_id": "<string>",
"route": {
"active": true,
"id": "<string>",
"status": "ROUTE_STATUS_UNSPECIFIED",
"steps": [
{
"id": "<string>",
"index": 123,
"participants": [
{
"employee_id": "<string>",
"id": "<string>",
"key_type": "<string>",
"status": "PARTICIPANT_STATUS_UNSPECIFIED"
}
],
"rule": "STEP_RULE_UNSPECIFIED",
"status": "STEP_STATUS_UNSPECIFIED",
"step_type": "STEP_TYPE_UNSPECIFIED"
}
]
},
"status": "DOCUMENT_STATUS_UNSPECIFIED",
"subject_employee_ids": [
"<string>"
],
"title": "<string>",
"type_id": "<string>",
"update_time": "2023-11-07T05:31:56Z"
}
}{
"code": 123,
"details": [
{
"@type": "<string>"
}
],
"message": "<string>"
}Authorizations
Body
Document title.
Document type id.
Document date, YYYY-MM-DD.
Id of a confirmed upload (FileService.ConfirmFileUpload) to build the document from, instead of a template. The file becomes the document's PDF and can be sent for signing as it is. Mutually exclusive with template_id.
Registration number to record on the document.
Legal entity to attribute the document to.
Employees the document is about (its subjects).
Template id and version the document is generated from. Discover these with ListDocumentTemplates (see DocumentTemplate.version). Required unless file_id is set.
Values for the template variables, keyed by variable id. Read the expected shape from the template's variable_schema (GetDocumentTemplate).
Version of the template to use; take it from DocumentTemplate.version.
Response
OK
The created draft document.
Show child attributes
Show child attributes
curl --request POST \
--url https://app.doodocs.kz/api/developer/v1/documents \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"title": "<string>",
"type_id": "<string>",
"date": "<string>",
"file_id": "<string>",
"number": "<string>",
"organization_id": "<string>",
"subject_employee_ids": [
"<string>"
],
"template_id": "<string>",
"template_values": {},
"template_version": 123
}
'import requests
url = "https://app.doodocs.kz/api/developer/v1/documents"
payload = {
"title": "<string>",
"type_id": "<string>",
"date": "<string>",
"file_id": "<string>",
"number": "<string>",
"organization_id": "<string>",
"subject_employee_ids": ["<string>"],
"template_id": "<string>",
"template_values": {},
"template_version": 123
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: '<string>',
type_id: '<string>',
date: '<string>',
file_id: '<string>',
number: '<string>',
organization_id: '<string>',
subject_employee_ids: ['<string>'],
template_id: '<string>',
template_values: {},
template_version: 123
})
};
fetch('https://app.doodocs.kz/api/developer/v1/documents', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.doodocs.kz/api/developer/v1/documents",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'title' => '<string>',
'type_id' => '<string>',
'date' => '<string>',
'file_id' => '<string>',
'number' => '<string>',
'organization_id' => '<string>',
'subject_employee_ids' => [
'<string>'
],
'template_id' => '<string>',
'template_values' => [
],
'template_version' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.doodocs.kz/api/developer/v1/documents"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"type_id\": \"<string>\",\n \"date\": \"<string>\",\n \"file_id\": \"<string>\",\n \"number\": \"<string>\",\n \"organization_id\": \"<string>\",\n \"subject_employee_ids\": [\n \"<string>\"\n ],\n \"template_id\": \"<string>\",\n \"template_values\": {},\n \"template_version\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.doodocs.kz/api/developer/v1/documents")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"type_id\": \"<string>\",\n \"date\": \"<string>\",\n \"file_id\": \"<string>\",\n \"number\": \"<string>\",\n \"organization_id\": \"<string>\",\n \"subject_employee_ids\": [\n \"<string>\"\n ],\n \"template_id\": \"<string>\",\n \"template_values\": {},\n \"template_version\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.doodocs.kz/api/developer/v1/documents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"<string>\",\n \"type_id\": \"<string>\",\n \"date\": \"<string>\",\n \"file_id\": \"<string>\",\n \"number\": \"<string>\",\n \"organization_id\": \"<string>\",\n \"subject_employee_ids\": [\n \"<string>\"\n ],\n \"template_id\": \"<string>\",\n \"template_values\": {},\n \"template_version\": 123\n}"
response = http.request(request)
puts response.read_body{
"document": {
"completed_at": "2023-11-07T05:31:56Z",
"create_time": "2023-11-07T05:31:56Z",
"date": "<string>",
"department_id": "<string>",
"files": [
{
"file_id": "<string>",
"file_type": "FILE_TYPE_UNSPECIFIED"
}
],
"id": "<string>",
"initiator_employee_id": "<string>",
"number": "<string>",
"organization_id": "<string>",
"route": {
"active": true,
"id": "<string>",
"status": "ROUTE_STATUS_UNSPECIFIED",
"steps": [
{
"id": "<string>",
"index": 123,
"participants": [
{
"employee_id": "<string>",
"id": "<string>",
"key_type": "<string>",
"status": "PARTICIPANT_STATUS_UNSPECIFIED"
}
],
"rule": "STEP_RULE_UNSPECIFIED",
"status": "STEP_STATUS_UNSPECIFIED",
"step_type": "STEP_TYPE_UNSPECIFIED"
}
]
},
"status": "DOCUMENT_STATUS_UNSPECIFIED",
"subject_employee_ids": [
"<string>"
],
"title": "<string>",
"type_id": "<string>",
"update_time": "2023-11-07T05:31:56Z"
}
}{
"code": 123,
"details": [
{
"@type": "<string>"
}
],
"message": "<string>"
}