Swarmbyte programmatic merchant API — OAuth tokens, collect, disburse, status, webhooks

Field reference

Quick lookup for headers and JSON bodies. Values marked required must be present on successful requests.

Headers — your requests to SwarmByte

HeaderWhenMeaning
Content-TypeAny POST with a JSON body (token, collect, disburse)Must be application/json.
AuthorizationAll programmatic routes except the two OAuth token URLsBearer <access_token> from the token endpoint whose scope matches the route (collections vs disbursements).
X-Idempotency-KeyPOST /v1/collect and POST /v1/disburse onlyRequired. A unique key you generate per logical payment operation (string, non-empty, max 200 characters). Re-send the same key when retrying after timeouts or transport errors so SwarmByte returns the same transaction instead of creating a duplicate. Use a new key for a new payment. Parallel duplicate posts can receive 409 while the first is still running; after completion, the same key usually replays the stored result with 202.

Body — OAuth token (/v1/oauth/…/token)

FieldRequiredMeaning
grant_typeYesMust be the literal string client_credentials.
client_idYesYour merchant API key from the dashboard (OAuth "client id").
client_secretYesYour merchant API secret (treat like a password; store securely).

OAuth token response (200)

FieldMeaning
access_tokenOpaque Bearer token; use only as Authorization: Bearer … until expiry.
token_typeAlways bearer (case as returned).
expires_inLifetime of the access token in seconds (refresh before this window ends).

Body — POST /v1/collect

FieldRequiredMeaning
walletAddressYesWhich of your wallets to credit (string identifier, e.g. main).
msisdnYesMobile number — Ugandan format (payer for collection, payee for disbursement; see Integration guide).
amountYesInteger UGX; minimum 500. Upper bound enforced server-side.
referenceYesYour reference for reconciliation (order id, invoice, etc.), stored on the transaction.
webhookUrlYesAbsolute HTTPS URL SwarmByte will POST to for this transaction's lifecycle updates. Must be a valid absolute URL; HTTPS is required in production.

Body — POST /v1/disburse

Same fields as collect, plus pin. For disbursements, amount is the payout to the recipient (fee-on-top from wallet — see Integration guide).

FieldRequiredMeaning
pinYes (programmatic)Your disbursement PIN (digits only, 4–6 characters). Server-side only; never log or expose in clients.

Successful collect/disburse response (202) — data object

FieldMeaning
transactionIdPrimary id for polling and webhooks; store in your system.
walletAddressWallet used for the transaction.
amount / fee / netAmountUGX amounts. Collections: netAmount is what your wallet is credited after the platform fee. Disbursements (fee-on-top): amount is what the recipient receives; fee is debited from your wallet in addition; netAmount equals amount.
statusCurrent transaction status (e.g. PENDING immediately after accept).
providerMobile money provider for the transaction (e.g. MTN or AIRTEL).
createdAtISO 8601 timestamp.

GET /v1/collect/transactions/:transactionId — data (success shape)

FieldMeaning
transactionIdSame id as collect response.
typeMust be COLLECTION on this route (otherwise 403).
statusCurrent lifecycle status (see Status values under Collection status).
providerRefProvider reference when available; may be null early in the flow.
referenceYour merchant reference from the collect request.
failureReasonHuman-readable detail when failed; often null.
updatedAtLast update time.

Disbursement GET responses mirror this list with type: DISBURSEMENT on the disbursement status route.

Inbound webhooks — headers SwarmByte sends

HeaderMeaning
Content-Typeapplication/json
X-Swarmbyte-TimestampISO 8601 time when the webhook request was built (for ordering/debugging).
User-AgentSwarmByte-Webhooks/1.0

HTTP callbacks from SwarmByte to your webhookUrl are not signed (no HMAC or shared-secret header). Rely on HTTPS, an unguessable path if possible, and idempotent handling by transactionId.

Inbound webhooks — JSON fields

FieldMeaning
eventEvent name for this delivery (e.g. collection.initiated, collection.success, collection.failed, disbursement.initiated, disbursement.success, disbursement.failed). You may also receive transaction.updated. Always key your ledger off transactionId, status, and type.
transactionIdSame transactionId returned by collect/disburse and status GET.
statusTransaction status at the time of the webhook.
typeCOLLECTION or DISBURSEMENT.
amount / fee / netAmountUGX values. Collections: netAmount is after fee. Disbursements: amount is recipient payout; netAmount equals amount (fee charged on top from wallet).
msisdnCounterparty mobile number for the payment.
timestampISO 8601 time included in the payload.