# POST /api/v1/credit/card-settlements

> Ingest cleared card settlements

- **Tag:** credit
- **Operation ID:** `ingest_card_settlements_api_v1_credit_card_settlements_post`

## Description

Push settled card transactions. Settlements only, never authorisations. Idempotent on the settlement ID, so re-pushing a batch reports duplicates rather than double-counting. A negative amount is a refund.

## Authentication

Bearer token in `Authorization` header.
Required header: `x-business-id: <business uuid>`.

## Request body

Schema: `CardSettlementIngestRequest`

- `credit_line_id` (string) — Target line. Omit when using external_line_id.
- `external_line_id` (string)
- `settlements` (array · CardSettlementIngestItem · required) → `CardSettlementIngestItem`
  - `external_settlement_id` (string · required) — Issuer settlement ID. The idempotency key.
  - `settled_on` (string · date · required) — Clearing date. Assigns the settlement to a cycle (§10.5).
  - `amount_cents` (integer · required) — Signed: positive is a purchase, negative a refund.
  - `merchant_name` (string)
  - `card_last_four` (string)
  - `merchant_category_code` (string)
  - `description` (string)

## Responses

### 201 — Successful Response

Schema: `SuccessEnvelope_CardSettlementIngestResponse_`

- `success` (boolean)
- `message` (string)
- `code` (string)
- `data` (CardSettlementIngestResponse)

### 400 — Bad Request - Invalid input

### 401 — Unauthorized - Authentication required

### 403 — Forbidden - Insufficient permissions

### 404 — Not Found - Resource does not exist

### 422 — Validation Error

Schema: `HTTPValidationError`

- `detail` (array · ValidationError) → `ValidationError`
  - `loc` (array · string | integer · required)
  - `msg` (string · required)
  - `type` (string · required)
  - `input` (object)
  - `ctx` (object)

## Code samples

### cURL

```bash
curl -X POST 'https://api.ondayzero.com/api/v1/credit/card-settlements' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "settlements": []
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/credit/card-settlements', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "settlements": []
}),
});
const data = await response.json();
```

### Python

```python
import httpx

headers = {
    "Authorization": "Bearer dz_your_token",
    "x-business-id": "YOUR_BUSINESS_ID",
}

payload = {
  "settlements": []
}

response = httpx.post("https://api.ondayzero.com/api/v1/credit/card-settlements", headers=headers, json=payload)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/credit/ingest-card-settlements
- OpenAPI slice: https://www.ondayzero.com/docs/reference/credit/ingest-card-settlements/openapi.json
- Other endpoints in **credit**: https://www.ondayzero.com/docs/reference/credit
