Settlements

Every request goes to https://api.lemak.cash. About the reference.

List settlements

GET /v1/settlements

Returns a list of settlements in the mode of the API key, newest first. The list leaves out the items of each settlement; retrieve one settlement to read them.

Authentication

Bearer key. Your secret API key, which starts with sk_test_ or sk_live_. Send it as Authorization: Bearer <key>. A test key works as soon as your account exists. A production key returns 403 live_not_enabled until your account is activated.

Parameters

NameInTypeDescription
Api-Version optionalheaderstringThe API version for this request, as a date in YYYY-MM-DD format. When omitted, your account's version applies, which is set to the latest version on your first request. An unknown version returns 400 invalid_api_version. Pattern ^[0-9]{4}-[0-9]{2}-[0-9]{2}$.
limit optionalqueryintegerThe maximum number of objects to return, from 1 to 100. Minimum 1. Maximum 100. Default 20.
starting_after optionalquerystringA pagination cursor. Pass the ID of the last object on the previous page to get the next page.
status optionalquerystringOnly return settlements with this status. Any other value returns 400 invalid_status. One of pending, processing, paid, failed.

Responses

200

A list of settlements.

application/json

SettlementList

FieldTypeDescription
object requiredlist
data requiredarray of Settlement
Fields of data
FieldTypeDescription
id requiredstringUnique identifier for the settlement. Pattern ^st_[A-Z2-7]+$.
object requiredsettlement
mode requiredstringlive for production, test for test mode. One of live, test.
status requiredstringThe status of the settlement. One of pending, processing, paid, failed.
amount requiredMoneyThe amount paid to you: the total of the settled payments, plus any balance adjustment the platform credited to you.
Fields of amount
FieldTypeDescription
amount requiredinteger (int64)The amount in the smallest currency unit, as an integer. For example, 1000 is 10.00 USD.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
payments optionalintegerThe number of payment intents in this settlement.
period_start requiredstring (date-time)The start of the period this settlement covers.
period_end requiredstring (date-time)The end of the period this settlement covers.
created requiredstring (date-time)The time the settlement was created.
paid_at optionalstring (date-time)The time the settlement was paid. Present only when status is paid.
destination optionalSettlementDestinationWhere the settlement is paid. Absent when the settlement names no destination.
Fields of destination
FieldTypeDescription
type requiredstringThe kind of payout destination. One of usdc_onchain, usdt_onchain, swift, simulated.
masked requiredstringThe last four characters of the destination, and nothing else. An empty string when the destination has four characters or fewer, or none.
label optionalstringYour own name for the destination
payout optionalSettlementPayoutWhat a production settlement pays on its destination's rail: USDT, USDC or a USD wire. Present once the platform approved the settlement, which fixes the rate. Always whole cents.
Fields of payout
FieldTypeDescription
amount requiredMoneyWhat is sent, after the fee.
Fields of amount
FieldTypeDescription
amount requiredinteger (int64)The amount in the smallest currency unit, as an integer. For example, 1000 is 10.00 USD.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
fee requiredMoneyThe flat payout fee of the destination's rail, in the paid currency.
Fields of fee
FieldTypeDescription
amount requiredinteger (int64)The amount in the smallest currency unit, as an integer. For example, 1000 is 10.00 USD.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
rate requiredstringUnits of the settlement currency per unit paid, before the fee, as a decimal string.
locked_at requiredstring (date-time)
items optionalarray of SettlementItemThe payment intents this settlement pays. Present only when you retrieve one settlement. The item amounts add up to amount, less any balance adjustment it pays.
Fields of items
FieldTypeDescription
object requiredsettlement_item
payment_intent requiredstringThe ID of the payment intent this item pays. Pattern ^pi_[A-Z2-7]+$.
amount requiredMoneyThe amount paid for this payment intent.
Fields of amount
FieldTypeDescription
amount requiredinteger (int64)The amount in the smallest currency unit, as an integer. For example, 1000 is 10.00 USD.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
has_more requiredbooleanWhether more objects exist after this page.

Errors

Every error answers with the error object.

StatusWhen
OtherAn error. The status tells you the kind: 400 invalid request, 401 invalid API key, 402 payment could not be placed, 403 forbidden, 404 not found, 409 conflict, 413 body over 64 KiB, 422 idempotency key reused, 429 too many requests, 5xx server error. A test mode key takes at most 5 requests a second.

Example

curl https://api.lemak.cash/v1/settlements \
  -H "Authorization: Bearer sk_test_..." \
  -H "Api-Version: 2026-12-01"

Create a settlement

POST /v1/settlements

Withdraws from your available balance. This is the only way a settlement starts: no schedule pays you. In production the settlement is pending until we review and approve it, and only then is it paid; in test mode a simulated destination is paid at once. Without amount it pays every released payment; with it, any amount up to the available balance. Without payout_method it pays the default destination; in production, with no default destination either, it is 400 payout_method_required. In production this endpoint takes a withdrawal key (wk_live_...) only: a payments key is 403 withdrawals_require_withdrawal_key.

Authentication

Bearer key. Your secret API key, which starts with sk_test_ or sk_live_. Send it as Authorization: Bearer <key>. A test key works as soon as your account exists. A production key returns 403 live_not_enabled until your account is activated.

Parameters

NameInTypeDescription
Idempotency-Key requiredheaderstringA unique key you generate for this request, up to 255 characters. A retry with the same key and body returns the original response. Without it, the request returns 400 idempotency_key_required. At most 255 characters.
Api-Version optionalheaderstringThe API version for this request, as a date in YYYY-MM-DD format. When omitted, your account's version applies, which is set to the latest version on your first request. An unknown version returns 400 invalid_api_version. Pattern ^[0-9]{4}-[0-9]{2}-[0-9]{2}$.

Request body

application/json

SettlementCreate

FieldTypeDescription
amount optionalinteger (int64)Minor units to withdraw. Absent pays every released payment. The oldest payments are paid first, and the last one in part. Minimum 1.
currency optionalstringThe balance to draw. Required with amount. Absent is USD. A balance in any other currency is converted at a rate fixed when the platform approves the settlement. Any balance may go to any destination; the destination's flat payout fee comes off what is paid, and an amount that does not cover it is 400 amount_below_payout_fee. Pattern ^[A-Z]{3,5}$.
payout_method optionalstringAn address book entry. Absent is the default.

Responses

202

The merchant's policy holds the change for a second approver. The answer is the request; the change runs when someone other than its maker approves it.

application/json

MerchantRequest

FieldTypeDescription
id requiredstringPattern ^mrq_[A-Z2-7]+$.
object requiredmerchant_request
mode requiredstringOne of live, test.
kind requiredstringOne of withdrawal, payout_method.create, payout_method.remove, payout_method.default.
status requiredstringOne of pending, approved, rejected, expired.
summary requiredobjectWhat the change does, masked: the amount and the destination of a withdrawal, the type, label and last four characters of a destination. A map of string keys to string values.
requested_by optionalstringThe dashboard user who asked.
requested_by_key optionalstringThe withdrawal key that asked.
decided_by optionalstring
decided_at optionalstring (date-time)
note optionalstring
result optionalstringThe settlement or the payout destination the approval made.
expires_at requiredstring (date-time)
created_at requiredstring (date-time)

201

Returns the settlement. A retry with the same Idempotency-Key returns the original response.

application/json

Settlement

FieldTypeDescription
id requiredstringUnique identifier for the settlement. Pattern ^st_[A-Z2-7]+$.
object requiredsettlement
mode requiredstringlive for production, test for test mode. One of live, test.
status requiredstringThe status of the settlement. One of pending, processing, paid, failed.
amount requiredMoneyThe amount paid to you: the total of the settled payments, plus any balance adjustment the platform credited to you.
Fields of amount
FieldTypeDescription
amount requiredinteger (int64)The amount in the smallest currency unit, as an integer. For example, 1000 is 10.00 USD.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
payments optionalintegerThe number of payment intents in this settlement.
period_start requiredstring (date-time)The start of the period this settlement covers.
period_end requiredstring (date-time)The end of the period this settlement covers.
created requiredstring (date-time)The time the settlement was created.
paid_at optionalstring (date-time)The time the settlement was paid. Present only when status is paid.
destination optionalSettlementDestinationWhere the settlement is paid. Absent when the settlement names no destination.
Fields of destination
FieldTypeDescription
type requiredstringThe kind of payout destination. One of usdc_onchain, usdt_onchain, swift, simulated.
masked requiredstringThe last four characters of the destination, and nothing else. An empty string when the destination has four characters or fewer, or none.
label optionalstringYour own name for the destination
payout optionalSettlementPayoutWhat a production settlement pays on its destination's rail: USDT, USDC or a USD wire. Present once the platform approved the settlement, which fixes the rate. Always whole cents.
Fields of payout
FieldTypeDescription
amount requiredMoneyWhat is sent, after the fee.
Fields of amount
FieldTypeDescription
amount requiredinteger (int64)The amount in the smallest currency unit, as an integer. For example, 1000 is 10.00 USD.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
fee requiredMoneyThe flat payout fee of the destination's rail, in the paid currency.
Fields of fee
FieldTypeDescription
amount requiredinteger (int64)The amount in the smallest currency unit, as an integer. For example, 1000 is 10.00 USD.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
rate requiredstringUnits of the settlement currency per unit paid, before the fee, as a decimal string.
locked_at requiredstring (date-time)
items optionalarray of SettlementItemThe payment intents this settlement pays. Present only when you retrieve one settlement. The item amounts add up to amount, less any balance adjustment it pays.
Fields of items
FieldTypeDescription
object requiredsettlement_item
payment_intent requiredstringThe ID of the payment intent this item pays. Pattern ^pi_[A-Z2-7]+$.
amount requiredMoneyThe amount paid for this payment intent.
Fields of amount
FieldTypeDescription
amount requiredinteger (int64)The amount in the smallest currency unit, as an integer. For example, 1000 is 10.00 USD.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.

Errors

Every error answers with the error object.

StatusWhen
400The amount is not positive (invalid_amount), below your minimum withdrawal (amount_below_minimum) or above your available balance (balance_insufficient). Or a production withdrawal names no payout_method and you have no default destination (payout_method_required).
403Your payouts are on hold (payouts_held): the default destination changed in the last 24 hours, or we hold the account. Or a production withdrawal used a payments key (withdrawals_require_withdrawal_key).
404No payout destination with that ID is yours in this mode (resource_missing).
409There is nothing to settle (nothing_to_settle), the destination is unverified (destination_unverified) or inside its 24-hour hold (destination_cooling), or a request with the same Idempotency-Key is still in progress (request_in_progress).
423A fund password reset froze withdrawals for 24 hours (money_frozen).
422The Idempotency-Key was already used with a different request body (idempotency_key_reused).
OtherAn error. The status tells you the kind: 400 invalid request, 401 invalid API key, 402 payment could not be placed, 403 forbidden, 404 not found, 409 conflict, 413 body over 64 KiB, 422 idempotency key reused, 429 too many requests, 5xx server error. A test mode key takes at most 5 requests a second.

Example

curl -X POST https://api.lemak.cash/v1/settlements \
  -H "Authorization: Bearer sk_test_..." \
  -H "Idempotency-Key: <Idempotency-Key>" \
  -H "Api-Version: 2026-12-01" \
  -H "Content-Type: application/json" \
  -d '{
  "amount": 1000,
  "currency": "PHP",
  "payout_method": "<payout_method>"
}'

Retrieve a settlement

GET /v1/settlements/{id}

Retrieves a settlement by its ID, with the payment intents it pays in items. The item amounts add up to the settlement amount, less any balance adjustment the settlement also pays, which names no payment intent.

Authentication

Bearer key. Your secret API key, which starts with sk_test_ or sk_live_. Send it as Authorization: Bearer <key>. A test key works as soon as your account exists. A production key returns 403 live_not_enabled until your account is activated.

Parameters

NameInTypeDescription
id requiredpathstringThe ID of the settlement. Pattern ^st_[0-9A-Za-z]+$.
Api-Version optionalheaderstringThe API version for this request, as a date in YYYY-MM-DD format. When omitted, your account's version applies, which is set to the latest version on your first request. An unknown version returns 400 invalid_api_version. Pattern ^[0-9]{4}-[0-9]{2}-[0-9]{2}$.

Responses

200

Returns the settlement and its items.

application/json

Settlement

FieldTypeDescription
id requiredstringUnique identifier for the settlement. Pattern ^st_[A-Z2-7]+$.
object requiredsettlement
mode requiredstringlive for production, test for test mode. One of live, test.
status requiredstringThe status of the settlement. One of pending, processing, paid, failed.
amount requiredMoneyThe amount paid to you: the total of the settled payments, plus any balance adjustment the platform credited to you.
Fields of amount
FieldTypeDescription
amount requiredinteger (int64)The amount in the smallest currency unit, as an integer. For example, 1000 is 10.00 USD.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
payments optionalintegerThe number of payment intents in this settlement.
period_start requiredstring (date-time)The start of the period this settlement covers.
period_end requiredstring (date-time)The end of the period this settlement covers.
created requiredstring (date-time)The time the settlement was created.
paid_at optionalstring (date-time)The time the settlement was paid. Present only when status is paid.
destination optionalSettlementDestinationWhere the settlement is paid. Absent when the settlement names no destination.
Fields of destination
FieldTypeDescription
type requiredstringThe kind of payout destination. One of usdc_onchain, usdt_onchain, swift, simulated.
masked requiredstringThe last four characters of the destination, and nothing else. An empty string when the destination has four characters or fewer, or none.
label optionalstringYour own name for the destination
payout optionalSettlementPayoutWhat a production settlement pays on its destination's rail: USDT, USDC or a USD wire. Present once the platform approved the settlement, which fixes the rate. Always whole cents.
Fields of payout
FieldTypeDescription
amount requiredMoneyWhat is sent, after the fee.
Fields of amount
FieldTypeDescription
amount requiredinteger (int64)The amount in the smallest currency unit, as an integer. For example, 1000 is 10.00 USD.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
fee requiredMoneyThe flat payout fee of the destination's rail, in the paid currency.
Fields of fee
FieldTypeDescription
amount requiredinteger (int64)The amount in the smallest currency unit, as an integer. For example, 1000 is 10.00 USD.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.
rate requiredstringUnits of the settlement currency per unit paid, before the fee, as a decimal string.
locked_at requiredstring (date-time)
items optionalarray of SettlementItemThe payment intents this settlement pays. Present only when you retrieve one settlement. The item amounts add up to amount, less any balance adjustment it pays.
Fields of items
FieldTypeDescription
object requiredsettlement_item
payment_intent requiredstringThe ID of the payment intent this item pays. Pattern ^pi_[A-Z2-7]+$.
amount requiredMoneyThe amount paid for this payment intent.
Fields of amount
FieldTypeDescription
amount requiredinteger (int64)The amount in the smallest currency unit, as an integer. For example, 1000 is 10.00 USD.
currency requiredstringA currency code in uppercase: an ISO 4217 code such as THB, or a token such as USDT. Pattern ^[A-Z]{3,5}$.

Errors

Every error answers with the error object.

StatusWhen
404No settlement with that ID exists in the mode of the API key (resource_missing).
OtherAn error. The status tells you the kind: 400 invalid request, 401 invalid API key, 402 payment could not be placed, 403 forbidden, 404 not found, 409 conflict, 413 body over 64 KiB, 422 idempotency key reused, 429 too many requests, 5xx server error. A test mode key takes at most 5 requests a second.

Example

curl https://api.lemak.cash/v1/settlements/st_123 \
  -H "Authorization: Bearer sk_test_..." \
  -H "Api-Version: 2026-12-01"