---
title: "Создать подключение к банку"
method: POST
path: "/api/v1/finance/connectors"
tags: ["Finance connectors"]
---

# Создать подключение к банку

`POST /api/v1/finance/connectors`

## Request

- Base URL: `https://erp.akeda.ru`
- URL: `https://erp.akeda.ru/api/v1/finance/connectors`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-Api-Key`
  - OAuth 2
    - Authorization code: `https://erp.akeda.ru/oauth2/authorize`
    - Token URL: `https://erp.akeda.ru/oauth2/token` scopes: `akeda:delegate`

Для token и client_credentials секрет вводится только напрямую в защищённой форме.
OAuth-провайдеры запускаются отдельной ручкой consent. Банковский токен нельзя
передавать через задачу, чат или агентский вызов: MCP-инструмент этой операции
банк не зовёт и отдаёт человеку ссылку на экран «Банки и разрешения».

## Headers

- `X-Tenant` string, required

## Request body

- FinanceConnectorCreate
  - `auto_accounts_since` string: ГГГГ-ММ-ДД: дата учёта новых счетов; пусто — ручная привязка. Существующие карточки не меняются
  - `provider` 'modulbank' | 'tbank' | 'tochka' | 'alfa' | 'sber' | 'directbank', required
  - `display_name` string
  - `company_name` string
  - `company` string, uuid
  - `credential` string: Банковский токен либо JSON с client_id/client_secret; никогда не передаётся через MCP
  - `import_depth_days` integer
  - `overlap_days` integer

## Response `201`

Созданное подключение без секрета

- FinanceConnector
  - `auto_accounts_since` string: ГГГГ-ММ-ДД: дата учёта новых счетов; пусто — ручная привязка. Существующие карточки не меняются
  - `id` string, uuid, required
  - `provider` 'modulbank' | 'tbank' | 'tochka' | 'alfa' | 'sber' | 'directbank', required
  - `provider_name` string, required
  - `display_name` string, required
  - `company_name` string, required
  - `company` string, uuid, nullable, required
  - `company_directory_name` string, required
  - `company_inn` string, required
  - `status` 'connected' | 'paused' | 'error' | 'reauth_required' | 'awaiting_consent' | 'disconnected', required
  - `status_name` string, required
  - `auth_kind` 'token' | 'client_credentials' | 'oauth' | 'oauth_mtls' | 'directbank', required
  - `has_credentials` boolean, required: Только признак; сохранённый секрет никогда не возвращается
  - `mtls_certificate` FinanceConnectorMTLSStatus, required
    - `configured` boolean, required
    - `expires_at` string, date-time, nullable
    - `warning` string
  - `external_customer_id` string, required
  - `granted_by_user_id` integer, nullable, required
  - `granted_by_name` string, required
  - `granted_at` string, date-time, nullable, required
  - `import_depth_days` integer, required
  - `overlap_days` integer, required
  - `payments_disabled` boolean, required: Человек выключил платежи через подключение — только выписки
  - `payments_supported` boolean, required: Банк подключения принимает платёжные поручения по API
  - `app_secret_expires_at` string, date-time, nullable: До какого момента действует ключ приложения банка (client_secret); Акеда меняет его сама за неделю до срока. Пусто — срок неизвестен или у банка такого ключа нет
  - `health` FinanceConnectorHealth: Единый статус подключения банка (ERP-2404): одно значение для списка банков, выписки и «Юрлиц и счетов».
    - `state` 'ok' | 'expiring' | 'action' | 'off', required: ok — работает; expiring — ключ или сертификат истекает в ближайшие 7 дней; action — не работает, нужен человек; off — отключено человеком
    - `reason` string: Машинная причина: код ошибки банка finance.connector.* или app_secret_expiring, app_secret_expired, certificate_expiring, certificate_expired, reauth_required, awaiting_consent
    - `expires_at` string, date-time: Срок ключа или сертификата, о котором предупреждение
  - `last_sync_at` string, date-time, nullable, required
  - `last_sync_status` string, required
  - `last_error` string, required: The provider's technical reply, verbatim — material for an investigation, not a message for the cabinet screen: it may carry machine keys such as "invalid_client". The portal operator reads it in full on the bank connectors page, while the cabinet card renders last_error_code instead. Empty when the failure was ours: an internal cause never reaches this field, it is logged and named by last_error_code instead.
  - `last_error_code` '' | 'finance.connector.internal' | 'finance.connector.provider_unauthorized' | 'finance.connector.provider_rate_limited' | 'finance.connector.provider_unavailable' | 'finance.connector.provider_declined' | 'finance.connector.consent_required' | 'finance.connector.secret_unreadable', required: Machine code of the last failure, translated by the client. Present because the text is stored: it is written in whatever locale the background sync happened to run in, and only a finite code can be rendered in the reader's language.
  - `accounts_total` integer, required
  - `accounts_linked` integer, required
  - `can_delete` boolean, required: True only for an abandoned connection attempt: no accounts returned by the bank and no sync run at all. Everything else is the origin trail of the imported operations and is never deleted — both links cascade — so such a connection is disconnected instead.
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required

## Other responses

- `400`: Некорректный запрос или нарушение бизнес-правила
- `401`: Сессия, ключ или кабинет не подтверждены
- `403`: Текущая роль не имеет требуемого права
- `409`: Владельца нельзя однозначно сопоставить
- `503`: Внешний банк, справочник или контур подключений временно недоступен

## Changes

- **2026-11-09** `37b1ce2addd4`: 1 info
  - added the optional property `health` to the response with the `201` status
- **2026-11-08** `ebf19014494a`: 2 info
  - added the new optional request property `auto_accounts_since`
  - added the optional property `auto_accounts_since` to the response with the `201` status
- **2026-11-06** `83012721f791`: 1 warning
  - added the new `finance.connector.secret_unreadable` enum value to the `last_error_code` response property for the response status `201`
- **2026-10-31** `96a745afb64c`: 1 warning
  - added the new `finance.connector.provider_unavailable` enum value to the `last_error_code` response property for the response status `201`
- **2026-10-27** `79e29a13b6ba`: 1 info
  - added the optional property `app_secret_expires_at` to the response with the `201` status

[Operation history](https://skmtc.dev/akeda/apis/akeda-erp-client-api/changes/api/v1/finance/connectors/post.md)

---

[API](https://skmtc.dev/akeda/apis/akeda-erp-client-api.md) - [All operations](https://skmtc.dev/akeda/apis/akeda-erp-client-api/llms.txt) - [OpenAPI document](https://skmtc.dev/akeda/apis/akeda-erp-client-api/revisions/084f7bbc939c?raw)
