MagenMagen Docs

Glossary

General concepts

TermDefinition
PixInstant payment system from the Central Bank of Brazil. Runs 24/7, settlement in seconds.
DICTDirectory of Transactional Account Identifiers. Bacen's database that maps Pix key → account. Query it before paying.
EMV / BR CodeInternational standard used by Pix to generate copy-and-paste QR Codes. Strings that start with 00020126....
Dynamic QRQR Code with id and (optionally) amount per charge. The only one supported by Magen.
Static QRReusable QR Code. Not supported by Magen.
MEDSpecial Refund Mechanism. Bacen process to contest a Pix in case of fraud or error. Becomes an infraction in Magen.
Bearer tokenAuthentication token sent in the Authorization: Bearer YOUR_TOKEN header. Magen's only auth method.
Callback / WebhookPOST that Magen sends to your callbackUrl when a transaction changes status. Retries up to 72 attempts with backoff.
IdempotencyGuarantee that executing the same operation multiple times has the same effect as executing it once. Use clientReference on creation.
Exponential backoffRetry strategy where the interval between attempts doubles (1s, 2s, 4s, 8s). Used by Magen and recommended on your retries for 5xx/429.
JitterRandom variation added to backoff to avoid "thundering herd" (clients hitting all at once).

Transaction types (type)

ValueWhat it is
DEPOSITPix charge, money coming into your account.
WITHDRAWPix withdrawal, money going out to a Pix key or QR Code.
INTERNAL_TRANSFERTransfer between Magen accounts, instant.
COMMISSIONCommission entry (internal use). May appear in listings and reports.

Transaction status (status)

The status varies by type. Full list:

StatusMeaning
PENDINGAwaiting payment (charge) or processing (withdrawal/transfer).
COMPLETEDCompleted successfully. On deposit: customer paid. On withdrawal: money left the account.
CANCELEDCanceled before completion (manual or by rule).
WAITING_FOR_REFUNDAwaiting refund processing (usually after MED accepted).
REFUNDEDRefunded, amount returned to the payer.
EXPIREDCharge expired without payment (passed expiresIn).
ERRORTechnical error during the operation. See cancellationReason in the payload.

Refund status (refundStatus)

ValueMeaning
PENDINGRefund queued for processing.
COMPLETEDRefund processed, amount returned.
CANCELEDRefund canceled before completion.

Pix key types (pixType)

ValueWhat it is
cpfRecipient's CPF (11 digits).
cnpjRecipient's CNPJ (14 digits).
phonePhone with country/area code in +5511999999999 format.
emailEmail address registered at Bacen.
evpRandom key (UUID generated by the bank).

Infraction / MED

Status (infraction.status)

ValueDescription
WAITING_PSPAwaiting provider response.
OPENInfraction active and under analysis.
ACKNOWLEDGEDAcknowledged by the institution.
DEFENDEDDefense has been submitted.
ANSWEREDAdditional information provided.
WAITING_ADJUSTMENTSAwaiting documentation.
CLOSEDResolved with a final decision (see analysisResult).
CANCELLEDCanceled before resolution.

Type (infraction.type)

ValueDescription
REFUND_REQUESTStandard refund request.
FRAUDSecurity-related complaint.
REFUND_CANCELLEDCancellation of a previous refund.

Analysis result (infraction.analysisResult)

ValueDescription
AGREEDInfraction accepted. Refund will be processed.
DISAGREEDInfraction rejected. No refund, transaction maintained.

Reported by (infraction.reportedBy)

ValueDescription
DEBITED_PARTICIPANTPayer's institution opened it.
CREDITED_PARTICIPANTRecipient's institution opened it.

Common API fields

We keep the English name because that's how they appear in the JSON.

Identification

FieldWhat it's for
idUnique transaction identifier in Magen. Format MAGEN + timestamp + hash.
clientReferenceExternal identifier that you define. Returns in every callback. Maximum 64 characters.
virtualAccountVirtual sub-account (up to 50 chars) for multi-tenant (stores, branches, marketplaces). Returns in the callback.
endToEndIdUnique operation identifier at Bacen. Format E + 32 characters. Useful in disputes.
requestIdUnique call ID at Magen. Appears in every error response (4xx and 5xx). Always log it and send it when opening support, investigation traces directly. See Error format.
accountNumberMagen account number (6 digits). Used in internal transfers.

Amounts

FieldWhat it's for
amountAmount in reais (BRL), not cents. E.g.: 10.90 is R$ 10.90.
serviceFeeChargedFee charged by Magen on the operation, in reais.

Generated charge

FieldWhat it's for
qrCodeTextPix copy-and-paste code (EMV BR Code). Use in an input with a copy button.
qrCodeUrlPublic URL that renders the QR as PNG. Use directly in <img>.
qrCodeBase64QR Code image in Base64.
generatedNameReference name associated with the charge.
generatedDocumentCPF or CNPJ associated with the charge.
generatedEmailEmail linked to the charge.
expiresInCharge expiration time in seconds. Maximum 172000 (47h).

Payer

CampoWhat it's for
payerNamePayer's name (comes in the callback after payment).
payerDocumentPayer's CPF/CNPJ.
payerInstitutionIspbISPB of the payer's bank (8 digits).
payerInstitutionNamePayer's bank name.
payerAccountNumberPayer's Magen account (present in internal transfers).

Recipient

FieldWhat it's for
receiverNameRecipient's name (in withdrawals).
receiverDocumentRecipient's CPF/CNPJ.
receiverInstitutionIspbISPB of the recipient's bank.
receiverInstitutionNameRecipient's bank name.
receiverAccountNumberRecipient's Magen account (in internal transfers).

Withdrawal by key

FieldWhat it's for
pixKeyRecipient's Pix key. Format depends on pixType.
pixTypeKey type: cpf, cnpj, phone, email, evp.
withdrawPixKeyKey used in the withdrawal (in the callback).
withdrawPixTypeType of key used in the withdrawal.

Settlement and refund

FieldWhat it's for
paidAtPayment timestamp (ISO 8601). Present after COMPLETED.
cancellationReasonCancellation reason.
refundEndToEndIdEndToEnd ID of the refund.
refundAmountRefunded amount.
refundStatusRefund status: PENDING, COMPLETED, CANCELED.
refundReasonRefund reason.
refundDescriptionRefund description.
refundedAtRefund timestamp (ISO 8601).

Other

FieldWhat it's for
callbackUrlURL where Magen posts transaction updates.
descriptionFree text up to 140 characters (used in withdrawal and internal transfer).
createdAtTransaction creation timestamp (ISO 8601).
updatedAtLast update (ISO 8601).
infractionObject present in the callback when the transaction becomes a MED dispute.

HTTP codes

CodeWhat it means
200Operation successful.
201Resource created (charge, withdrawal, transfer).
204Success with no response body.
400Invalid payload. See message for details.
401Token missing, invalid, or revoked.
403Valid token but no permission for the endpoint.
404Resource not found.
409Conflict (duplicate, resource in invalid state).
422Semantic validation failed.
429Rate limit reached. Wait and retry with backoff.
5xxServer error. Retry with exponential backoff (5xx and 429 only).

Additional acronyms (Bacen / Pix)

AcronymExpansion
BacenCentral Bank of Brazil.
PSPPayment Service Provider. Each bank/fintech is a PSP.
ISPBBrazilian Payment System Identifier. 8-digit code that identifies each PSP.
SPIInstant Payment System. Bacen's infrastructure that processes Pix.
CACCChecking account (ISO 20022 naming used by Bacen).
SVGSSavings account.
TRANPayment account (transitional).
CUIDUnique string identifier used by Magen in internal resources (e.g.: infraction id).

On this page