[POST] .../v1/doccontract/add
Creates a contract. Use this method to create a contract header before using it in purchase, sale, payment or other document workflows or before adding contract files with DocContractFile/Add. The request body must contain code, name, date, start_date, end_date, partner_id, firm_id, direction, amount, currency_id and details; attached_user_id is optional and the current request user is used when it is omitted or sent as 0. The contract tariff parameter must be enabled, referenced partner and firm records must exist and the current request user must have contract add permission. Missing body, invalid required fields, denied access, unavailable tariff, missing related records, database failures and action-log or webhook failures are returned as HTTP 200 ErrorResult business errors.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| active | Boolean | Optional | Validity flag: true - valid, false - invalid. |
| amount | Decimal | Required | Contract amount. |
| attached_user_id | Int64 | Optional | Responsible user ID. The current user is used by default. |
| code | String | Required | Contract code. |
| currency_id | Int64 | Required | Contract currency ID. |
| date | Int64 | Required | Contract date as Unix time in seconds. |
| description | String | Optional | Note. |
| details | String | Required | Contract details. |
| direction | String | Required | Contract direction: Income or Outcome. Allowed values: All, Income, Outcome. |
| end_date | Int64 | Required | Contract work end date as Unix time in seconds. |
| firm_id | Int64 | Required | Company ID. |
| name | String | Required | Contract name. |
| partner_id | Int64 | Required | Partner ID. |
| start_date | Int64 | Required | Contract work start date as Unix time in seconds. |
Request Example
{
"code": "CNT-2026-02",
"date": 1767225600,
"direction": "Income",
"name": "January supply contract",
"firm_id": 11,
"partner_id": 201,
"amount": 25000,
"currency_id": 1,
"start_date": 1767225600,
"end_date": 1798761600,
"details": "Payment within 15 banking days",
"description": "Primary 2026 supply contract",
"active": true
}
Response Parameters
| Name | Type | Description |
|---|---|---|
| ok | Boolean | Indicates whether the request completed successfully. |
| result | Insert | Created record result. |
Response Example
{
"ok": true,
"result": {
"new_id": 9101
}
}