---
title: "Generate a payout batch"
method: POST
path: "/v1/payout_batches"
tags: ["Payout batches"]
---

# Generate a payout batch

`POST /v1/payout_batches`

## Request

- Base URL: `https://api.affiliaterail.com`
- URL: `https://api.affiliaterail.com/v1/payout_batches`
- Auth: HTTP bearer

Turns every `due` commission up to `period_end` into payouts, one per partner per currency, netting clawbacks and applying the threshold, payout-method and tax-form checks. Idempotent per partner per month: a second run for the same month skips partners already paid and re-evaluates the not-eligible ones. Money does not move; this creates the payable set.

**Scope:** `payouts:write` (or `write`)

## Request body

- PayoutBatchCreate
  - `program_id` string, required: Prefixed id (`prg_…`)
  - `period_end` string, date-time, required: Last instant of the earning period
  - `period_start` string, date-time: ISO-8601, UTC
  - `partner_ids` string[]
  - `group_id` string: Prefixed id (`grp_…`)
  - `ignore_threshold` boolean

## Response `201`

What the run produced

- PayoutBatchRun
  - `object` 'payout_batch_run', required
  - `batches` PayoutBatch[], required
    - `id` string, required: Prefixed id (`batch_…`)
    - `object` 'payout_batch', required
    - `program_id` string, required: Prefixed id (`prg_…`)
    - `term` 'net_15' | 'net_30' | 'net_60', required
    - `period_start` string, date-time, required: ISO-8601, UTC
    - `period_end` string, date-time, required: ISO-8601, UTC
    - `currency` string, required: ISO-4217
    - `total_minor` integer, required: Integer minor units (cents, pence). Never a float, never a string.
    - `payout_count` integer, required
    - `generated_by_user_id` string, nullable, required
    - `executed_at` string, date-time, nullable, required: ISO-8601, UTC
    - `created_at` string, date-time, required: ISO-8601, UTC
    - `updated_at` string, date-time, required: ISO-8601, UTC
  - `created` object[], required
    - `payout_id` string, required: Prefixed id (`pyt_…`)
    - `partner_id` string, required: Prefixed id (`part_…`)
    - `currency` string, required: ISO-4217
    - `amount_minor` integer, required: Integer minor units (cents, pence). Never a float, never a string.
    - `status` 'pending' | 'not_eligible', required
    - `reason` string, nullable, required
  - `upgraded` string[], required
  - `refreshed` string[], required
  - `skipped` object[], required
    - `partner_id` string, required: Prefixed id (`part_…`)
    - `currency` string, required: ISO-4217
    - `status` string, required

## Other responses

- `400`: Invalid request
- `401`: Missing or unknown API key
- `403`: Key lacks the required scope
- `404`: No such object in your organization
- `422`: The request was understood and refused
- `429`: Rate limited: see Retry-After

---

[API](https://skmtc.dev/affiliaterail/apis/affiliaterail-api.md) · [All operations](https://skmtc.dev/affiliaterail/apis/affiliaterail-api/llms.txt) · [OpenAPI document](https://skmtc.dev/affiliaterail/apis/affiliaterail-api/revisions/ea41f345c092?raw)
