Сценарии компании
curl --request GET \
--url https://api.tungo.kz/v1/companies/{co}/automations/scenarios \
--cookie tungo.session_token=import requests
url = "https://api.tungo.kz/v1/companies/{co}/automations/scenarios"
headers = {"cookie": "tungo.session_token="}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {cookie: 'tungo.session_token='}};
fetch('https://api.tungo.kz/v1/companies/{co}/automations/scenarios', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": [
{
"id": "scn_01jz8x3m4n5p6q7r8s9t0v1w2x",
"name": "Разнести поступления с сайта",
"enabled": true,
"trigger": {
"kind": "hook",
"hook_id": "hk_01jz8x3m4n5p6q7r8s9t0v1w2x",
"filter": {
"all": [
{
"path": "data.status",
"op": "eq",
"value": "paid"
}
]
}
},
"next_run_at": "2026-10-05T09:30:00.000Z",
"action": "agent",
"instruction": "<string>",
"output": {
"order_id": {
"type": "id",
"description": "Номер заказа из события"
},
"amount_tiyn": {
"type": "integer",
"description": "Сумма оплаты в тиынах"
},
"status": {
"type": "enum",
"values": [
"written",
"waiting"
],
"description": "written — поступление записано в 1С, waiting — ждёт человека"
}
},
"steps": [
{
"action": "agent",
"when": "always",
"instruction": "<string>",
"output": {
"order_id": {
"type": "id",
"description": "Номер заказа из события"
},
"amount_tiyn": {
"type": "integer",
"description": "Сумма оплаты в тиынах"
},
"status": {
"type": "enum",
"values": [
"written",
"waiting"
],
"description": "written — поступление записано в 1С, waiting — ждёт человека"
}
}
}
],
"auto_approve": {
"kinds": [
"bank_receipt",
"sale"
],
"max_amount_per_document_tiyn": 50000000,
"max_amount_per_day_tiyn": 200000000,
"directbank": true
},
"run_as": "usr_01h455vb4pex5vsknk084sn02q",
"created_at": "2026-10-05T09:30:00.000Z",
"updated_at": "2026-10-05T09:30:00.000Z"
}
]
}{
"type": "error",
"error": {
"type": "payment_required_error",
"message": "Баланс доп. использования закончился — пополнить его или включить автопополнение могут владелец и админ workspace.",
"code": "balance_exhausted",
"permission": "proposals.approve",
"resets_at": "2026-11-01T19:00:00.000Z",
"retry_after_seconds": 42,
"next_request_at": "2026-11-12T09:30:42.000Z",
"allowed_methods": [
"email_otp"
],
"role": "<string>",
"permissions": [
"<string>"
],
"fields": [
{
"path": "bin",
"code": "invalid_format",
"message": "БИН/ИИН — 12 цифр"
}
]
},
"request_id": "req_4f9c2a7e1b3d4c5a8e6f7a9b0c1d2e3f"
}{
"type": "error",
"error": {
"type": "payment_required_error",
"message": "Баланс доп. использования закончился — пополнить его или включить автопополнение могут владелец и админ workspace.",
"code": "balance_exhausted",
"permission": "proposals.approve",
"resets_at": "2026-11-01T19:00:00.000Z",
"retry_after_seconds": 42,
"next_request_at": "2026-11-12T09:30:42.000Z",
"allowed_methods": [
"email_otp"
],
"role": "<string>",
"permissions": [
"<string>"
],
"fields": [
{
"path": "bin",
"code": "invalid_format",
"message": "БИН/ИИН — 12 цифр"
}
]
},
"request_id": "req_4f9c2a7e1b3d4c5a8e6f7a9b0c1d2e3f"
}{
"type": "error",
"error": {
"type": "payment_required_error",
"message": "Баланс доп. использования закончился — пополнить его или включить автопополнение могут владелец и админ workspace.",
"code": "balance_exhausted",
"permission": "proposals.approve",
"resets_at": "2026-11-01T19:00:00.000Z",
"retry_after_seconds": 42,
"next_request_at": "2026-11-12T09:30:42.000Z",
"allowed_methods": [
"email_otp"
],
"role": "<string>",
"permissions": [
"<string>"
],
"fields": [
{
"path": "bin",
"code": "invalid_format",
"message": "БИН/ИИН — 12 цифр"
}
]
},
"request_id": "req_4f9c2a7e1b3d4c5a8e6f7a9b0c1d2e3f"
}{
"type": "error",
"error": {
"type": "payment_required_error",
"message": "Баланс доп. использования закончился — пополнить его или включить автопополнение могут владелец и админ workspace.",
"code": "balance_exhausted",
"permission": "proposals.approve",
"resets_at": "2026-11-01T19:00:00.000Z",
"retry_after_seconds": 42,
"next_request_at": "2026-11-12T09:30:42.000Z",
"allowed_methods": [
"email_otp"
],
"role": "<string>",
"permissions": [
"<string>"
],
"fields": [
{
"path": "bin",
"code": "invalid_format",
"message": "БИН/ИИН — 12 цифр"
}
]
},
"request_id": "req_4f9c2a7e1b3d4c5a8e6f7a9b0c1d2e3f"
}Автоматизации
Сценарии компании
Доступ: company.read.
Доступно по ключу API.
GET
/
v1
/
companies
/
{co}
/
automations
/
scenarios
Сценарии компании
curl --request GET \
--url https://api.tungo.kz/v1/companies/{co}/automations/scenarios \
--cookie tungo.session_token=import requests
url = "https://api.tungo.kz/v1/companies/{co}/automations/scenarios"
headers = {"cookie": "tungo.session_token="}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {cookie: 'tungo.session_token='}};
fetch('https://api.tungo.kz/v1/companies/{co}/automations/scenarios', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": [
{
"id": "scn_01jz8x3m4n5p6q7r8s9t0v1w2x",
"name": "Разнести поступления с сайта",
"enabled": true,
"trigger": {
"kind": "hook",
"hook_id": "hk_01jz8x3m4n5p6q7r8s9t0v1w2x",
"filter": {
"all": [
{
"path": "data.status",
"op": "eq",
"value": "paid"
}
]
}
},
"next_run_at": "2026-10-05T09:30:00.000Z",
"action": "agent",
"instruction": "<string>",
"output": {
"order_id": {
"type": "id",
"description": "Номер заказа из события"
},
"amount_tiyn": {
"type": "integer",
"description": "Сумма оплаты в тиынах"
},
"status": {
"type": "enum",
"values": [
"written",
"waiting"
],
"description": "written — поступление записано в 1С, waiting — ждёт человека"
}
},
"steps": [
{
"action": "agent",
"when": "always",
"instruction": "<string>",
"output": {
"order_id": {
"type": "id",
"description": "Номер заказа из события"
},
"amount_tiyn": {
"type": "integer",
"description": "Сумма оплаты в тиынах"
},
"status": {
"type": "enum",
"values": [
"written",
"waiting"
],
"description": "written — поступление записано в 1С, waiting — ждёт человека"
}
}
}
],
"auto_approve": {
"kinds": [
"bank_receipt",
"sale"
],
"max_amount_per_document_tiyn": 50000000,
"max_amount_per_day_tiyn": 200000000,
"directbank": true
},
"run_as": "usr_01h455vb4pex5vsknk084sn02q",
"created_at": "2026-10-05T09:30:00.000Z",
"updated_at": "2026-10-05T09:30:00.000Z"
}
]
}{
"type": "error",
"error": {
"type": "payment_required_error",
"message": "Баланс доп. использования закончился — пополнить его или включить автопополнение могут владелец и админ workspace.",
"code": "balance_exhausted",
"permission": "proposals.approve",
"resets_at": "2026-11-01T19:00:00.000Z",
"retry_after_seconds": 42,
"next_request_at": "2026-11-12T09:30:42.000Z",
"allowed_methods": [
"email_otp"
],
"role": "<string>",
"permissions": [
"<string>"
],
"fields": [
{
"path": "bin",
"code": "invalid_format",
"message": "БИН/ИИН — 12 цифр"
}
]
},
"request_id": "req_4f9c2a7e1b3d4c5a8e6f7a9b0c1d2e3f"
}{
"type": "error",
"error": {
"type": "payment_required_error",
"message": "Баланс доп. использования закончился — пополнить его или включить автопополнение могут владелец и админ workspace.",
"code": "balance_exhausted",
"permission": "proposals.approve",
"resets_at": "2026-11-01T19:00:00.000Z",
"retry_after_seconds": 42,
"next_request_at": "2026-11-12T09:30:42.000Z",
"allowed_methods": [
"email_otp"
],
"role": "<string>",
"permissions": [
"<string>"
],
"fields": [
{
"path": "bin",
"code": "invalid_format",
"message": "БИН/ИИН — 12 цифр"
}
]
},
"request_id": "req_4f9c2a7e1b3d4c5a8e6f7a9b0c1d2e3f"
}{
"type": "error",
"error": {
"type": "payment_required_error",
"message": "Баланс доп. использования закончился — пополнить его или включить автопополнение могут владелец и админ workspace.",
"code": "balance_exhausted",
"permission": "proposals.approve",
"resets_at": "2026-11-01T19:00:00.000Z",
"retry_after_seconds": 42,
"next_request_at": "2026-11-12T09:30:42.000Z",
"allowed_methods": [
"email_otp"
],
"role": "<string>",
"permissions": [
"<string>"
],
"fields": [
{
"path": "bin",
"code": "invalid_format",
"message": "БИН/ИИН — 12 цифр"
}
]
},
"request_id": "req_4f9c2a7e1b3d4c5a8e6f7a9b0c1d2e3f"
}{
"type": "error",
"error": {
"type": "payment_required_error",
"message": "Баланс доп. использования закончился — пополнить его или включить автопополнение могут владелец и админ workspace.",
"code": "balance_exhausted",
"permission": "proposals.approve",
"resets_at": "2026-11-01T19:00:00.000Z",
"retry_after_seconds": 42,
"next_request_at": "2026-11-12T09:30:42.000Z",
"allowed_methods": [
"email_otp"
],
"role": "<string>",
"permissions": [
"<string>"
],
"fields": [
{
"path": "bin",
"code": "invalid_format",
"message": "БИН/ИИН — 12 цифр"
}
]
},
"request_id": "req_4f9c2a7e1b3d4c5a8e6f7a9b0c1d2e3f"
}Авторизации
sessionapiKeybearerKey
Сессия кабинета: cookie ставит вход через /v1/auth/* (Better Auth), браузер шлёт её сам — фронтенду кабинета ничего добавлять не нужно (fetch с credentials: 'include'). За HTTPS имя cookie — __Secure-tungo.session_token. Сессия кончилась — 401 authentication_error: отправить на вход.