curl --request POST \
--url https://api.gigstack.io/v2/payments/register/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"payments": [
{
"idempotency_key": "txn-2026-10-000123",
"automation_type": "pue_invoice",
"currency": "MXN",
"payment_form": "03",
"date": 1790700000000,
"client": {
"id": "client_1234567890"
},
"items": [
{
"id": "service_1234567890",
"quantity": 1,
"unit_price": 1000
}
],
"metadata": {
"order_id": "ORD-000123"
}
},
{
"idempotency_key": "txn-2026-10-000124",
"automation_type": "none",
"currency": "MXN",
"payment_form": "01",
"client": {
"id": "client_0987654321"
},
"items": [
{
"description": "Annual support plan",
"product_key": "81111811",
"unit_key": "E48",
"unit_price": 2500,
"quantity": 1,
"taxes": [
{
"type": "IVA",
"rate": 0.16,
"factor": "Tasa",
"withholding": false
}
]
}
]
}
]
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
payments: [
{
idempotency_key: 'txn-2026-10-000123',
automation_type: 'pue_invoice',
currency: 'MXN',
payment_form: '03',
date: 1790700000000,
client: {id: 'client_1234567890'},
items: [{id: 'service_1234567890', quantity: 1, unit_price: 1000}],
metadata: {order_id: 'ORD-000123'}
},
{
idempotency_key: 'txn-2026-10-000124',
automation_type: 'none',
currency: 'MXN',
payment_form: '01',
client: {id: 'client_0987654321'},
items: [
{
description: 'Annual support plan',
product_key: '81111811',
unit_key: 'E48',
unit_price: 2500,
quantity: 1,
taxes: [{type: 'IVA', rate: 0.16, factor: 'Tasa', withholding: false}]
}
]
}
]
})
};
fetch('https://api.gigstack.io/v2/payments/register/batch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.gigstack.io/v2/payments/register/batch"
payload = { "payments": [
{
"idempotency_key": "txn-2026-10-000123",
"automation_type": "pue_invoice",
"currency": "MXN",
"payment_form": "03",
"date": 1790700000000,
"client": { "id": "client_1234567890" },
"items": [
{
"id": "service_1234567890",
"quantity": 1,
"unit_price": 1000
}
],
"metadata": { "order_id": "ORD-000123" }
},
{
"idempotency_key": "txn-2026-10-000124",
"automation_type": "none",
"currency": "MXN",
"payment_form": "01",
"client": { "id": "client_0987654321" },
"items": [
{
"description": "Annual support plan",
"product_key": "81111811",
"unit_key": "E48",
"unit_price": 2500,
"quantity": 1,
"taxes": [
{
"type": "IVA",
"rate": 0.16,
"factor": "Tasa",
"withholding": False
}
]
}
]
}
] }
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"success": true,
"data": {
"id": "pbatch_7f3a9c1e5b2d4f6a8c0e2a4b6d8f0a1c",
"object": "payment_batch",
"livemode": true,
"status": "processing",
"result": null,
"total": 120,
"accepted": 119,
"rejected": [
{
"index": 7,
"idempotency_key": "txn-2026-10-000130",
"error": {
"code": "invalid_body",
"message": "payment_form: Invalid enum value"
}
}
],
"counts": {
"queued": 60,
"registered": 58,
"failed": 0,
"duplicate": 1
},
"created_at": 1790780400000,
"completed_at": null
},
"timestamp": 1790781000000
}Register a batch of payments
Accepts up to 10,000 payments in one request and registers them in the background. Each item is
exactly the body of POST /payments/register, and must carry its own idempotency_key, unique within
the batch. To register more than 10,000 payments, send more batches, each with its own Idempotency-Key.
What happens in the request. Every item is validated against the POST /payments/register body
schema, with no I/O. An invalid item is listed in rejected with its reason and the rest go ahead;
only an empty or missing payments array, or more than 10,000 items, refuses the whole request (400).
The answer is 202 with the batch in processing; the first items may already have started.
What happens after. Each accepted item is registered by the same code as POST /payments/register,
with the credential that created the batch, so it fails for the same reasons (a client or service that
does not resolve, a date in the future, a currency with no exchange rate) and triggers the same
automations (automation_type, ppd_invoice_id). A temporary failure is retried automatically, up to
6 attempts per item. Items run about 10 at a time per team, sharing the queue with the team’s income
invoice batches, and a worker pauses about a second after each payment whose automation stamps an
invoice, so a large batch reaches proserver at a few stamps a second. Follow the batch with GET /payments/register/batch/{id}, or subscribe a webhook to
payment_batch.completed (body PaymentBatchCompletedWebhookEvent, signed, sent once and never
retried; see the webhookEvent callback of POST /webhooks), then read the per-item results with
GET /payments/register/batch/{id}/items.
Two levels of idempotency.
- The
Idempotency-Keyheader names the batch. The batch id is derived from your team, the credential’s mode and the header, so the same key with the same body returns the same batch (200), and nothing is created again. The same key with a different body is409idempotency_key_reused. Bodies are compared as sent, including key order, so resend the exact same JSON. - Each item’s
idempotency_keynames the payment. It is the same keyPOST /payments/registeruses: a payment already registered under it, by an earlier batch or a single call, is not registered again, and the item endsduplicate. So a new batch that repeats items of a previous one is safe.
gigstack Connect: create the batch for a connected team with the team parameter, and read it with the
same team.
Mode. livemode comes only from the credential: a test key creates a test batch.
Not supported here: split payments (transfer_data), which are rejected per item; register those one
at a time with POST /payments/register.
curl --request POST \
--url https://api.gigstack.io/v2/payments/register/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"payments": [
{
"idempotency_key": "txn-2026-10-000123",
"automation_type": "pue_invoice",
"currency": "MXN",
"payment_form": "03",
"date": 1790700000000,
"client": {
"id": "client_1234567890"
},
"items": [
{
"id": "service_1234567890",
"quantity": 1,
"unit_price": 1000
}
],
"metadata": {
"order_id": "ORD-000123"
}
},
{
"idempotency_key": "txn-2026-10-000124",
"automation_type": "none",
"currency": "MXN",
"payment_form": "01",
"client": {
"id": "client_0987654321"
},
"items": [
{
"description": "Annual support plan",
"product_key": "81111811",
"unit_key": "E48",
"unit_price": 2500,
"quantity": 1,
"taxes": [
{
"type": "IVA",
"rate": 0.16,
"factor": "Tasa",
"withholding": false
}
]
}
]
}
]
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
payments: [
{
idempotency_key: 'txn-2026-10-000123',
automation_type: 'pue_invoice',
currency: 'MXN',
payment_form: '03',
date: 1790700000000,
client: {id: 'client_1234567890'},
items: [{id: 'service_1234567890', quantity: 1, unit_price: 1000}],
metadata: {order_id: 'ORD-000123'}
},
{
idempotency_key: 'txn-2026-10-000124',
automation_type: 'none',
currency: 'MXN',
payment_form: '01',
client: {id: 'client_0987654321'},
items: [
{
description: 'Annual support plan',
product_key: '81111811',
unit_key: 'E48',
unit_price: 2500,
quantity: 1,
taxes: [{type: 'IVA', rate: 0.16, factor: 'Tasa', withholding: false}]
}
]
}
]
})
};
fetch('https://api.gigstack.io/v2/payments/register/batch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.gigstack.io/v2/payments/register/batch"
payload = { "payments": [
{
"idempotency_key": "txn-2026-10-000123",
"automation_type": "pue_invoice",
"currency": "MXN",
"payment_form": "03",
"date": 1790700000000,
"client": { "id": "client_1234567890" },
"items": [
{
"id": "service_1234567890",
"quantity": 1,
"unit_price": 1000
}
],
"metadata": { "order_id": "ORD-000123" }
},
{
"idempotency_key": "txn-2026-10-000124",
"automation_type": "none",
"currency": "MXN",
"payment_form": "01",
"client": { "id": "client_0987654321" },
"items": [
{
"description": "Annual support plan",
"product_key": "81111811",
"unit_key": "E48",
"unit_price": 2500,
"quantity": 1,
"taxes": [
{
"type": "IVA",
"rate": 0.16,
"factor": "Tasa",
"withholding": False
}
]
}
]
}
] }
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"success": true,
"data": {
"id": "pbatch_7f3a9c1e5b2d4f6a8c0e2a4b6d8f0a1c",
"object": "payment_batch",
"livemode": true,
"status": "processing",
"result": null,
"total": 120,
"accepted": 119,
"rejected": [
{
"index": 7,
"idempotency_key": "txn-2026-10-000130",
"error": {
"code": "invalid_body",
"message": "payment_form: Invalid enum value"
}
}
],
"counts": {
"queued": 60,
"registered": 58,
"failed": 0,
"duplicate": 1
},
"created_at": 1790780400000,
"completed_at": null
},
"timestamp": 1790781000000
}Authorizations
Authentication Method: HTTP Bearer token.
The runtime requires the literal Bearer prefix — a bare token in the
Authorization header is rejected with 401 unauthorized.
Header Format: Authorization: Bearer YOUR_API_KEY
Your API key is a JWT. Live keys operate on live data (livemode: true);
test keys operate on isolated test data (livemode: false).
Get your key at: app.gigstack.pro/settings?tab=api
Errors: credential failures are answered by the authentication layer with a raw
{ "message": … } body, not the standardized envelope — 401 for a missing, malformed or
expired token, 403 for a revoked key or a plan without API access. See the Unauthorized
and AuthForbidden responses.
Headers
Your identifier for this batch, 8-128 characters of A-Z a-z 0-9 . _ : -. Reusing it with the same
body returns the batch it first created; reusing it with a different body is 409 idempotency_key_reused.
8 - 128^[A-Za-z0-9._:-]{8,128}$Query Parameters
gigstack Connect: Target team ID for multi-team access.
Requires gigstack Connect enabled on your team and shared billing account.
Also requires the multipleIssuerAccounts feature on your plan. Requests targeting a
team other than the one your API key belongs to return 403 without it.
Only API keys can use it: an OAuth access token sent with another team's id is rejected with
403 Team mismatch with OAuth token.
Optional — omit it entirely unless you are acting on another team. It deliberately
carries no example value so generated snippets do not emit ?team=undefined; when the
parameter is absent, the team is derived from your API key.
Example: ?team=team_xyz789
Body
Up to 10,000 payments to register. Each item is exactly the body of POST /payments/register, and
must carry its own idempotency_key, unique within the batch.
Items are validated one by one: an invalid item is listed in the batch's rejected and the others go
ahead. Only a body without a non-empty payments array (invalid_body) or with more than 10,000 items
(too_many_items) refuses the whole request.
livemode, team and owner in an item are ignored (they come from the credential). transfer_data
(a split payment) is not accepted in a batch: the item is rejected with transfer_data_not_supported.
Keep the whole JSON body under 20 MB.
The payments, in the order you want them reported. An item's index is its position here (from 0).
1 - 10000 elementsShow child attributes
Show child attributes
Response
Retry of an earlier request with the same Idempotency-Key and the same body: the batch it created,
as it is now. Nothing is created again. If the first request died while writing the batch, this
request finishes creating it.
Standardized success envelope emitted by sendSuccessResponse.
true true
A payment batch: how many payments it received, which were rejected up front, and the progress of the rest. Timestamps are epoch milliseconds.
Show child attributes
Show child attributes
Server time in epoch milliseconds (Luxon.now().toMillis()).
1767225600000
Human-readable summary. Present only when the handler supplies one.
"Operation completed successfully"