The Controlata API lets external systems (a website, CRM, accounting system or marketplace) work with your data in Controlata: manage the catalog of materials, products and resources, create sales, purchases, productions, write-offs, transfers and audits, and read stock levels at storage locations.

Connecting requires programming experience and familiarity with APIs. If you are not a developer, hand this documentation to a technical specialist or an AI assistant: every article can be copied as Markdown.

## Connecting

1. Open **Settings → [Integrations](https://app.controlata.com/settings/integrations)** and click **Connect** next to **General API**.
2. Copy the **API key**. It authorizes every request.
3. If needed, change the **Sale number prefix**. The default is "A-".

## Base URL and request format

Base API URL:

```
https://api.controlata.com/connect/
```

In this documentation method paths are given relative to this URL. For example, the method v1/materials/add is called at https://api.controlata.com/connect/v1/materials/add.php. The first path segment is the method version: a new version appears only if the response changes incompatibly, and the old one keeps working.

* Every method is called with a POST request.
* Request body: JSON in UTF-8, header Content-Type: application/json.

The API is meant for requests from your server. Requests from a browser on another domain are rejected with code 401.

## Authorization

Pass the API key in the Authorization header as is, without the word Bearer:

```
Authorization: your_api_key
```

Example request:

```
curl -X POST https://api.controlata.com/connect/v1/storages/get_list.php \
  -H "Authorization: your_api_key" \
  -H "Content-Type: application/json" \
  -d '{}'
```

## Responses and errors

A successful response has code 200 and a success field equal to true. The other fields depend on the method:

```
{
    "success": true,
    "material_id": 2051
}
```

On error, success is false and the error field holds a description in English:

```
{
    "success": false,
    "error": "Material not found or access denied"
}
```

| HTTP code | When | Response body |
|---|---|---|
| 200 | Request completed | JSON, success: true |
| 400 | Error in the request data: a required field is missing, an invalid value, a record is not found | JSON, success: false |
| 401 | API key is missing or invalid | Empty |
| 429 | Daily request limit reached | JSON, success: false |
| 500 | Internal error | JSON, success: false |

If a required field is missing, the error reads «No <field> in input», for example «No material_id in input». The other errors are listed in each method's article.

## Request limit

A company can send up to 10,000 requests per day. Every request with a valid key counts, including those that end in an error. The counter resets once a day, at night. When the limit is exceeded, the API responds with code 429 and the error «Daily connections limit reached».

## What's next

* [Common Rules](https://developers.controlata.com/hc/api-docs/articles/api-rules): partial editing, pagination, number precision.
* Reference lists integrations usually start with: [Categories](https://developers.controlata.com/hc/api-docs/articles/api-categories-overview), [Storage Locations](https://developers.controlata.com/hc/api-docs/articles/api-storages-get-list), [Units of Measure](https://developers.controlata.com/hc/api-docs/articles/api-units-get-list).
* Method sections: [Materials](https://developers.controlata.com/hc/api-docs/articles/api-materials), [Products](https://developers.controlata.com/hc/api-docs/articles/api-products), [Resources](https://developers.controlata.com/hc/api-docs/articles/api-resources), [Customers](https://developers.controlata.com/hc/api-docs/articles/api-customers), [Sales](https://developers.controlata.com/hc/api-docs/articles/api-orders), [Suppliers](https://developers.controlata.com/hc/api-docs/articles/api-suppliers), [Purchases](https://developers.controlata.com/hc/api-docs/articles/api-purchases), [Production](https://developers.controlata.com/hc/api-docs/articles/api-production), [Write-offs](https://developers.controlata.com/hc/api-docs/articles/api-writeoffs), [Transfers](https://developers.controlata.com/hc/api-docs/articles/api-transfers), [Audits](https://developers.controlata.com/hc/api-docs/articles/api-audits).

Controlata keeps a log of API requests. If a request does not work as expected, contact support and include the method and the time of the request.
