To connect to the API, you must make a POST request to the address https://app.doktomy.com/api/[method_name] with the POST parameter "api_token" containing the API key that can be generated in the DOKTOMY application.
This method is used to retrieve a list of templates.
URL:
https://app.doktomy.com/api/templates
Input parameters (POST):
Key | Required | Data type | Description |
---|---|---|---|
api_token | YES | string | API key |
limit | YES | int | Number of records fetched (for pagination purposes). Minimum value is 1, maximum is 100. |
curl --location --request POST 'https://app.doktomy.com/api/templates' \
--footer 'Accept: application/json' \
--form 'api_token="[API_KEY]"' \
--form 'limit="100"'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://app.doktomy.com/api/templates',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('api_token' => '[API_KEY]','limit' => '100'),
CURLOPT_HTTPfooter => array(
'Accept: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
{
"message": "OK",
"errors": [],
"list": {
"current_page": 1,
"data": [
{
"id": 115,
"name": "Template name",
"description": null,
"file_name": ""
}
],
"first_page_url": "https://app.doktomy.com/api/templates?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "https://app.doktomy.com/api/templates?page=1",
"links": [
{
"url": null,
"label": "« Previous",
"active": false
},
{
"url": "https://app.doktomy.com/api/templates?page=1",
"label": "1",
"active": true
},
{
"url": null,
"label": "Next »",
"active": false
}
],
"next_page_url": null,
"path": "https://app.doktomy.com/api/templates",
"per_page": "100",
"prev_page_url": null,
"to": 1,
"total": 1
}
}
{
"message": "Error",
"errors": {
"api_token": [
"Invalid API key"
]
}
}
This method is used to retrieve a list of email templates.
URL:
https://app.doktomy.com/api/email-templates
Input parameters (POST):
Key | Required | Data type | Description |
---|---|---|---|
api_token | YES | string | API key |
limit | YES | int | Number of records fetched (for pagination purposes). Minimum value is 1, maximum is 100. |
curl --location --request POST 'https://app.doktomy.com/api/email-templates' \
--footer 'Accept: application/json' \
--form 'api_token="[API_KEY]"' \
--form 'limit="1"'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://app.doktomy.com/api/email-templates',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('api_token' => '[API_KEY]','limit' => '1'),
CURLOPT_HTTPfooter => array(
'Accept: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
{
"message": "OK",
"errors": [],
"list": {
"current_page": 1,
"data": [
{
"id": 17,
"name": "Sample template",
"description": "Sample template description",
"default": 1,
"email_topic": "Sample email subject",
"email_content": "Sample email content",
"receivers": null,
"receivers_cc": null,
"receivers_bcc": null
}
],
"first_page_url": "https://app.doktomy.com/api/email-templates?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "https://app.doktomy.com/api/email-templates?page=1",
"links": [
{
"url": null,
"label": "« Previous",
"active": false
},
{
"url": "https://app.doktomy.com/api/email-templates?page=1",
"label": "1",
"active": true
},
{
"url": null,
"label": "Next »",
"active": false
}
],
"next_page_url": null,
"path": "https://app.doktomy.com/api/email-templates",
"per_page": "1",
"prev_page_url": null,
"to": 1,
"total": 1
}
}
{
"message": "Error",
"errors": {
"api_token": [
"Invalid API key"
]
}
}
This method is used to retrieve a list of document footers.
URL:
https://app.doktomy.com/api/document-footers
Input parameters (POST):
Key | Required | Data type | Description |
---|---|---|---|
api_token | YES | string | API key |
limit | YES | int | Number of records fetched (for pagination purposes). Minimum value is 1, maximum is 100. |
curl --location --request POST 'https://app.doktomy.com/api/document-footers' \
--footer 'Accept: application/json' \
--form 'api_token="[API_KEY]"' \
--form 'limit="2"'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://app.doktomy.com/api/document-footers',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('api_token' => '[API_KEY]','limit' => '2'),
CURLOPT_HTTPfooter => array(
'Accept: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
{
"message": "OK",
"errors": [],
"list": {
"current_page": 1,
"data": [
{
"id": 1,
"name": "Footer name",
"description": "Footer description",
"content": "Content
",
"default": 0
},
{
"id": 2,
"name": "Footer name 2",
"description": "Footer description 2",
"content": "Content
",
"default": 1
}
],
"first_page_url": "https://app.doktomy.com/api/document-footers?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "https://app.doktomy.com/api/document-footers?page=1",
"links": [
{
"url": null,
"label": "« Previous",
"active": false
},
{
"url": "https://app.doktomy.com/api/document-footers?page=1",
"label": "1",
"active": true
},
{
"url": null,
"label": "Next »",
"active": false
}
],
"next_page_url": null,
"path": "https://app.doktomy.com/api/document-footers",
"per_page": "2",
"prev_page_url": null,
"to": 2,
"total": 2
}
}
{
"message": "Error",
"errors": {
"api_token": [
"Invalid API key"
]
}
}
This method is used to retrieve a list of document headers.
URL:
https://app.doktomy.com/api/document-headers
Input parameters (POST):
Key | Required | Data type | Description |
---|---|---|---|
api_token | YES | string | Key API |
limit | YES | int | Number of records fetched (for pagination purposes). Minimum value is 1, maximum is 100. |
curl --location --request POST 'https://app.doktomy.com/api/document-headers' \
--header 'Accept: application/json' \
--form 'api_token="[API_KEY]"' \
--form 'limit="2"'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://app.doktomy.com/api/document-headers',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('api_token' => '[API_KEY]','limit' => '2'),
CURLOPT_HTTPheader => array(
'Accept: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
{
"message": "OK",
"errors": [],
"list": {
"current_page": 1,
"data": [
{
"id": 1,
"name": "Header name",
"description": "Header description",
"content": "Content
",
"default": 0
},
{
"id": 2,
"name": "Header name 2",
"description": "Header description 2",
"content": "Content
",
"default": 1
}
],
"first_page_url": "https://app.doktomy.com/api/document-headers?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "https://app.doktomy.com/api/document-headers?page=1",
"links": [
{
"url": null,
"label": "« Previous",
"active": false
},
{
"url": "https://app.doktomy.com/api/document-headers?page=1",
"label": "1",
"active": true
},
{
"url": null,
"label": "Next »",
"active": false
}
],
"next_page_url": null,
"path": "https://app.doktomy.com/api/document-headers",
"per_page": "2",
"prev_page_url": null,
"to": 2,
"total": 2
}
}
{
"message": "Error",
"errors": {
"api_token": [
"Invalid API key"
]
}
}
This method is used to retrieve template details.
URL:
https://app.doktomy.com/api/template
Input parameters (POST):
Key | Required | Data type | Description |
---|---|---|---|
api_token | YES | string | Key API |
id | YES | int | Template id. |
curl --location --request POST 'https://app.doktomy.com/api/template' \
--footer 'Accept: application/json' \
--form 'api_token="[API_KEY]"' \
--form 'id="115"'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://app.doktomy.com/api/template',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('api_token' => '[API_KEY]','id' => '115'),
CURLOPT_HTTPfooter => array(
'Accept: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
{
"message": "OK",
"errors": [],
"template": {
"id": 115,
"name": "Template name",
"description": null,
"file_name": "1",
"variables": [
"name",
"surname",
"phone"
]
}
}
{
"message": "Error",
"errors": {
"api_token": [
"Invalid API key"
]
}
}
The method is used to generate a document.
The method returns two important values:
URL:
https://app.doktomy.com/api/generate-document
Input parameters (POST):
Key | Required | Data type | Description |
---|---|---|---|
api_token | YES | string | Key API |
template_id | YES | int | Template id. |
add_header | YES | boolean (0 lub 1) | Whether to include a header in the document. |
header | YES, if add_header=1 | int | Document header id. |
add_footer | YES | boolean (0 lub 1) | Whether to include a footer in the document. |
footer | YES, if add_footer=1 | int | Document footer id. |
variables[XYZ] | NO | string | Variable values. The list of variables for a given template can be retrieved using the /api/template method. The value XYZ should be replaced with the variable name. This field can appear multiple times depending on the number of variables in the template. |
send_email | NO | boolean | Information about whether to send the document by e-mail. |
email_template_id | YES - if send_email=1 | int | E-mail template id. |
YES - if send_email=1 | int | Email address to send the template to. | |
description | NO | string | Document description. |
curl --location --request POST 'https://app.doktomy.com/api/generate-document' \
--header 'Accept: application/json' \
--form 'api_token="[API_KEY]"' \
--form 'template_id="115"' \
--form 'add_header="1"' \
--form 'header="1"' \
--form 'variables[name]="John"' \
--form 'variables[surname]="Smith"' \
--form 'variables[phone]="555666777"' \
--form 'add_footer="1"' \
--form 'footer="2"' \
--form 'send_email="1"' \
--form 'email_template_id="17"' \
--form 'email="mail@example.com"' \
--form 'description="Description"'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://app.doktomy.com/api/generate-document',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('api_token' => '[API_KEY]','template_id' => '115','add_header' => '1','header' => '1','variables[imiÄ™]' => 'Jan','variables[nazwisko]' => 'Kowalski','variables[telefon]' => '555666777','add_footer' => '1','footer' => '2','send_email' => '1','email_template_id' => '17','email' => 'mail@example.com','description' => 'Description'),
CURLOPT_HTTPHEADER => array(
'Accept: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
{
"message": "OK",
"link": "https://app.doktomy.com/api/get-document?api_token=%242y%2410%24lrvYA4O1LZ.rOIxkOB.jsuHKR4or4VEvLjf3rH50qNnQc1%2Fhqdpru&document_token=27d80b8d686456871ed24abdaa6253cc",
"safe_link": "https://app.doktomy.com/api/document-safe-link?api_token=%242y%2410%24lrvYA4O1LZ.rOIxkOB.jsuHKR4or4VEvLjf3rH50qNnQc1%2Fhqdpru&document_token=27d80b8d686456871ed24abdaa6253cc"
}
{
"message": "Error",
"errors": {
"api_token": [
"Invalid API key"
]
}
}