# Create a Batch

**POST** `/batches`

Base URL: `https://api.uat.triple-a.io/api/fiat-payout/v1`

This endpoint allows merchants to prepare (create) a batch on behalf of a sender (merchant's clients) to transfer local currency funds to a recipient.

## Authorization

- oauth2 (http, bearer)

## Body

Content type: `multipart/form-data`

- `external_id` (string)
  Transfer Reference provided by API caller
- `file` (string<binary>, required)
  The actual file to be uploaded
- `sending_currency` (string<iso-4217-ext>, required)
  Sending Currency which is defined by /currencies.

Example:

```json
{
  "external_id": "string",
  "file": "batch.csv",
  "sending_currency": "BTC"
}
```

## Responses

### 201

Created

- `id` (string<uuid>)
  Batch Identifier
- `external_id` (string)
  Batch Reference provided by API caller
- `status` ("created" | "processing" | "rejected" | "waiting_confirmation" | "confirmed" | "expired" | "partial_submitted" | "submitted" | "partial_completed" | "completed")
  Batch Status
- `reason` (object[])
  - `csvLine` (number)
    CSV line number for the Batch error
  - `message` (object[])
    The error message
    - `message` (string)
    - `errors` (object[])
      - `errorCode` (string)
      - `message` (string)
- `payment` (object)
  Payment
  - `id` (string<uuid>)
    Payment Identifier
  - `status` (string)
    Payment status
  - `reason` (string<uuid>)
    Failed/Declined Reason
  - `url` (string)
    CDN of payment page
  - `crypto_address` (string)
    Cryptocurrency token address
  - `crypto_currency` (string)
    Cryptocurrency value
  - `crypto_network` (string)
    The blockchain to use to pay
  - `expires_at` (string<date-time>)
    The expiration of the address
  - `card_issuer_country` (string)
    The issuer country of card if payment is made via card
  - `reference_number` (string)
    Payment reference number
  - `iban` (string)
    IBAN
- `total_transfers` (number)
  Total number of transfers in the batch
- `total_sending_amount` (object[])
  - `currency` (string<iso-4217>)
    The currency
  - `amount` (number<double>)
    The total amount for the currency
- `total_receiving_amount` (object[])
  - `currency` (string<iso-4217>)
    The currency
  - `amount` (number<double>)
    The total amount for the currency
- `total_fees` (object[])
  - `currency` (string<iso-4217>)
    The currency
  - `amount` (number<double>)
    The total amount for the currency
- `expires_at` (string<date-time>)
  Creation Timestamp
- `created_at` (string<date-time>)
  Creation Timestamp
- `updated_at` (string<date-time>)
  Update Timestamp

Example:

```json
{
  "id": "00000000-0000-0000-0000-000000000000",
  "external_id": "string",
  "status": "created",
  "reason": [
    {
      "csvLine": 0,
      "message": [
        {
          "message": "string",
          "errors": [
            {
              "errorCode": null,
              "message": null
            }
          ]
        }
      ]
    }
  ],
  "payment": {
    "id": "00000000-0000-0000-0000-000000000000",
    "status": "string",
    "reason": "00000000-0000-0000-0000-000000000000",
    "url": "string",
    "crypto_address": "string",
    "crypto_currency": "string",
    "crypto_network": "string",
    "expires_at": "1970-01-01T00:00:00.000Z",
    "card_issuer_country": "USA",
    "reference_number": "MFB-870989-FPP",
    "iban": "FR7630006000011234567890189"
  },
  "total_transfers": 0,
  "total_sending_amount": [
    {
      "currency": "string",
      "amount": 0.001
    }
  ],
  "total_receiving_amount": [
    {
      "currency": "string",
      "amount": 0.001
    }
  ],
  "total_fees": [
    {
      "currency": "string",
      "amount": 0.001
    }
  ],
  "expires_at": "1970-01-01T00:00:00.000Z",
  "created_at": "1970-01-01T00:00:00.000Z",
  "updated_at": "1970-01-01T00:00:00.000Z"
}
```

### 400

Error defines errors may be returned from the system.

- `message` (string)
- `errors` (object[])
  - `errorCode` (string)
  - `message` (string)

Example:

```json
{
  "message": "string",
  "errors": [
    {
      "errorCode": "string",
      "message": "string"
    }
  ]
}
```

### 404

Error defines errors may be returned from the system.

- `message` (string)
- `errors` (object[])
  - `errorCode` (string)
  - `message` (string)

Example:

```json
{
  "message": "string",
  "errors": [
    {
      "errorCode": "string",
      "message": "string"
    }
  ]
}
```

### 409

Error defines errors may be returned from the system.

- `message` (string)
- `errors` (object[])
  - `errorCode` (string)
  - `message` (string)

Example:

```json
{
  "message": "string",
  "errors": [
    {
      "errorCode": "string",
      "message": "string"
    }
  ]
}
```

### 500

Error defines errors may be returned from the system.

- `message` (string)
- `errors` (object[])
  - `errorCode` (string)
  - `message` (string)

Example:

```json
{
  "message": "string",
  "errors": [
    {
      "errorCode": "string",
      "message": "string"
    }
  ]
}
```