> This page is for BaaS.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://en.docs.api.corpx.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://en.docs.api.corpx.com/_mcp/server.

# Create a Boleto Charge batch

POST https://tenant.api.corpx.com/v1/accounts/{accountId}/boleto/charge/batches
Content-Type: application/json

Creates an empty `DRAFT` batch for this account. Scope
`boleto_charge.manage`; BaaS only. Add items in atomic chunks with
`PUT .../items`, then dispatch once. Creating a draft consumes no
issuance quota. `Idempotency-Key` is required; an exact retry returns
the existing batch.


Reference: https://en.docs.api.corpx.com/baas/referencia/boleto-charge/create-boleto-charge-batch

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `accountId` (string, required) — Account identifier.

### Headers

- `Idempotency-Key` (string, required) — Client-generated idempotency token.
- `X-Tenant-Id` (string, required) — Tenant context used for authorization and routing.

### Body (application/json)

This endpoint expects an object.

- `name` (string, optional) — Optional operator-facing batch name.

## Response

### 200

Idempotent retry; returns the existing batch

- `batchId` (string, required) — Batch identifier.
- `name` (string, required) — Optional operator-facing name; empty when omitted.
- `status` (enum, required) — Batch lifecycle. Only `DRAFT` is editable. `COMPLETED`, `PARTIAL_FAILED`, and `FAILED` are terminal for issuance attempts; individual boleto registration and payment continue afterwards.
  - Allowed values: `DRAFT`, `QUEUED`, `PROCESSING`, `COMPLETED`, `PARTIAL_FAILED`, `FAILED`
- `totalItems` (integer, required) — Number of staged items.
- `quotaReserved` (integer, required) — Slots permanently reserved when dispatch was admitted.
- `statistics` (BoletoChargeBatchStatistics, required) — Current generation progress and payment conversion.
- `createdAt` (datetime, required) — Draft creation instant, in UTC.
- `updatedAt` (datetime, required) — Last persisted batch/statistics update, in UTC.
- `items` (list of BoletoChargeBatchItem, required) — Current page of staged items and issuance results.
- `page` (integer, required) — Current item page.
- `pageSize` (integer, required) — Requested item page size.
- `totalPages` (integer, required) — Number of item pages.
- `hasNext` (boolean, required) — Whether another item page exists.
- `dispatchedAt` (datetime, optional, nullable) — Instant quota was reserved and the batch was queued.
- `completedAt` (datetime, optional, nullable) — Instant every issuance attempt reached an outcome.

### 201

Empty draft created

- `batchId` (string, required) — Batch identifier.
- `name` (string, required) — Optional operator-facing name; empty when omitted.
- `status` (enum, required) — Batch lifecycle. Only `DRAFT` is editable. `COMPLETED`, `PARTIAL_FAILED`, and `FAILED` are terminal for issuance attempts; individual boleto registration and payment continue afterwards.
  - Allowed values: `DRAFT`, `QUEUED`, `PROCESSING`, `COMPLETED`, `PARTIAL_FAILED`, `FAILED`
- `totalItems` (integer, required) — Number of staged items.
- `quotaReserved` (integer, required) — Slots permanently reserved when dispatch was admitted.
- `statistics` (BoletoChargeBatchStatistics, required) — Current generation progress and payment conversion.
- `createdAt` (datetime, required) — Draft creation instant, in UTC.
- `updatedAt` (datetime, required) — Last persisted batch/statistics update, in UTC.
- `items` (list of BoletoChargeBatchItem, required) — Current page of staged items and issuance results.
- `page` (integer, required) — Current item page.
- `pageSize` (integer, required) — Requested item page size.
- `totalPages` (integer, required) — Number of item pages.
- `hasNext` (boolean, required) — Whether another item page exists.
- `dispatchedAt` (datetime, optional, nullable) — Instant quota was reserved and the batch was queued.
- `completedAt` (datetime, optional, nullable) — Instant every issuance attempt reached an outcome.

## Errors

### 400 Bad Request Error

Missing Idempotency-Key, malformed JSON, or name longer than 120 characters.

- `errorCode` (string, required) — Stable machine-readable code. See `ErrorCode` for the known values.
- `message` (string, required) — Human-readable explanation (pt-BR). Presentation only; may change.
- `docs` (string, optional) — Link to this code in the public error catalogue.
- `requestId` (string, optional) — Gateway request id. Quote it when contacting support.
- `details` (map from string to any, optional) — Optional machine-readable context for the specific `errorCode` (for example `kind` on `identity_verification_monthly_limit_exceeded`, `maxBytes` on `payload_too_large`, `attemptsRemaining` on `facetec_attempts_exhausted`). Keys are documented per operation; absent when the code carries no extra context.
- `partner` (ErrorResponsePartner, optional) — Raw error from the settlement bank, when the failure came from it. Diagnostic only.

### 403 Forbidden Error

Requester does not have permission to perform the operation.

- `errorCode` (string, required) — Stable machine-readable code. See `ErrorCode` for the known values.
- `message` (string, required) — Human-readable explanation (pt-BR). Presentation only; may change.
- `docs` (string, optional) — Link to this code in the public error catalogue.
- `requestId` (string, optional) — Gateway request id. Quote it when contacting support.
- `details` (map from string to any, optional) — Optional machine-readable context for the specific `errorCode` (for example `kind` on `identity_verification_monthly_limit_exceeded`, `maxBytes` on `payload_too_large`, `attemptsRemaining` on `facetec_attempts_exhausted`). Keys are documented per operation; absent when the code carries no extra context.
- `partner` (ErrorResponsePartner, optional) — Raw error from the settlement bank, when the failure came from it. Diagnostic only.

### 404 Not Found Error

Requested resource was not found.

- `errorCode` (string, required) — Stable machine-readable code. See `ErrorCode` for the known values.
- `message` (string, required) — Human-readable explanation (pt-BR). Presentation only; may change.
- `docs` (string, optional) — Link to this code in the public error catalogue.
- `requestId` (string, optional) — Gateway request id. Quote it when contacting support.
- `details` (map from string to any, optional) — Optional machine-readable context for the specific `errorCode` (for example `kind` on `identity_verification_monthly_limit_exceeded`, `maxBytes` on `payload_too_large`, `attemptsRemaining` on `facetec_attempts_exhausted`). Keys are documented per operation; absent when the code carries no extra context.
- `partner` (ErrorResponsePartner, optional) — Raw error from the settlement bank, when the failure came from it. Diagnostic only.

## Types

### BoletoChargeBatchStatistics

Current generation progress and payment conversion.

- `generation` (BoletoChargeBatchGenerationStats, required) — Issuance-attempt progress for the batch.
- `payment` (BoletoChargeBatchPaymentStats, required) — Payment conversion across generated boletos. Failed issuance items are excluded from every denominator.

### BoletoChargeBatchItem

One staged issuance request and its eventual result.

- `itemId` (string, required) — Batch-local item identifier used by the delete route.
- `position` (integer, required) — Stable order of this item inside the batch.
- `identifier` (string, required) — Required account-wide idempotency identifier from the request.
- `status` (enum, required) — Current item issuance state.
  - Allowed values: `PENDING`, `PROCESSING`, `ISSUED`, `FAILED`
- `request` (BoletoChargeCreateRequest, required) — One boleto issuance request. `identifier` is required and is the sole idempotency key for this account; `Idempotency-Key` is not a fallback.
- `createdAt` (datetime, required) — Item staging instant, in UTC.
- `updatedAt` (datetime, required) — Last item/result update, in UTC.
- `error` (BoletoChargeBatchItemError, optional) — Failure recorded for an item that did not produce a boleto.
- `charge` (BoletoChargeBatchItemCharge, optional) — Local mirror snapshot for a successfully issued batch item.

### ErrorResponsePartner

Raw error from the settlement bank, when the failure came from it. Diagnostic only.

- `code` (string, optional)
- `message` (string, optional)
- `field` (string, optional) — Field the partner pointed at, when any.

### BoletoChargeBatchGenerationStats

Issuance-attempt progress for the batch.

- `total` (integer, required) — Total items in the batch.
- `pending` (integer, required) — Items not yet started.
- `processing` (integer, required) — Items whose issuance attempt is running.
- `issued` (integer, required) — Items for which the settlement bank generated a boleto.
- `failed` (integer, required) — Items whose issuance attempt ended without a generated boleto.
- `progressPercentage` (double, required) — `(issued + failed) / total × 100`; zero when total is zero.

### BoletoChargeBatchPaymentStats

Payment conversion across generated boletos. Failed issuance items are excluded from every denominator.

- `issued` (integer, required) — Generated boletos, the conversion denominator.
- `paid` (integer, required) — Issued boletos already settled.
- `unpaid` (integer, required) — Issued boletos not yet settled.
- `overdue` (integer, required) — Issued and unpaid boletos currently overdue.
- `paidAmount` (double, required) — Sum actually paid in BRL.
- `conversionRate` (double, required) — `paid / issued × 100`; zero when issued is zero.

### BoletoChargeCreateRequest

One boleto issuance request. `identifier` is required and is the sole idempotency key for this account; `Idempotency-Key` is not a fallback.

- `identifier` (string, required) — Caller-owned idempotency key, unique per account.
- `dueDate` (date, required) — Due date, YYYY-MM-DD.
- `amount` (BoletoChargeCreateRequestAmount, required) — Face amount of the boleto.
- `payer` (BoletoChargeCreateRequestPayer, required) — Who must pay the boleto.
- `issueDate` (date, optional) — Issue date, YYYY-MM-DD. dueDate cannot be before it.
- `interest` (BoletoChargeFee, optional) — Interest or fine. startDate, when set, must be after dueDate.
- `fine` (BoletoChargeFee, optional) — Interest or fine. startDate, when set, must be after dueDate.
- `discount` (BoletoChargeCreateRequestDiscount, optional) — Early-payment discount. Each groups[].limitDate must be before dueDate.
- `abatement` (BoletoChargeCreateRequestAbatement, optional) — Fixed abatement. Together with discounts it must not reach amount.nominal.
- `allowPartialPayment` (boolean, optional) — Accept a payment below the amount.
- `allowDivergentPayment` (boolean, optional) — Accept an amount other than the face value, within min and max.
- `divergentPaymentMode` (enum, optional) — How a divergent payment is bounded.
  - Allowed values: `anyValue`, `minMax`, `minOnly`
- `minPaymentAmount` (double, optional) — Minimum accepted payment when divergent payment is on. Not greater than maxPaymentAmount.
- `maxPaymentAmount` (double, optional) — Maximum accepted payment when divergent payment is on.
- `expirationPolicy` (BoletoChargeCreateRequestExpirationPolicy, optional) — How long the boleto can be paid. There is no write-off of an open boleto; paymentLimitDate is how you bound validity.

### BoletoChargeBatchItemError

Failure recorded for an item that did not produce a boleto.

- `errorCode` (string, required) — Stable machine-readable failure code.
- `message` (string, required) — Human-readable diagnostic; do not branch on it.

### BoletoChargeBatchItemCharge

Local mirror snapshot for a successfully issued batch item.

- `chargeId` (string, required) — Settlement-bank boleto identifier.
- `identifier` (string, required) — Caller-owned identifier.
- `status` (string, required) — Current mirrored boleto status.
- `registrationCondition` (string, required) — Current mirrored central-registration condition.
- `barcode` (string, required) — Barcode, when available.
- `digitableLine` (string, required) — Digitable line, when available.
- `ourNumber` (string, required) — Our number at the settlement bank.
- `amount` (BoletoChargeBatchItemChargeAmount, required) — Mirrored issuance and payment amounts in BRL.
- `updatedAt` (datetime, optional) — Last successful mirror synchronization.

### BoletoChargeCreateRequestAmount

Face amount of the boleto.

- `nominal` (double, required) — Face amount in BRL, greater than zero. Two decimal places, never cents-as-integer.
- `currency` (enum, optional, default: BRL) — Currency. Always BRL.
  - Allowed values: `BRL`

### BoletoChargeCreateRequestPayer

Who must pay the boleto.

- `name` (string, required) — Payer name.
- `personType` (enum, required) — person for CPF, company for CNPJ.
  - Allowed values: `person`, `company`
- `taxNumber` (string, required) — CPF when personType is person, CNPJ when company. Digits only.
- `email` (string, optional) — Payer email.
- `addressStreet` (string, optional) — Street.
- `addressNumber` (string, optional) — Street number.
- `addressComplement` (string, optional) — Complement.
- `addressDistrict` (string, optional) — District.
- `addressCity` (string, optional) — City.
- `addressState` (string, optional) — State, two letters.
- `addressZipCode` (string, optional) — ZIP code, 8 digits.

### BoletoChargeFee

Interest or fine. startDate, when set, must be after dueDate.

- `calculationModel` (enum, optional) — Which institution computes the amounts before and after dueDate. Optional.
  - Allowed values: `receiver-calculates-all`, `recipient-calculates-overdue`, `recipient-calculates-all`
- `typeId` (integer, optional) — Optional. Filled from typeKey when omitted; when sent, it must match typeKey.
- `typeKey` (string, optional) — Fee type. Interest: `exempt`, `fixed-value-calendar-day`, `fixed-value-business-day`, `percentage-calendar-day`, `percentage-business-day`, `percentage-month-calendar-day`, `percentage-month-business-day`, `percentage-year-calendar-day`, `percentage-year-business-day`. Fine: `exempt`, `fixed-value`, `percentage`. Any other value returns 400 `invalid_payload`.
- `value` (double, optional) — Amount in BRL, or a percent when typeKey says percentage. Required and greater than zero unless typeKey is exempt.
- `startDate` (date, optional) — First day the fee applies, YYYY-MM-DD, after dueDate.

### BoletoChargeCreateRequestDiscount

Early-payment discount. Each groups[].limitDate must be before dueDate.

- `calculationModel` (enum, optional) — Which institution computes the discount. Optional.
  - Allowed values: `receiver-calculates-all`, `recipient-calculates-overdue`, `recipient-calculates-all`
- `groups` (list of BoletoChargeCreateRequestDiscountGroupsItems, optional) — Discount steps.

### BoletoChargeCreateRequestAbatement

Fixed abatement. Together with discounts it must not reach amount.nominal.

- `amount` (double, optional) — Abatement in BRL, not negative.

### BoletoChargeCreateRequestExpirationPolicy

How long the boleto can be paid. There is no write-off of an open boleto; paymentLimitDate is how you bound validity.

- `allowPaymentAfterDueDate` (boolean, optional) — Whether payment is accepted after dueDate.
- `paymentLimitDate` (date, optional) — Last day payment is accepted, YYYY-MM-DD, not before dueDate.
- `blockPaymentAfterLimit` (boolean, optional) — Reject payment after paymentLimitDate.
- `decursoGraceDays` (integer, optional) — Grace days after the payment limit.

### BoletoChargeBatchItemChargeAmount

Mirrored issuance and payment amounts in BRL.

- `nominal` (double, optional) — Face amount.
- `updatedAmount` (double, optional) — Current amount after charges/reductions.
- `paid` (double, optional) — Amount already paid.
- `currency` (string, optional) — Currency, normally BRL.

### BoletoChargeCreateRequestDiscountGroupsItems

- `sequence` (integer, optional) — Step order, starting at 1.
- `typeId` (integer, optional) — Optional. Filled from typeKey when omitted; when sent, it must match typeKey.
- `typeKey` (string, optional) — Discount type: `exempt`, `fixed-value-until-date`, `percentage-until-date`, `fixed-value-anticipation-calendar-day`, `fixed-value-anticipation-business-day`, `percentage-anticipation-calendar-day`, `percentage-anticipation-business-day`. `-until-date` types require limitDate; anticipation types must not send it.
- `value` (double, optional) — Discount amount in BRL, or a percent when typeKey says percentage.
- `limitDate` (date, optional) — Last day this step applies, YYYY-MM-DD, before dueDate. Only for `-until-date` types.

## Examples

### Boleto Charge_createBoletoChargeBatch_example

**Request**

```json
{
  "name": "Cobranças de setembro"
}
```

**Response**

```json
{
  "batchId": "string",
  "name": "string",
  "status": "DRAFT",
  "totalItems": 1,
  "quotaReserved": 1,
  "statistics": {
    "generation": {
      "total": 1,
      "pending": 1,
      "processing": 1,
      "issued": 1,
      "failed": 1,
      "progressPercentage": 1.1
    },
    "payment": {
      "issued": 1,
      "paid": 1,
      "unpaid": 1,
      "overdue": 1,
      "paidAmount": 1.1,
      "conversionRate": 1.1
    }
  },
  "createdAt": "2024-01-15T09:30:00Z",
  "updatedAt": "2024-01-15T09:30:00Z",
  "items": [
    {
      "itemId": "string",
      "position": 1,
      "identifier": "string",
      "status": "ISSUED",
      "request": {
        "identifier": "string",
        "dueDate": "2023-01-15",
        "amount": {
          "nominal": 150.75,
          "currency": "BRL"
        },
        "payer": {
          "name": "Maria da Silva",
          "personType": "person",
          "taxNumber": "52998224725",
          "email": "string",
          "addressStreet": "string",
          "addressNumber": "string",
          "addressComplement": "string",
          "addressDistrict": "string",
          "addressCity": "string",
          "addressState": "SP",
          "addressZipCode": "01310100"
        },
        "issueDate": "2023-01-15",
        "interest": {
          "calculationModel": "receiver-calculates-all",
          "typeId": 1,
          "typeKey": "percentage-month-calendar-day",
          "value": 1.1,
          "startDate": "2023-01-15"
        },
        "fine": {
          "calculationModel": "receiver-calculates-all",
          "typeId": 1,
          "typeKey": "percentage-month-calendar-day",
          "value": 1.1,
          "startDate": "2023-01-15"
        },
        "discount": {
          "calculationModel": "receiver-calculates-all",
          "groups": [
            {
              "sequence": 1,
              "typeId": 1,
              "typeKey": "percentage-until-date",
              "value": 1.1,
              "limitDate": "2023-01-15"
            }
          ]
        },
        "abatement": {
          "amount": 1.1
        },
        "allowPartialPayment": true,
        "allowDivergentPayment": true,
        "divergentPaymentMode": "anyValue",
        "minPaymentAmount": 1.1,
        "maxPaymentAmount": 1.1,
        "expirationPolicy": {
          "allowPaymentAfterDueDate": true,
          "paymentLimitDate": "2023-01-15",
          "blockPaymentAfterLimit": true,
          "decursoGraceDays": 1
        }
      },
      "createdAt": "2024-01-15T09:30:00Z",
      "updatedAt": "2024-01-15T09:30:00Z",
      "error": {
        "errorCode": "string",
        "message": "string"
      },
      "charge": {
        "chargeId": "string",
        "identifier": "string",
        "status": "string",
        "registrationCondition": "string",
        "barcode": "string",
        "digitableLine": "string",
        "ourNumber": "string",
        "amount": {
          "nominal": 1.1,
          "updatedAmount": 1.1,
          "paid": 1.1,
          "currency": "string"
        },
        "updatedAt": "2024-01-15T09:30:00Z"
      }
    }
  ],
  "page": 1,
  "pageSize": 1,
  "totalPages": 1,
  "hasNext": true,
  "dispatchedAt": "2024-01-15T09:30:00Z",
  "completedAt": "2024-01-15T09:30:00Z"
}
```

**SDK Code**

```python Boleto Charge_createBoletoChargeBatch_example
import requests

url = "https://tenant.api.corpx.com/v1/accounts/accountId/boleto/charge/batches"

payload = { "name": "Cobranças de setembro" }
headers = {
    "Idempotency-Key": "Idempotency-Key",
    "X-Tenant-Id": "X-Tenant-Id",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Boleto Charge_createBoletoChargeBatch_example
const url = 'https://tenant.api.corpx.com/v1/accounts/accountId/boleto/charge/batches';
const options = {
  method: 'POST',
  headers: {
    'Idempotency-Key': 'Idempotency-Key',
    'X-Tenant-Id': 'X-Tenant-Id',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: '{"name":"Cobranças de setembro"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Boleto Charge_createBoletoChargeBatch_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://tenant.api.corpx.com/v1/accounts/accountId/boleto/charge/batches"

	payload := strings.NewReader("{\n  \"name\": \"Cobranças de setembro\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Idempotency-Key", "Idempotency-Key")
	req.Header.Add("X-Tenant-Id", "X-Tenant-Id")
	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Boleto Charge_createBoletoChargeBatch_example
require 'uri'
require 'net/http'

url = URI("https://tenant.api.corpx.com/v1/accounts/accountId/boleto/charge/batches")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = 'Idempotency-Key'
request["X-Tenant-Id"] = 'X-Tenant-Id'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"Cobranças de setembro\"\n}"

response = http.request(request)
puts response.read_body
```

```java Boleto Charge_createBoletoChargeBatch_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://tenant.api.corpx.com/v1/accounts/accountId/boleto/charge/batches")
  .header("Idempotency-Key", "Idempotency-Key")
  .header("X-Tenant-Id", "X-Tenant-Id")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Cobranças de setembro\"\n}")
  .asString();
```

```php Boleto Charge_createBoletoChargeBatch_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://tenant.api.corpx.com/v1/accounts/accountId/boleto/charge/batches', [
  'body' => '{
  "name": "Cobranças de setembro"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
    'Idempotency-Key' => 'Idempotency-Key',
    'X-Tenant-Id' => 'X-Tenant-Id',
  ],
]);

echo $response->getBody();
```

```csharp Boleto Charge_createBoletoChargeBatch_example
using RestSharp;

var client = new RestClient("https://tenant.api.corpx.com/v1/accounts/accountId/boleto/charge/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("Idempotency-Key", "Idempotency-Key");
request.AddHeader("X-Tenant-Id", "X-Tenant-Id");
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Cobranças de setembro\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Boleto Charge_createBoletoChargeBatch_example
import Foundation

let headers = [
  "Idempotency-Key": "Idempotency-Key",
  "X-Tenant-Id": "X-Tenant-Id",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["name": "Cobranças de setembro"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://tenant.api.corpx.com/v1/accounts/accountId/boleto/charge/batches")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Boleto Charge_createBoletoChargeBatch_example

**Request**

```json
{
  "name": "Cobranças de setembro"
}
```

**Response**

```json
{
  "batchId": "bcb_01J8Y7C8D9E0F1G2H3J4",
  "name": "Cobranças de setembro",
  "status": "DRAFT",
  "totalItems": 0,
  "quotaReserved": 0,
  "statistics": {
    "generation": {
      "total": 0,
      "pending": 0,
      "processing": 0,
      "issued": 0,
      "failed": 0,
      "progressPercentage": 0
    },
    "payment": {
      "issued": 0,
      "paid": 0,
      "unpaid": 0,
      "overdue": 0,
      "paidAmount": 0,
      "conversionRate": 0
    }
  },
  "createdAt": "2026-09-24T14:08:12Z",
  "updatedAt": "2026-09-24T14:08:12Z",
  "items": [],
  "page": 1,
  "pageSize": 50,
  "totalPages": 0,
  "hasNext": false
}
```

**SDK Code**

```python Boleto Charge_createBoletoChargeBatch_example
import requests

url = "https://tenant.api.corpx.com/v1/accounts/accountId/boleto/charge/batches"

payload = { "name": "Cobranças de setembro" }
headers = {
    "Idempotency-Key": "Idempotency-Key",
    "X-Tenant-Id": "X-Tenant-Id",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Boleto Charge_createBoletoChargeBatch_example
const url = 'https://tenant.api.corpx.com/v1/accounts/accountId/boleto/charge/batches';
const options = {
  method: 'POST',
  headers: {
    'Idempotency-Key': 'Idempotency-Key',
    'X-Tenant-Id': 'X-Tenant-Id',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: '{"name":"Cobranças de setembro"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Boleto Charge_createBoletoChargeBatch_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://tenant.api.corpx.com/v1/accounts/accountId/boleto/charge/batches"

	payload := strings.NewReader("{\n  \"name\": \"Cobranças de setembro\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Idempotency-Key", "Idempotency-Key")
	req.Header.Add("X-Tenant-Id", "X-Tenant-Id")
	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Boleto Charge_createBoletoChargeBatch_example
require 'uri'
require 'net/http'

url = URI("https://tenant.api.corpx.com/v1/accounts/accountId/boleto/charge/batches")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = 'Idempotency-Key'
request["X-Tenant-Id"] = 'X-Tenant-Id'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"Cobranças de setembro\"\n}"

response = http.request(request)
puts response.read_body
```

```java Boleto Charge_createBoletoChargeBatch_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://tenant.api.corpx.com/v1/accounts/accountId/boleto/charge/batches")
  .header("Idempotency-Key", "Idempotency-Key")
  .header("X-Tenant-Id", "X-Tenant-Id")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Cobranças de setembro\"\n}")
  .asString();
```

```php Boleto Charge_createBoletoChargeBatch_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://tenant.api.corpx.com/v1/accounts/accountId/boleto/charge/batches', [
  'body' => '{
  "name": "Cobranças de setembro"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
    'Idempotency-Key' => 'Idempotency-Key',
    'X-Tenant-Id' => 'X-Tenant-Id',
  ],
]);

echo $response->getBody();
```

```csharp Boleto Charge_createBoletoChargeBatch_example
using RestSharp;

var client = new RestClient("https://tenant.api.corpx.com/v1/accounts/accountId/boleto/charge/batches");
var request = new RestRequest(Method.POST);
request.AddHeader("Idempotency-Key", "Idempotency-Key");
request.AddHeader("X-Tenant-Id", "X-Tenant-Id");
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Cobranças de setembro\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Boleto Charge_createBoletoChargeBatch_example
import Foundation

let headers = [
  "Idempotency-Key": "Idempotency-Key",
  "X-Tenant-Id": "X-Tenant-Id",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["name": "Cobranças de setembro"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://tenant.api.corpx.com/v1/accounts/accountId/boleto/charge/batches")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```