[POST] .../v1/doccontractfile/add
Attaches a file to a contract. Use this method to attach a supporting file to an existing contract after the contract has been created with DocContract/Add. JSON requests must contain contract_id, name, extension and base64 data; multipart/form-data requests must contain contract_id and an uploaded file and name or extension may be derived from the uploaded filename when omitted. The contract tariff parameter must be enabled, the target contract must exist, file storage must accept the payload and the current request user must have contract-file add permission. Missing body, invalid required fields, missing uploaded multipart file, denied access, unavailable tariff, missing contract, file-storage errors, database failures and action-log failures are returned as HTTP 200 ErrorResult business errors.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| contract_id | Int64 | Required | Contract ID. |
| data | String | Required | Base64-encoded file data for JSON requests. Multipart requests send the uploaded file stream instead. |
| extension | String | Required | File extension without a leading dot. For multipart requests this can be derived from the uploaded filename. |
| name | String | Required | File name without path. For multipart requests this can be derived from the uploaded filename. |
Request Example
{
"contract_id": 9101,
"name": "signed-contract",
"extension": "pdf",
"data": "JVBERi0xLjQK"
}
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": 8101
}
}