# EZ Rails API — OpenAPI Reference (v1)

> Payment and banking rails for Argentina and Chile: connect accounts, receive transfers, declare payment expectations, reconcile them automatically and (optionally) issue the matching electronic invoice. All amounts are decimal strings with exactly two decimals; never send floats.

- **Base URL (Production):** `https://api.ez-rails.huggian.com/rails`
- **Guide:** https://huggian.com/ez-rails/docs (Markdown: https://huggian.com/ez-rails/docs.md)
- **Interactive Reference:** https://huggian.com/ez-rails/docs/reference
- **OpenAPI 3.1 JSON:** https://huggian.com/ez-rails/docs/openapi.json

## Authentication

- **ApiKey** (`apiKey`, header `X-API-Key`): ezr_live_* keys operate on live data, ezr_test_* (sandbox plan) keys on sandbox data only; mixing returns 403. Each key carries scopes (rails:read, rails:write, rails:webhooks) and the tenants it may act on. Plan limits apply per key: requests per minute and per month (429 rate_limited when exceeded).

## Shared Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `Idempotency-Key` | header | No | string | Retry-safe creation. The first response is stored and replayed for the same key and payload. Reusing a key with a different payload answers 409 idempotency_key_conflict; a concurrent duplicate answers 409 idempotency_key_in_flight (retry shortly). |
| `X-Source-App` | header | No | string | Your application name, recorded on created resources. Defaults to the key owner. |

## Standard Error Responses

| Key | Description | Schema |
|---|---|---|
| `E400` | Malformed request or invalid header | `Error` |
| `E401` | Missing or invalid X-API-Key (or provider signature) | `Error` |
| `E403` | Key lacks the required scope, or live/sandbox mismatch | `Error` |
| `E404` | Resource not found or not visible to this key | `Error` |
| `E409` | Conflict (idempotency or state) | `Error` |
| `E422` | Validation failed | `Error` |
| `E429` | Rate limit or monthly quota exceeded | `Error` |
| `E502` | Upstream provider error | `Error` |
| `E503` | Temporarily unavailable | `Error` |
| `E413` | Request body exceeds route size limit | `Error` |

## Health

### `GET /v1/health`

Liveness and database readiness (no API key, never rate limited).

- **Auth:** None (public)

#### Responses

| Status | Description | Schema |
|---|---|---|
| `200` | status ok or degraded | `HealthResponse` |
| `503` | database unreachable | `HealthResponse` |

## Demo

### `POST /v1/demo/match`

Public stateless matching demo (no API key).

Runs the same deterministic matching engine as POST /v1/reconciliations/match without an API key, tenant, storage, or billing usage. Capped at 16 KiB body (413 payload_too_large), 20 movements and 20 expectations (422 demo_limit_exceeded), and 10 requests/minute per client IP (429 rate_limited with Retry-After).

- **Auth:** None (public)

#### Request Body (required)

- Content-Type: `application/json`
- Schema: `StatelessMatchRequest`

```json
{
  "movements": [
    {
      "movementId": "mov-001",
      "direction": "credit",
      "amount": "15000.00",
      "currency": "ARS",
      "externalReference": "ORD-2026-0001",
      "occurredAt": "2026-11-23T15:05:00Z"
    }
  ],
  "expectations": [
    {
      "expectationId": "exp-001",
      "expectedAmount": "15000.00",
      "amountTolerance": "0.00",
      "currency": "ARS",
      "expectedReference": "ORD-2026-0001",
      "createdAt": "2026-11-23T15:00:00Z"
    }
  ]
}
```

#### Responses

| Status | Description | Schema |
|---|---|---|
| `200` | Match report | `MatchBatchReport` |
| `400` | Malformed request or invalid header | `Error` |
| `413` | Request body exceeds route size limit | `Error` |
| `422` | Validation failed | `Error` |
| `429` | Rate limit or monthly quota exceeded | `Error` |

## Accounts

### `GET /v1/accounts`

List the tenant rail accounts (credentials are never returned; account numbers are masked).

- **Auth:** ApiKey (scope: `rails:read`)

#### Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `X-Source-App` | header | No | string | Your application name, recorded on created resources. Defaults to the key owner. |
| `tenantId` | query | Yes | string (uuid) | Tenant the API key is anchored to (also accepted as tenant_id). A tenant outside the key allowed_tenant_ids answers 404. |

#### Responses

| Status | Description | Schema |
|---|---|---|
| `200` | Accounts | object { data } |
| `400` | Malformed request or invalid header | `Error` |
| `401` | Missing or invalid X-API-Key (or provider signature) | `Error` |
| `403` | Key lacks the required scope, or live/sandbox mismatch | `Error` |
| `404` | Resource not found or not visible to this key | `Error` |
| `409` | Conflict (idempotency or state) | `Error` |
| `422` | Validation failed | `Error` |
| `429` | Rate limit or monthly quota exceeded | `Error` |
| `502` | Upstream provider error | `Error` |
| `503` | Temporarily unavailable | `Error` |

### `POST /v1/accounts`

Create or update a rail account (Mercado Pago, banks, PSPs). Secrets are encrypted at rest and never echoed.

- **Auth:** ApiKey (scope: `rails:write`)

#### Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `X-Source-App` | header | No | string | Your application name, recorded on created resources. Defaults to the key owner. |

#### Request Body (required)

- Content-Type: `application/json`
- Schema: `UpsertRailAccount`

#### Responses

| Status | Description | Schema |
|---|---|---|
| `201` | Account summary | `RailAccountSummary` |
| `400` | Malformed request or invalid header | `Error` |
| `401` | Missing or invalid X-API-Key (or provider signature) | `Error` |
| `403` | Key lacks the required scope, or live/sandbox mismatch | `Error` |
| `404` | Resource not found or not visible to this key | `Error` |
| `409` | Conflict (idempotency or state) | `Error` |
| `422` | Validation failed | `Error` |
| `429` | Rate limit or monthly quota exceeded | `Error` |
| `502` | Upstream provider error | `Error` |
| `503` | Temporarily unavailable | `Error` |

### `POST /v1/accounts/{account_id}/verify-connection`

Probe the provider credentials of an account.

- **Auth:** ApiKey (scope: `rails:write`)

#### Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `X-Source-App` | header | No | string | Your application name, recorded on created resources. Defaults to the key owner. |
| `account_id` | path | Yes | string (uuid) |  |

#### Request Body (required)

- Content-Type: `application/json`
- Schema: `VerifyConnectionRequest`

#### Responses

| Status | Description | Schema |
|---|---|---|
| `200` | Connection verification result | `VerifyConnectionResponse` |
| `400` | Malformed request or invalid header | `Error` |
| `401` | Missing or invalid X-API-Key (or provider signature) | `Error` |
| `403` | Key lacks the required scope, or live/sandbox mismatch | `Error` |
| `404` | Resource not found or not visible to this key | `Error` |
| `409` | Conflict (idempotency or state) | `Error` |
| `422` | Validation failed | `Error` |
| `429` | Rate limit or monthly quota exceeded | `Error` |
| `502` | Upstream provider error | `Error` |
| `503` | Temporarily unavailable | `Error` |

### `POST /v1/accounts/{account_id}/auto-listen`

Enable or disable automatic polling of incoming transfers.

- **Auth:** ApiKey (scope: `rails:write`)

#### Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `X-Source-App` | header | No | string | Your application name, recorded on created resources. Defaults to the key owner. |
| `account_id` | path | Yes | string (uuid) |  |

#### Request Body (required)

- Content-Type: `application/json`
- Schema: `SetAccountAutoListenRequest`

#### Responses

| Status | Description | Schema |
|---|---|---|
| `200` | Updated account summary | `RailAccountSummary` |
| `400` | Malformed request or invalid header | `Error` |
| `401` | Missing or invalid X-API-Key (or provider signature) | `Error` |
| `403` | Key lacks the required scope, or live/sandbox mismatch | `Error` |
| `404` | Resource not found or not visible to this key | `Error` |
| `409` | Conflict (idempotency or state) | `Error` |
| `422` | Validation failed | `Error` |
| `429` | Rate limit or monthly quota exceeded | `Error` |
| `502` | Upstream provider error | `Error` |
| `503` | Temporarily unavailable | `Error` |

### `POST /v1/accounts/{account_id}/sync-now`

Poll the provider for new movements immediately.

- **Auth:** ApiKey (scope: `rails:write`)

#### Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `X-Source-App` | header | No | string | Your application name, recorded on created resources. Defaults to the key owner. |
| `account_id` | path | Yes | string (uuid) |  |

#### Request Body (required)

- Content-Type: `application/json`
- Schema: `SyncAccountNowRequest`

#### Responses

| Status | Description | Schema |
|---|---|---|
| `200` | Sync result | `SyncAccountNowResponse` |
| `400` | Malformed request or invalid header | `Error` |
| `401` | Missing or invalid X-API-Key (or provider signature) | `Error` |
| `403` | Key lacks the required scope, or live/sandbox mismatch | `Error` |
| `404` | Resource not found or not visible to this key | `Error` |
| `409` | Conflict (idempotency or state) | `Error` |
| `422` | Validation failed | `Error` |
| `429` | Rate limit or monthly quota exceeded | `Error` |
| `502` | Upstream provider error | `Error` |
| `503` | Temporarily unavailable | `Error` |

### `POST /v1/accounts/{account_id}/import-statement`

Import a bank statement (CSV/text) for a statement_cbu account. Body limit 4 MiB.

- **Auth:** ApiKey (scope: `rails:write`)

#### Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `X-Source-App` | header | No | string | Your application name, recorded on created resources. Defaults to the key owner. |
| `account_id` | path | Yes | string (uuid) |  |

#### Request Body (required)

- Content-Type: `application/json`
- Schema: `ImportStatementRequest`

#### Responses

| Status | Description | Schema |
|---|---|---|
| `200` | Statement imported (or idempotent replay) | `ImportStatementResponse` |
| `201` | Statement imported | `ImportStatementResponse` |
| `400` | Malformed request or invalid header | `Error` |
| `401` | Missing or invalid X-API-Key (or provider signature) | `Error` |
| `403` | Key lacks the required scope, or live/sandbox mismatch | `Error` |
| `404` | Resource not found or not visible to this key | `Error` |
| `409` | Conflict (idempotency or state) | `Error` |
| `422` | Validation failed | `Error` |
| `429` | Rate limit or monthly quota exceeded | `Error` |
| `502` | Upstream provider error | `Error` |
| `503` | Temporarily unavailable | `Error` |

## CBU / CVU

### `POST /v1/cbu-cvu/inspect`

Validate a CBU/CVU/alias and identify its bank or PSP (no network call to the bank).

- **Auth:** ApiKey (scope: `rails:read`)

#### Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `X-Source-App` | header | No | string | Your application name, recorded on created resources. Defaults to the key owner. |

#### Request Body (required)

- Content-Type: `application/json`
- Schema: `InspectCbuCvuRequest`

#### Responses

| Status | Description | Schema |
|---|---|---|
| `200` | CBU/CVU inspection | `ArAccountInspection` |
| `400` | Malformed request or invalid header | `Error` |
| `401` | Missing or invalid X-API-Key (or provider signature) | `Error` |
| `403` | Key lacks the required scope, or live/sandbox mismatch | `Error` |
| `404` | Resource not found or not visible to this key | `Error` |
| `409` | Conflict (idempotency or state) | `Error` |
| `422` | Validation failed | `Error` |
| `429` | Rate limit or monthly quota exceeded | `Error` |
| `502` | Upstream provider error | `Error` |
| `503` | Temporarily unavailable | `Error` |

### `GET /v1/cbu-ownership-challenges`

List CBU ownership challenges.

- **Auth:** ApiKey (scope: `rails:read`)

#### Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `X-Source-App` | header | No | string | Your application name, recorded on created resources. Defaults to the key owner. |
| `tenantId` | query | Yes | string (uuid) | Tenant the API key is anchored to (also accepted as tenant_id). A tenant outside the key allowed_tenant_ids answers 404. |
| `limit` | query | No | integer | Maximum rows (default 100). |

#### Responses

| Status | Description | Schema |
|---|---|---|
| `200` | Challenges | object { data } |
| `400` | Malformed request or invalid header | `Error` |
| `401` | Missing or invalid X-API-Key (or provider signature) | `Error` |
| `403` | Key lacks the required scope, or live/sandbox mismatch | `Error` |
| `404` | Resource not found or not visible to this key | `Error` |
| `409` | Conflict (idempotency or state) | `Error` |
| `422` | Validation failed | `Error` |
| `429` | Rate limit or monthly quota exceeded | `Error` |
| `502` | Upstream provider error | `Error` |
| `503` | Temporarily unavailable | `Error` |

### `POST /v1/cbu-ownership-challenges`

Start a micro-deposit ownership challenge for a CBU.

- **Auth:** ApiKey (scope: `rails:write`)

#### Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `X-Source-App` | header | No | string | Your application name, recorded on created resources. Defaults to the key owner. |
| `Idempotency-Key` | header | No | string | Retry-safe creation. The first response is stored and replayed for the same key and payload. Reusing a key with a different payload answers 409 idempotency_key_conflict; a concurrent duplicate answers 409 idempotency_key_in_flight (retry shortly). |

#### Request Body (required)

- Content-Type: `application/json`
- Schema: `CreateCbuChallengeRequest`

#### Responses

| Status | Description | Schema |
|---|---|---|
| `200` | Idempotent replay | `CbuOwnershipChallengeSummary` |
| `201` | Challenge created | `CbuOwnershipChallengeSummary` |
| `400` | Malformed request or invalid header | `Error` |
| `401` | Missing or invalid X-API-Key (or provider signature) | `Error` |
| `403` | Key lacks the required scope, or live/sandbox mismatch | `Error` |
| `404` | Resource not found or not visible to this key | `Error` |
| `409` | Conflict (idempotency or state) | `Error` |
| `422` | Validation failed | `Error` |
| `429` | Rate limit or monthly quota exceeded | `Error` |
| `502` | Upstream provider error | `Error` |
| `503` | Temporarily unavailable | `Error` |

### `GET /v1/cbu-ownership-challenges/{challenge_id}`

Read one ownership challenge.

- **Auth:** ApiKey (scope: `rails:read`)

#### Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `X-Source-App` | header | No | string | Your application name, recorded on created resources. Defaults to the key owner. |
| `challenge_id` | path | Yes | string (uuid) |  |
| `tenantId` | query | Yes | string (uuid) | Tenant the API key is anchored to (also accepted as tenant_id). A tenant outside the key allowed_tenant_ids answers 404. |

#### Responses

| Status | Description | Schema |
|---|---|---|
| `200` | Challenge | `CbuOwnershipChallengeSummary` |
| `400` | Malformed request or invalid header | `Error` |
| `401` | Missing or invalid X-API-Key (or provider signature) | `Error` |
| `403` | Key lacks the required scope, or live/sandbox mismatch | `Error` |
| `404` | Resource not found or not visible to this key | `Error` |
| `409` | Conflict (idempotency or state) | `Error` |
| `422` | Validation failed | `Error` |
| `429` | Rate limit or monthly quota exceeded | `Error` |
| `502` | Upstream provider error | `Error` |
| `503` | Temporarily unavailable | `Error` |

## Virtual CVUs

### `GET /v1/virtual-cvus`

List virtual CVUs.

- **Auth:** ApiKey (scope: `rails:read`)

#### Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `X-Source-App` | header | No | string | Your application name, recorded on created resources. Defaults to the key owner. |
| `tenantId` | query | Yes | string (uuid) | Tenant the API key is anchored to (also accepted as tenant_id). A tenant outside the key allowed_tenant_ids answers 404. |
| `limit` | query | No | integer | Maximum rows (default 100). |

#### Responses

| Status | Description | Schema |
|---|---|---|
| `200` | Virtual CVUs | object { data } |
| `400` | Malformed request or invalid header | `Error` |
| `401` | Missing or invalid X-API-Key (or provider signature) | `Error` |
| `403` | Key lacks the required scope, or live/sandbox mismatch | `Error` |
| `404` | Resource not found or not visible to this key | `Error` |
| `409` | Conflict (idempotency or state) | `Error` |
| `422` | Validation failed | `Error` |
| `429` | Rate limit or monthly quota exceeded | `Error` |
| `502` | Upstream provider error | `Error` |
| `503` | Temporarily unavailable | `Error` |

### `POST /v1/virtual-cvus`

Provision a virtual CVU for collecting transfers.

- **Auth:** ApiKey (scope: `rails:write`)

#### Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `X-Source-App` | header | No | string | Your application name, recorded on created resources. Defaults to the key owner. |
| `Idempotency-Key` | header | No | string | Retry-safe creation. The first response is stored and replayed for the same key and payload. Reusing a key with a different payload answers 409 idempotency_key_conflict; a concurrent duplicate answers 409 idempotency_key_in_flight (retry shortly). |

#### Request Body (required)

- Content-Type: `application/json`
- Schema: `ProvisionVirtualCvuRequest`

#### Responses

| Status | Description | Schema |
|---|---|---|
| `200` | Idempotent replay | `ProvisionedVirtualCvuResponse` |
| `201` | Provisioned | `ProvisionedVirtualCvuResponse` |
| `400` | Malformed request or invalid header | `Error` |
| `401` | Missing or invalid X-API-Key (or provider signature) | `Error` |
| `403` | Key lacks the required scope, or live/sandbox mismatch | `Error` |
| `404` | Resource not found or not visible to this key | `Error` |
| `409` | Conflict (idempotency or state) | `Error` |
| `422` | Validation failed | `Error` |
| `429` | Rate limit or monthly quota exceeded | `Error` |
| `502` | Upstream provider error | `Error` |
| `503` | Temporarily unavailable | `Error` |

### `GET /v1/virtual-cvus/sweeps`

List sweep payouts from virtual CVUs.

- **Auth:** ApiKey (scope: `rails:read`)

#### Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `X-Source-App` | header | No | string | Your application name, recorded on created resources. Defaults to the key owner. |
| `tenantId` | query | Yes | string (uuid) | Tenant the API key is anchored to (also accepted as tenant_id). A tenant outside the key allowed_tenant_ids answers 404. |
| `limit` | query | No | integer | Maximum rows (default 100). |

#### Responses

| Status | Description | Schema |
|---|---|---|
| `200` | Sweeps | object { data } |
| `400` | Malformed request or invalid header | `Error` |
| `401` | Missing or invalid X-API-Key (or provider signature) | `Error` |
| `403` | Key lacks the required scope, or live/sandbox mismatch | `Error` |
| `404` | Resource not found or not visible to this key | `Error` |
| `409` | Conflict (idempotency or state) | `Error` |
| `422` | Validation failed | `Error` |
| `429` | Rate limit or monthly quota exceeded | `Error` |
| `502` | Upstream provider error | `Error` |
| `503` | Temporarily unavailable | `Error` |

### `GET /v1/virtual-cvus/{cvu_id}/payment-instructions`

Payment instructions to show a payer.

- **Auth:** ApiKey (scope: `rails:read`)

#### Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `X-Source-App` | header | No | string | Your application name, recorded on created resources. Defaults to the key owner. |
| `cvu_id` | path | Yes | string (uuid) |  |
| `tenantId` | query | Yes | string (uuid) | Tenant the API key is anchored to (also accepted as tenant_id). A tenant outside the key allowed_tenant_ids answers 404. |

#### Responses

| Status | Description | Schema |
|---|---|---|
| `200` | Payment instructions | `VirtualCvuPaymentInstructionsResponse` |
| `400` | Malformed request or invalid header | `Error` |
| `401` | Missing or invalid X-API-Key (or provider signature) | `Error` |
| `403` | Key lacks the required scope, or live/sandbox mismatch | `Error` |
| `404` | Resource not found or not visible to this key | `Error` |
| `409` | Conflict (idempotency or state) | `Error` |
| `422` | Validation failed | `Error` |
| `429` | Rate limit or monthly quota exceeded | `Error` |
| `502` | Upstream provider error | `Error` |
| `503` | Temporarily unavailable | `Error` |

## Expectations

### `GET /v1/expectations`

List payment expectations.

- **Auth:** ApiKey (scope: `rails:read`)

#### Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `X-Source-App` | header | No | string | Your application name, recorded on created resources. Defaults to the key owner. |
| `tenantId` | query | Yes | string (uuid) | Tenant the API key is anchored to (also accepted as tenant_id). A tenant outside the key allowed_tenant_ids answers 404. |
| `status` | query | No | string | open \| reconciled \| expired \| cancelled |
| `limit` | query | No | integer | Maximum rows (default 100). |

#### Responses

| Status | Description | Schema |
|---|---|---|
| `200` | Expectations | object { data } |
| `400` | Malformed request or invalid header | `Error` |
| `401` | Missing or invalid X-API-Key (or provider signature) | `Error` |
| `403` | Key lacks the required scope, or live/sandbox mismatch | `Error` |
| `404` | Resource not found or not visible to this key | `Error` |
| `409` | Conflict (idempotency or state) | `Error` |
| `422` | Validation failed | `Error` |
| `429` | Rate limit or monthly quota exceeded | `Error` |
| `502` | Upstream provider error | `Error` |
| `503` | Temporarily unavailable | `Error` |

### `POST /v1/expectations`

Declare an expected payment so an incoming transfer reconciles against it (optionally auto-invoicing).

- **Auth:** ApiKey (scope: `rails:write`)

#### Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `X-Source-App` | header | No | string | Your application name, recorded on created resources. Defaults to the key owner. |
| `Idempotency-Key` | header | No | string | Retry-safe creation. The first response is stored and replayed for the same key and payload. Reusing a key with a different payload answers 409 idempotency_key_conflict; a concurrent duplicate answers 409 idempotency_key_in_flight (retry shortly). |

#### Request Body (required)

- Content-Type: `application/json`
- Schema: `CreateExpectation`

#### Responses

| Status | Description | Schema |
|---|---|---|
| `200` | Idempotent replay of the first response | `PaymentExpectation` |
| `201` | Expectation created | `PaymentExpectation` |
| `400` | Malformed request or invalid header | `Error` |
| `401` | Missing or invalid X-API-Key (or provider signature) | `Error` |
| `403` | Key lacks the required scope, or live/sandbox mismatch | `Error` |
| `404` | Resource not found or not visible to this key | `Error` |
| `409` | Conflict (idempotency or state) | `Error` |
| `422` | Validation failed | `Error` |
| `429` | Rate limit or monthly quota exceeded | `Error` |
| `502` | Upstream provider error | `Error` |
| `503` | Temporarily unavailable | `Error` |

## Movements

### `GET /v1/movements`

List received or sent rail movements.

- **Auth:** ApiKey (scope: `rails:read`)

#### Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `X-Source-App` | header | No | string | Your application name, recorded on created resources. Defaults to the key owner. |
| `tenantId` | query | Yes | string (uuid) | Tenant the API key is anchored to (also accepted as tenant_id). A tenant outside the key allowed_tenant_ids answers 404. |
| `limit` | query | No | integer | Maximum rows (default 100). |

#### Responses

| Status | Description | Schema |
|---|---|---|
| `200` | Movements | object { data } |
| `400` | Malformed request or invalid header | `Error` |
| `401` | Missing or invalid X-API-Key (or provider signature) | `Error` |
| `403` | Key lacks the required scope, or live/sandbox mismatch | `Error` |
| `404` | Resource not found or not visible to this key | `Error` |
| `409` | Conflict (idempotency or state) | `Error` |
| `422` | Validation failed | `Error` |
| `429` | Rate limit or monthly quota exceeded | `Error` |
| `502` | Upstream provider error | `Error` |
| `503` | Temporarily unavailable | `Error` |

## Reconciliations

### `GET /v1/reconciliations`

List reconciliations (movement to expectation matches).

- **Auth:** ApiKey (scope: `rails:read`)

#### Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `X-Source-App` | header | No | string | Your application name, recorded on created resources. Defaults to the key owner. |
| `tenantId` | query | Yes | string (uuid) | Tenant the API key is anchored to (also accepted as tenant_id). A tenant outside the key allowed_tenant_ids answers 404. |
| `limit` | query | No | integer | Maximum rows (default 100). |

#### Responses

| Status | Description | Schema |
|---|---|---|
| `200` | Reconciliations | object { data } |
| `400` | Malformed request or invalid header | `Error` |
| `401` | Missing or invalid X-API-Key (or provider signature) | `Error` |
| `403` | Key lacks the required scope, or live/sandbox mismatch | `Error` |
| `404` | Resource not found or not visible to this key | `Error` |
| `409` | Conflict (idempotency or state) | `Error` |
| `422` | Validation failed | `Error` |
| `429` | Rate limit or monthly quota exceeded | `Error` |
| `502` | Upstream provider error | `Error` |
| `503` | Temporarily unavailable | `Error` |

### `POST /v1/reconciliations/match`

Stateless matching: send movements and expectations, get the match report; nothing is stored.

- **Auth:** ApiKey (scope: `rails:write`)

#### Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `X-Source-App` | header | No | string | Your application name, recorded on created resources. Defaults to the key owner. |

#### Request Body (required)

- Content-Type: `application/json`
- Schema: `StatelessMatchRequest`

```json
{
  "movements": [
    {
      "movementId": "mov-001",
      "direction": "credit",
      "amount": "15000.00",
      "currency": "ARS",
      "externalReference": "ORD-2026-0001",
      "occurredAt": "2026-11-23T15:05:00Z"
    }
  ],
  "expectations": [
    {
      "expectationId": "exp-001",
      "expectedAmount": "15000.00",
      "amountTolerance": "0.00",
      "currency": "ARS",
      "expectedReference": "ORD-2026-0001",
      "createdAt": "2026-11-23T15:00:00Z"
    }
  ]
}
```

#### Responses

| Status | Description | Schema |
|---|---|---|
| `200` | Match report | `MatchBatchReport` |
| `400` | Malformed request or invalid header | `Error` |
| `401` | Missing or invalid X-API-Key (or provider signature) | `Error` |
| `403` | Key lacks the required scope, or live/sandbox mismatch | `Error` |
| `404` | Resource not found or not visible to this key | `Error` |
| `409` | Conflict (idempotency or state) | `Error` |
| `422` | Validation failed | `Error` |
| `429` | Rate limit or monthly quota exceeded | `Error` |
| `502` | Upstream provider error | `Error` |
| `503` | Temporarily unavailable | `Error` |

### `GET /v1/pilot/accountant-overview`

Accountant summary of movements and reconciliations.

- **Auth:** ApiKey (scope: `rails:read`)

#### Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `X-Source-App` | header | No | string | Your application name, recorded on created resources. Defaults to the key owner. |
| `tenantId` | query | Yes | string (uuid) | Tenant the API key is anchored to (also accepted as tenant_id). A tenant outside the key allowed_tenant_ids answers 404. |
| `limit` | query | No | integer | Maximum rows (default 100). |

#### Responses

| Status | Description | Schema |
|---|---|---|
| `200` | Accountant overview | `AccountantOverviewResponse` |
| `400` | Malformed request or invalid header | `Error` |
| `401` | Missing or invalid X-API-Key (or provider signature) | `Error` |
| `403` | Key lacks the required scope, or live/sandbox mismatch | `Error` |
| `404` | Resource not found or not visible to this key | `Error` |
| `409` | Conflict (idempotency or state) | `Error` |
| `422` | Validation failed | `Error` |
| `429` | Rate limit or monthly quota exceeded | `Error` |
| `502` | Upstream provider error | `Error` |
| `503` | Temporarily unavailable | `Error` |

## Webhooks

### `GET /v1/webhooks/endpoints`

List your webhook endpoints (secrets are never returned).

- **Auth:** ApiKey (scope: `rails:read`)

#### Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `X-Source-App` | header | No | string | Your application name, recorded on created resources. Defaults to the key owner. |
| `tenantId` | query | Yes | string (uuid) | Tenant the API key is anchored to (also accepted as tenant_id). A tenant outside the key allowed_tenant_ids answers 404. |

#### Responses

| Status | Description | Schema |
|---|---|---|
| `200` | Endpoints | object { data } |
| `400` | Malformed request or invalid header | `Error` |
| `401` | Missing or invalid X-API-Key (or provider signature) | `Error` |
| `403` | Key lacks the required scope, or live/sandbox mismatch | `Error` |
| `404` | Resource not found or not visible to this key | `Error` |
| `409` | Conflict (idempotency or state) | `Error` |
| `422` | Validation failed | `Error` |
| `429` | Rate limit or monthly quota exceeded | `Error` |
| `502` | Upstream provider error | `Error` |
| `503` | Temporarily unavailable | `Error` |

### `POST /v1/webhooks/endpoints`

Register an HTTPS webhook endpoint. Only https on port 443 to public addresses is accepted.

- **Auth:** ApiKey (scope: `rails:webhooks`)

#### Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `X-Source-App` | header | No | string | Your application name, recorded on created resources. Defaults to the key owner. |

#### Request Body (required)

- Content-Type: `application/json`
- Schema: `CreateWebhookEndpoint`

#### Responses

| Status | Description | Schema |
|---|---|---|
| `201` | Endpoint created | `WebhookEndpointSummary` |
| `400` | Malformed request or invalid header | `Error` |
| `401` | Missing or invalid X-API-Key (or provider signature) | `Error` |
| `403` | Key lacks the required scope, or live/sandbox mismatch | `Error` |
| `404` | Resource not found or not visible to this key | `Error` |
| `409` | Conflict (idempotency or state) | `Error` |
| `422` | Validation failed | `Error` |
| `429` | Rate limit or monthly quota exceeded | `Error` |
| `502` | Upstream provider error | `Error` |
| `503` | Temporarily unavailable | `Error` |

### `GET /v1/webhooks/deliveries`

List webhook deliveries and their attempts.

- **Auth:** ApiKey (scope: `rails:read`)

#### Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `X-Source-App` | header | No | string | Your application name, recorded on created resources. Defaults to the key owner. |
| `tenantId` | query | Yes | string (uuid) | Tenant the API key is anchored to (also accepted as tenant_id). A tenant outside the key allowed_tenant_ids answers 404. |
| `status` | query | No | string |  |
| `limit` | query | No | integer | Maximum rows (default 100). |

#### Responses

| Status | Description | Schema |
|---|---|---|
| `200` | Deliveries | object { data } |
| `400` | Malformed request or invalid header | `Error` |
| `401` | Missing or invalid X-API-Key (or provider signature) | `Error` |
| `403` | Key lacks the required scope, or live/sandbox mismatch | `Error` |
| `404` | Resource not found or not visible to this key | `Error` |
| `409` | Conflict (idempotency or state) | `Error` |
| `422` | Validation failed | `Error` |
| `429` | Rate limit or monthly quota exceeded | `Error` |
| `502` | Upstream provider error | `Error` |
| `503` | Temporarily unavailable | `Error` |

### `POST /v1/webhooks/deliveries/{delivery_id}/replay`

Replay a failed or dead-lettered delivery.

- **Auth:** ApiKey (scope: `rails:webhooks`)

#### Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `X-Source-App` | header | No | string | Your application name, recorded on created resources. Defaults to the key owner. |
| `delivery_id` | path | Yes | string (uuid) |  |

#### Request Body (required)

- Content-Type: `application/json`
- Schema: `ReplayWebhookDeliveryRequest`

#### Responses

| Status | Description | Schema |
|---|---|---|
| `200` | Delivery requeued | `WebhookDeliverySummary` |
| `400` | Malformed request or invalid header | `Error` |
| `401` | Missing or invalid X-API-Key (or provider signature) | `Error` |
| `403` | Key lacks the required scope, or live/sandbox mismatch | `Error` |
| `404` | Resource not found or not visible to this key | `Error` |
| `409` | Conflict (idempotency or state) | `Error` |
| `422` | Validation failed | `Error` |
| `429` | Rate limit or monthly quota exceeded | `Error` |
| `502` | Upstream provider error | `Error` |
| `503` | Temporarily unavailable | `Error` |

## Mercado Pago OAuth

### `POST /v1/oauth/mercadopago/authorize-url`

Build the Mercado Pago authorization URL for an account.

- **Auth:** ApiKey (scope: `rails:write`)

#### Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `X-Source-App` | header | No | string | Your application name, recorded on created resources. Defaults to the key owner. |

#### Request Body (required)

- Content-Type: `application/json`
- Schema: `MpOAuthAuthorizeUrlRequest`

#### Responses

| Status | Description | Schema |
|---|---|---|
| `200` | Authorization URL | `MpOAuthAuthorizeUrlResponse` |
| `400` | Malformed request or invalid header | `Error` |
| `401` | Missing or invalid X-API-Key (or provider signature) | `Error` |
| `403` | Key lacks the required scope, or live/sandbox mismatch | `Error` |
| `404` | Resource not found or not visible to this key | `Error` |
| `409` | Conflict (idempotency or state) | `Error` |
| `422` | Validation failed | `Error` |
| `429` | Rate limit or monthly quota exceeded | `Error` |
| `502` | Upstream provider error | `Error` |
| `503` | Temporarily unavailable | `Error` |

### `POST /v1/oauth/mercadopago/exchange`

Exchange the OAuth code returned by Mercado Pago.

- **Auth:** ApiKey (scope: `rails:write`)

#### Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `X-Source-App` | header | No | string | Your application name, recorded on created resources. Defaults to the key owner. |

#### Request Body (required)

- Content-Type: `application/json`
- Schema: `MpOAuthExchangeRequest`

#### Responses

| Status | Description | Schema |
|---|---|---|
| `200` | Connected account summary | `RailAccountSummary` |
| `400` | Malformed request or invalid header | `Error` |
| `401` | Missing or invalid X-API-Key (or provider signature) | `Error` |
| `403` | Key lacks the required scope, or live/sandbox mismatch | `Error` |
| `404` | Resource not found or not visible to this key | `Error` |
| `409` | Conflict (idempotency or state) | `Error` |
| `422` | Validation failed | `Error` |
| `429` | Rate limit or monthly quota exceeded | `Error` |
| `502` | Upstream provider error | `Error` |
| `503` | Temporarily unavailable | `Error` |

## Sandbox

### `POST /v1/sandbox/simulate-transfer`

Sandbox keys only: simulate an incoming transfer and run reconciliation inline.

- **Auth:** ApiKey (scope: `rails:write`)

#### Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `X-Source-App` | header | No | string | Your application name, recorded on created resources. Defaults to the key owner. |

#### Request Body (required)

- Content-Type: `application/json`
- Schema: `SimulateTransfer`

#### Responses

| Status | Description | Schema |
|---|---|---|
| `200` | Simulated and processed inline | `SimulateTransferResponse` |
| `202` | Accepted into sandbox inbox | `SimulateTransferResponse` |
| `400` | Malformed request or invalid header | `Error` |
| `401` | Missing or invalid X-API-Key (or provider signature) | `Error` |
| `403` | Key lacks the required scope, or live/sandbox mismatch | `Error` |
| `404` | Resource not found or not visible to this key | `Error` |
| `409` | Conflict (idempotency or state) | `Error` |
| `422` | Validation failed | `Error` |
| `429` | Rate limit or monthly quota exceeded | `Error` |
| `502` | Upstream provider error | `Error` |
| `503` | Temporarily unavailable | `Error` |

## Inbound provider webhooks

### `POST /v1/inbound/{rail}/{account_id}`

Provider-to-EZ Rails notification URL for an account (configure it in the provider dashboard). Authenticated by the provider signature, not by an API key.

- **Auth:** None (public)

#### Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `rail` | path | Yes | string (`mercadopago`, `paddle`, `stripe`, `stripe_fc`, `bind`, `nave_galicia`, `comafi`, `khipu_cl`, `fintoc_cl`, `sandbox`) |  |
| `account_id` | path | Yes | string (uuid) |  |

#### Responses

| Status | Description | Schema |
|---|---|---|
| `200` | Connectivity test acknowledged | `InboundAcceptResponse` |
| `202` | Accepted into the inbox | `InboundAcceptResponse` |
| `401` | Missing or invalid X-API-Key (or provider signature) | `Error` |
| `429` | Rate limit or monthly quota exceeded | `Error` |

### `POST /v1/inbound/mercadopago-app`

Mercado Pago application-level notification URL (x-signature verified).

- **Auth:** None (public)

#### Responses

| Status | Description | Schema |
|---|---|---|
| `200` | Connectivity test acknowledged | `InboundAcceptResponse` |
| `202` | Accepted into the inbox | `InboundAcceptResponse` |
| `401` | Missing or invalid X-API-Key (or provider signature) | `Error` |

## Webhooks (Outbound Events)

### `POST webhook:event`

Event delivered to your endpoint

EZ Rails POSTs JSON to every active endpoint whose events filter matches. Verify X-Huggian-Signature before trusting the body: compute hex(HMAC-SHA256(secret, timestamp + "." + raw_body)) with the endpoint secret and the X-Huggian-Timestamp header, compare in constant time, and reject timestamps more than 5 minutes away from your clock. During secret rotation X-Huggian-Signature-Secondary carries the signature made with the secondary secret. X-BBX-* headers are legacy duplicates. Deliveries are at-least-once: deduplicate on X-Huggian-Delivery-Id. Answer 2xx within the timeout; anything else is retried with backoff and finally dead-lettered (replayable).

- **Auth:** HMAC signature (see headers below)

#### Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `X-Huggian-Signature` | header | Yes | string |  |
| `X-Huggian-Signature-Secondary` | header | No | string |  |
| `X-Huggian-Timestamp` | header | Yes | string | Unix seconds |
| `X-Huggian-Delivery-Id` | header | Yes | string (uuid) |  |
| `X-Huggian-Event` | header | Yes | string (`transfer.received`, `transfer.reconciled`, `invoice.issued`, `cbu.ownership_verified`, `virtual_cvu.transfer_received`, `virtual_cvu.sweep_settled`) |  |

#### Request Body (required)

- Content-Type: `application/json`
- Schema: object

#### Responses

| Status | Description | Schema |
|---|---|---|
| `200` | Acknowledged | — |

## Schemas

### `Error`

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | string | Yes | Human-readable message; do not branch on it. |
| `code` | string | Yes | Stable machine code: unauthorized, forbidden, not_found, rate_limited, service_unavailable, internal_error, invalid_query, idempotency_key_invalid, idempotency_key_conflict, idempotency_key_in_flight, validation_error, demo_limit_exceeded, payload_too_large, invalid_json, ssrf_blocked, malformed_webhook, unprocessable_event, unsupported_operation, rail_upstream_error, outcome_unknown, too_many_movements, too_many_expectations, candidate_pair_budget_exceeded, invalid_movement_amount, invalid_expectation_amount, invalid_tolerance_amount, invalid_identifier, invalid_match_config, invalid_source_app, invalid_utf8. |
| `not_attempted` | boolean | No | true when the request provably had no side effect, so retrying cannot duplicate anything. |
| `fallback_safe` | boolean | No |  |

### `UpsertRailAccount`

| Field | Type | Required | Description |
|---|---|---|---|
| `tenantId` | string (uuid) | Yes |  |
| `railId` | string (`mercadopago`, `paddle`, `stripe`, `sandbox`, `bind`, `interbanking`, `nave_galicia`, `comafi`, `khipu_cl`, `fintoc_cl`, `stripe_fc`, `statement_cbu`) | Yes |  |
| `environment` | string (`live`, `sandbox`) | No |  |
| `countryCode` | string | No |  |
| `label` | string | Yes |  |
| `isDefault` | boolean | No |  |
| `externalAccountId` | string | No |  |
| `externalPosId` | string | No |  |
| `accessToken` | string | No |  |
| `webhookSecret` | string | No |  |
| `secondaryWebhookSecret` | string | No |  |
| `mtlsCertPem` | string | No |  |
| `mtlsKeyPem` | string | No |  |
| `gatewayMetadata` | object | No |  |
| `status` | string (`active`, `disconnected`, `inactive`) | No |  |

### `CreateExpectation`

| Field | Type | Required | Description |
|---|---|---|---|
| `tenantId` | string (uuid) | Yes |  |
| `environment` | string (`live`, `sandbox`) | No |  |
| `externalOrderId` | string | No |  |
| `expectedAmount` | string | Yes |  |
| `amountTolerance` | string | No |  |
| `currency` | string | Yes |  |
| `expectedReference` | string | No |  |
| `expectedPayerTaxId` | string | No |  |
| `buyerName` | string | No |  |
| `buyerDocTipo` | integer | No |  |
| `buyerDocNro` | integer | No |  |
| `buyerTaxCondition` | string | No |  |
| `autoInvoiceEnabled` | boolean | No |  |
| `fiscalProfileId` | string (uuid) | No |  |
| `fiscalPtoVta` | integer | No |  |
| `expiresAt` | string (date-time) | No |  |
| `invoiceConcepto` | integer (`1`, `2`, `3`) | No |  |
| `invoiceIvaRate` | string | No |  |
| `invoiceDescription` | string | No |  |
| `supersedeOpenByReference` | boolean | No | Default: `false` |

### `CreateWebhookEndpoint`

| Field | Type | Required | Description |
|---|---|---|---|
| `tenantId` | string (uuid) | Yes |  |
| `environment` | string (`live`, `sandbox`) | No |  |
| `url` | string (uri) | Yes |  |
| `secret` | string | Yes |  |
| `secondarySecret` | string | No |  |
| `events` | array<string> | Yes |  |

### `SimulateTransfer`

| Field | Type | Required | Description |
|---|---|---|---|
| `tenantId` | string (uuid) | Yes |  |
| `railAccountId` | string (uuid) | Yes |  |
| `externalMovementId` | string | No |  |
| `amount` | string | Yes |  |
| `currency` | string | Yes |  |
| `externalReference` | string | No |  |
| `payerTaxId` | string | No |  |
| `payerName` | string | No |  |
| `payerCbu` | string | No |  |
| `occurredAt` | string (date-time) | No |  |
| `processInline` | boolean | No | Default: `true` |

### `HealthResponse`

| Field | Type | Required | Description |
|---|---|---|---|
| `status` | string (`ok`, `degraded`, `unhealthy`) | Yes |  |
| `db` | string (`ok`, `down`) | Yes |  |
| `dead_letter_deliveries` | integer | No |  |
| `mp_https_only` | boolean | No |  |

### `MatchMovementCandidate`

| Field | Type | Required | Description |
|---|---|---|---|
| `movementId` | string | Yes |  |
| `direction` | string (`credit`, `debit`) | Yes |  |
| `amount` | string | Yes |  |
| `currency` | string | Yes |  |
| `externalReference` | string \\| null | No |  |
| `payerTaxId` | string \\| null | No |  |
| `payerIsAccountOwner` | boolean \\| null | No |  |
| `occurredAt` | string (date-time) | Yes |  |

### `MatchExpectationCandidate`

| Field | Type | Required | Description |
|---|---|---|---|
| `expectationId` | string | Yes |  |
| `expectedAmount` | string | Yes |  |
| `amountTolerance` | string | No | Default: `"0.00"` |
| `currency` | string | Yes |  |
| `expectedReference` | string \\| null | No |  |
| `expectedPayerTaxId` | string \\| null | No |  |
| `createdAt` | string (date-time) | Yes |  |
| `expiresAt` | string \\| null (date-time) | No |  |

### `StatelessMatchRequest`

| Field | Type | Required | Description |
|---|---|---|---|
| `tenantId` | string \\| null (uuid) | No |  |
| `movements` | array<`MatchMovementCandidate`> | Yes |  |
| `expectations` | array<`MatchExpectationCandidate`> | Yes |  |
| `earlyGraceSecs` | integer \\| null | No |  |

### `MatchReason`

Type: string (`exactReferenceAndAmount`, `exactReferenceWithinTolerance`, `exactTaxIdAndAmount`, `exactTaxIdWithinTolerance`, `exactAmountUniqueInWindow`)

### `MatchedPair`

| Field | Type | Required | Description |
|---|---|---|---|
| `movementId` | string | Yes |  |
| `expectationId` | string | Yes |  |
| `reason` | `MatchReason` | Yes |  |
| `confidenceBps` | integer | Yes |  |
| `amountDelta` | string | Yes |  |

### `AmbiguousMovement`

| Field | Type | Required | Description |
|---|---|---|---|
| `movementId` | string | Yes |  |
| `candidateExpectationIds` | array<string> | Yes |  |

### `MatchBatchReport`

| Field | Type | Required | Description |
|---|---|---|---|
| `matched` | array<`MatchedPair`> | Yes |  |
| `ambiguous` | array<`AmbiguousMovement`> | Yes |  |
| `unmatchedMovementIds` | array<string> | Yes |  |
| `unmatchedExpectationIds` | array<string> | Yes |  |
| `evaluatedPairs` | integer | Yes |  |

### `RailAccountSummary`

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | string (uuid) | Yes |  |
| `tenantId` | string (uuid) | Yes |  |
| `sourceApp` | string | Yes |  |
| `countryCode` | string | Yes |  |
| `railId` | string | Yes |  |
| `environment` | string (`live`, `sandbox`) | Yes |  |
| `label` | string | Yes |  |
| `isDefault` | boolean | Yes |  |
| `externalAccountId` | string \\| null | No |  |
| `externalPosId` | string \\| null | No |  |
| `hasAccessToken` | boolean | Yes |  |
| `hasWebhookSecret` | boolean | Yes |  |
| `hasSecondaryWebhookSecret` | boolean | Yes |  |
| `hasRefreshToken` | boolean | Yes |  |
| `hasMtlsIdentity` | boolean | Yes |  |
| `gatewayMetadata` | object | Yes |  |
| `oauthTokenExpiresAt` | string \\| null (date-time) | No |  |
| `autoListenTransfers` | boolean | Yes |  |
| `lastPolledAt` | string (date-time) | No |  |
| `status` | string (`active`, `disconnected`, `inactive`) | Yes |  |
| `createdAt` | string (date-time) | Yes |  |
| `updatedAt` | string (date-time) | Yes |  |

### `VerifyConnectionRequest`

| Field | Type | Required | Description |
|---|---|---|---|
| `tenantId` | string (uuid) | Yes |  |

### `VerifyConnectionResponse`

| Field | Type | Required | Description |
|---|---|---|---|
| `accountId` | string (uuid) | Yes |  |
| `railId` | string | Yes |  |
| `verified` | boolean | Yes |  |
| `liveApiCapable` | boolean | Yes |  |
| `mode` | string | Yes |  |
| `upstreamAccountId` | string | No |  |
| `matchedExternalAccount` | boolean | No |  |
| `discoveredAccountsCount` | integer | No |  |
| `cbuInspection` | `ArAccountInspection` | No |  |

### `SetAccountAutoListenRequest`

| Field | Type | Required | Description |
|---|---|---|---|
| `tenantId` | string (uuid) | Yes |  |
| `enabled` | boolean | Yes |  |

### `SyncAccountNowRequest`

| Field | Type | Required | Description |
|---|---|---|---|
| `tenantId` | string (uuid) | Yes |  |
| `lookbackMinutes` | integer \\| null | No |  |

### `SyncAccountNowResponse`

| Field | Type | Required | Description |
|---|---|---|---|
| `accountId` | string (uuid) | Yes |  |
| `railId` | string | Yes |  |
| `polledEvents` | integer | Yes |  |
| `processedMovements` | integer | Yes |  |
| `syncedAt` | string (date-time) | Yes |  |

### `StatementFormat`

Type: string (`auto`, `csv`, `brubank_pdf`)

### `ImportStatementRequest`

| Field | Type | Required | Description |
|---|---|---|---|
| `tenantId` | string (uuid) | Yes |  |
| `format` | `StatementFormat` | No |  |
| `contentBase64` | string \\| null | No |  |
| `contentText` | string \\| null | No |  |

### `ImportStatementResponse`

| Field | Type | Required | Description |
|---|---|---|---|
| `accountId` | string (uuid) | Yes |  |
| `detectedFormat` | `StatementFormat` | Yes |  |
| `statementSha256` | string | Yes |  |
| `parsedRows` | integer | Yes |  |
| `enqueuedNew` | integer | Yes |  |
| `duplicateRows` | integer | Yes |  |
| `processedInline` | boolean | Yes |  |

### `InspectCbuCvuRequest`

| Field | Type | Required | Description |
|---|---|---|---|
| `cbuOrCvu` | string | Yes |  |

### `ArAccountInspection`

| Field | Type | Required | Description |
|---|---|---|---|
| `maskedDigits` | string | Yes |  |
| `kind` | string (`bank_cbu`, `psp_cvu`) | Yes |  |
| `entityCode` | string | Yes |  |
| `entityName` | string \\| null | Yes |  |
| `connectionMode` | string (`direct_rail_supported`, `corporate_interbanking_only`, `closed_retail_bank`, `psp_without_direct_adapter`, `unknown_entity`) | Yes |  |
| `directPushWebhooks` | boolean | Yes |  |
| `interbankingCorporatePull` | boolean | Yes |  |
| `pennyOwnershipChallengeSupported` | boolean | Yes |  |
| `statementImportSupported` | boolean | Yes |  |
| `compatibleRails` | array<string> | Yes |  |
| `guidance` | string | Yes |  |

### `CreateCbuChallengeRequest`

| Field | Type | Required | Description |
|---|---|---|---|
| `tenantId` | string (uuid) | Yes |  |
| `environment` | string \\| null (`live`, `sandbox`, `null`) | No |  |
| `cbuOrCvu` | string | Yes |  |
| `expectedOwnerCuit` | string | Yes |  |
| `collectorRailAccountId` | string (uuid) | Yes |  |

### `CbuOwnershipChallengeSummary`

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | string (uuid) | Yes |  |
| `tenantId` | string (uuid) | Yes |  |
| `environment` | string (`live`, `sandbox`) | Yes |  |
| `maskedCbu` | string | Yes |  |
| `entityCode` | string | Yes |  |
| `entityName` | string \\| null | Yes |  |
| `expectedOwnerCuit` | string | Yes |  |
| `collectorRailAccountId` | string (uuid) | Yes |  |
| `challengeAmount` | string | Yes |  |
| `currency` | string | Yes |  |
| `status` | string (`pending`, `verified`, `expired`) | Yes |  |
| `verificationLevel` | string \\| null | Yes |  |
| `cbuCryptographicallyVerified` | boolean | Yes |  |
| `verifiedMovementId` | string \\| null (uuid) | Yes |  |
| `clearingNetworkId` | string \\| null | Yes |  |
| `expiresAt` | string (date-time) | Yes |  |
| `verifiedAt` | string \\| null (date-time) | Yes |  |
| `createdAt` | string (date-time) | Yes |  |

### `ProvisionVirtualCvuRequest`

| Field | Type | Required | Description |
|---|---|---|---|
| `tenantId` | string (uuid) | Yes |  |
| `environment` | string \\| null (`live`, `sandbox`, `null`) | No |  |
| `collectorRailAccountId` | string (uuid) | Yes |  |
| `custodyMode` | string \\| null (`self_collection`, `tenant_direct`, `platform_sponsored`, `null`) | No |  |
| `displayName` | string | Yes |  |
| `desiredAlias` | string \\| null | No |  |
| `externalReference` | string \\| null | No |  |
| `payoutChallengeId` | string \\| null (uuid) | No |  |

### `ProvisionedVirtualCvuResponse`

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | string (uuid) | Yes |  |
| `tenantId` | string (uuid) | Yes |  |
| `environment` | string (`live`, `sandbox`) | Yes |  |
| `collectorRailAccountId` | string (uuid) | Yes |  |
| `railId` | string | Yes |  |
| `custodyMode` | string | Yes |  |
| `externalCvuId` | string | Yes |  |
| `cvu` | string | Yes |  |
| `maskedCvu` | string | Yes |  |
| `alias` | string \\| null | Yes |  |
| `displayName` | string | Yes |  |
| `beneficiaryCuit` | string \\| null | Yes |  |
| `externalReference` | string \\| null | Yes |  |
| `payoutChallengeId` | string \\| null (uuid) | Yes |  |
| `status` | string | Yes |  |
| `createdAt` | string (date-time) | Yes |  |

### `VirtualCvuSummary`

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | string (uuid) | Yes |  |
| `tenantId` | string (uuid) | Yes |  |
| `environment` | string (`live`, `sandbox`) | Yes |  |
| `collectorRailAccountId` | string (uuid) | Yes |  |
| `railId` | string | Yes |  |
| `custodyMode` | string | Yes |  |
| `externalCvuId` | string | Yes |  |
| `maskedCvu` | string | Yes |  |
| `alias` | string \\| null | Yes |  |
| `displayName` | string | Yes |  |
| `externalReference` | string \\| null | Yes |  |
| `payoutChallengeId` | string \\| null (uuid) | Yes |  |
| `status` | string | Yes |  |
| `createdAt` | string (date-time) | Yes |  |
| `updatedAt` | string (date-time) | Yes |  |

### `VirtualCvuPaymentInstructionsResponse`

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | string (uuid) | Yes |  |
| `tenantId` | string (uuid) | Yes |  |
| `cvu` | string | Yes |  |
| `maskedCvu` | string | Yes |  |
| `alias` | string \\| null | Yes |  |
| `displayName` | string | Yes |  |
| `beneficiaryCuit` | string \\| null | Yes |  |
| `externalReference` | string \\| null | Yes |  |
| `status` | string | Yes |  |

### `VirtualCvuSweepPayout`

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | string (uuid) | Yes |  |
| `tenantId` | string (uuid) | Yes |  |
| `environment` | string (`live`, `sandbox`) | Yes |  |
| `virtualCvuId` | string (uuid) | Yes |  |
| `sourceMovementId` | string (uuid) | Yes |  |
| `payoutChallengeId` | string (uuid) | Yes |  |
| `amount` | string | Yes |  |
| `feeAmount` | string | Yes |  |
| `netPayoutAmount` | string | Yes |  |
| `currency` | string | Yes |  |
| `status` | string | Yes |  |
| `providerTransferId` | string \\| null | Yes |  |
| `clearingNetworkId` | string \\| null | Yes |  |
| `idempotencyKey` | string | Yes |  |
| `attempts` | integer | Yes |  |
| `eligibleAt` | string (date-time) | Yes |  |
| `lastError` | string \\| null | Yes |  |
| `createdAt` | string (date-time) | Yes |  |
| `updatedAt` | string (date-time) | Yes |  |

### `PaymentExpectation`

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | string (uuid) | Yes |  |
| `tenantId` | string (uuid) | Yes |  |
| `sourceApp` | string | Yes |  |
| `environment` | string (`live`, `sandbox`) | Yes |  |
| `externalOrderId` | string \\| null | Yes |  |
| `expectedAmount` | string | Yes |  |
| `amountTolerance` | string | Yes |  |
| `currency` | string | Yes |  |
| `expectedReference` | string \\| null | Yes |  |
| `expectedPayerTaxId` | string \\| null | Yes |  |
| `buyerName` | string \\| null | Yes |  |
| `buyerDocTipo` | integer \\| null | Yes |  |
| `buyerDocNro` | integer \\| null | Yes |  |
| `buyerTaxCondition` | string \\| null | Yes |  |
| `autoInvoiceEnabled` | boolean | Yes |  |
| `fiscalProfileId` | string \\| null (uuid) | Yes |  |
| `fiscalPtoVta` | integer \\| null | Yes |  |
| `invoiceConcepto` | integer (`1`, `2`, `3`) | Yes |  |
| `invoiceIvaRate` | string | Yes |  |
| `invoiceDescription` | string \\| null | Yes |  |
| `status` | string (`open`, `reconciled`, `expired`, `cancelled`) | Yes |  |
| `expiresAt` | string \\| null (date-time) | Yes |  |
| `createdAt` | string (date-time) | Yes |  |
| `updatedAt` | string (date-time) | Yes |  |

### `RailMovement`

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | string (uuid) | Yes |  |
| `tenantId` | string (uuid) | Yes |  |
| `railAccountId` | string (uuid) | Yes |  |
| `railId` | string | Yes |  |
| `externalMovementId` | string | Yes |  |
| `direction` | string (`credit`, `debit`) | Yes |  |
| `amount` | string | Yes |  |
| `feeAmount` | string \\| null | Yes |  |
| `netAmount` | string \\| null | Yes |  |
| `currency` | string | Yes |  |
| `externalReference` | string \\| null | Yes |  |
| `payerDocType` | string \\| null | Yes |  |
| `payerDoc` | string \\| null | Yes |  |
| `payerName` | string \\| null | Yes |  |
| `payerIsAccountOwner` | boolean \\| null | Yes |  |
| `clearingNetworkId` | string \\| null | Yes |  |
| `virtualCvuId` | string (uuid) | No |  |
| `occurredAt` | string (date-time) | Yes |  |
| `rawFacts` | object | Yes |  |
| `createdAt` | string (date-time) | Yes |  |

### `RailReconciliation`

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | string (uuid) | Yes |  |
| `tenantId` | string (uuid) | Yes |  |
| `environment` | string (`live`, `sandbox`) | Yes |  |
| `movementId` | string (uuid) | Yes |  |
| `expectationId` | string (uuid) | Yes |  |
| `matchReason` | string | Yes |  |
| `confidenceBps` | integer | Yes |  |
| `amountDelta` | string | Yes |  |
| `autoInvoiceStatus` | string | Yes |  |
| `fiscalIssuanceId` | string \\| null (uuid) | Yes |  |
| `lastError` | string \\| null | Yes |  |
| `createdAt` | string (date-time) | Yes |  |
| `updatedAt` | string (date-time) | Yes |  |

### `AccountantMovementSummary`

| Field | Type | Required | Description |
|---|---|---|---|
| `creditCount` | integer | Yes |  |
| `creditTotalByCurrency` | object | Yes |  |
| `unmatchedCreditCount` | integer | Yes |  |

### `AccountantReconciliationSummary`

| Field | Type | Required | Description |
|---|---|---|---|
| `totalReconciled` | integer | Yes |  |
| `autoInvoicedCount` | integer | Yes |  |
| `outcomeUnknownCount` | integer | Yes |  |

### `AccountantFiscalProfileSummary`

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | string (uuid) | Yes |  |
| `cuit` | string | Yes |  |
| `countryCode` | string | Yes |  |
| `afipEnvironment` | string | Yes |  |
| `taxCondition` | string | Yes |  |
| `arcaEnabled` | boolean | Yes |  |
| `executionMode` | string | Yes |  |
| `certStatus` | string | Yes |  |
| `certNotAfter` | string \\| null (date-time) | Yes |  |

### `AccountantOverviewResponse`

| Field | Type | Required | Description |
|---|---|---|---|
| `tenantId` | string (uuid) | Yes |  |
| `environment` | string (`live`, `sandbox`) | Yes |  |
| `movementSummary` | `AccountantMovementSummary` | Yes |  |
| `reconciliationSummary` | `AccountantReconciliationSummary` | Yes |  |
| `fiscalProfiles` | array<`AccountantFiscalProfileSummary`> | Yes |  |

### `WebhookEndpointSummary`

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | string (uuid) | Yes |  |
| `tenantId` | string \\| null (uuid) | Yes |  |
| `sourceApp` | string | Yes |  |
| `environment` | string (`live`, `sandbox`) | Yes |  |
| `kind` | string | Yes |  |
| `url` | string (uri) | Yes |  |
| `hasSecondarySecret` | boolean | Yes |  |
| `events` | array<string> | Yes |  |
| `isActive` | boolean | Yes |  |
| `createdAt` | string (date-time) | Yes |  |
| `updatedAt` | string (date-time) | Yes |  |

### `WebhookDeliverySummary`

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | string (uuid) | Yes |  |
| `endpointId` | string (uuid) | Yes |  |
| `tenantId` | string \\| null (uuid) | Yes |  |
| `eventType` | string | Yes |  |
| `payload` | object | Yes |  |
| `status` | string (`pending`, `claimed`, `delivered`, `dead_letter`) | Yes |  |
| `attempts` | integer | Yes |  |
| `eligibleAt` | string (date-time) | Yes |  |
| `lastResponseCode` | integer \\| null | Yes |  |
| `lastError` | string \\| null | Yes |  |
| `createdAt` | string (date-time) | Yes |  |
| `updatedAt` | string (date-time) | Yes |  |

### `ReplayWebhookDeliveryRequest`

| Field | Type | Required | Description |
|---|---|---|---|
| `tenantId` | string (uuid) | Yes |  |

### `MpOAuthAuthorizeUrlRequest`

| Field | Type | Required | Description |
|---|---|---|---|
| `tenantId` | string (uuid) | Yes |  |
| `railAccountId` | string (uuid) | Yes |  |
| `redirectUri` | string (uri) | Yes |  |

### `MpOAuthAuthorizeUrlResponse`

| Field | Type | Required | Description |
|---|---|---|---|
| `authorizeUrl` | string (uri) | Yes |  |
| `state` | string | Yes |  |
| `expiresAt` | string (date-time) | Yes |  |

### `MpOAuthExchangeRequest`

| Field | Type | Required | Description |
|---|---|---|---|
| `tenantId` | string (uuid) | Yes |  |
| `state` | string | Yes |  |
| `code` | string | Yes |  |

### `SimulateTransferResponse`

| Field | Type | Required | Description |
|---|---|---|---|
| `accepted` | boolean | Yes |  |
| `duplicate` | boolean | Yes |  |
| `inboxId` | string \\| null (uuid) | Yes |  |
| `processedInline` | boolean | Yes |  |
| `movementId` | string \\| null (uuid) | Yes |  |
| `reconciliationId` | string \\| null (uuid) | Yes |  |
| `autoInvoiceStatus` | string \\| null | Yes |  |
| `fiscalIssuanceId` | string \\| null (uuid) | Yes |  |

### `InboundAcceptResponse`

| Field | Type | Required | Description |
|---|---|---|---|
| `accepted` | boolean | Yes |  |
| `duplicate` | boolean | Yes |  |
| `inboxId` | string (uuid) | No |  |
| `connectivityTest` | boolean | No |  |
