Skip to content
A AmunPay API PixVersion 3.38 · updated on Pages

Create Pix charge

Creates a charge with a dynamic QR. The txid is yours: repeating the same txid returns the charge already created, without changing it, with 200 and the header x-replayed: true. With a different debtor document, amount, ex.subconta or ex.splitConfig, the response is 409. For another charge, use another txid.

PUT /v2/cob/{txid}

Scope: cob.write.

PUT /v2/cob/COB01J1ZK7M9QW3ERT5TY6UI8O
{
  "calendario": { "expiracao": 900 },
  "devedor": { "cpf": "12345678909", "nome": "Fulano de Tal" },
  "valor": { "original": "150.00" },
  "solicitacaoPagador": "Pedido 778812"
}
→ 201
{
  "txid": "COB01J1ZK7M9QW3ERT5TY6UI8O",
  "revisao": 0,
  "status": "ATIVA",
  "calendario": { "criacao": "2026-09-18T12:00:00.767Z", "expiracao": 900 },
  "devedor": { "cpf": "12345678909", "nome": "Fulano de Tal" },
  "valor": { "original": "150.00" },
  "chave": "01J8Z3QK5W7R2N4M6P8T0V2X4Y",
  "solicitacaoPagador": "Pedido 778812",
  "pixCopiaECola": "00020126480014br.gov.bcb.pix0126...6304C057"
}

Request fields #

Field Type Required Description
valor.original string yes Amount with two decimal places, greater than zero.
valor.modalidadeAlteracao integer no Only 0: the payer cannot change the amount. If omitted, it is 0.
devedor.cpf string one of the two CPF of the person who will pay, 11 digits. Only a Pix paid by that document becomes balance.
devedor.cnpj string one of the two CNPJ of the payer, instead of the cpf, where capacidades.devedorPJ is true. 14 positions, without punctuation.
devedor.nome string depends Name of the payer. Required when capacidades.cobrancaSemNome is false.
calendario.expiracao integer no Seconds until the QR expires. If omitted, 900, or the maximum the account accepts when that is lower. Above that maximum, it becomes the maximum.
solicitacaoPagador string no Text shown to the payer.
ex.subconta string no Id of the sub-account that receives. If omitted, the main account receives.
ex.splitConfig string no Id of a split configuration. See the internal reference.

Some accounts accept a maximum expiration lower than 900 seconds. Without calendario.expiracao, or with a value above that maximum, the charge is created with the maximum of the account, and the response carries the stored number. Asking for a value below the minimum of the account responds 422 expiracao_nao_suportada_no_custodiante, with the limits in violacoes, and the charge is not created.

In some accounts the validity of the QR is set by the institution, and not by the requested expiration. In those the charge expires together with the QR, and calendario.expiracao in the response carries that validity, which may be longer or shorter than the requested one. A Pix paid within it is credited. Always use the expiration from the response.

Some accounts do not issue a charge without the name of the payer. To find out, read capacidades.cobrancaSemNome in GET /v2/ex/config: when it is false, send devedor.nome, or the charge responds 422 nome_do_pagador_obrigatorio and is not created.

Some accounts only issue charges within a range of amounts. Outside it, the charge responds 422 valor_abaixo_do_minimo or 422 valor_acima_do_maximo, with the limit in detail, and is not created. When there is more than one account for your charges, it is created in another one that accepts the amount, and the refusal only comes when none of them accepts it.

With ex.subconta, both rules are those of the sub-account: read GET /v2/ex/config?subconta={id}.

An unknown field inside ex responds 400 campo_desconhecido. The chave is filled in by us and must not be sent.

To charge a company, send devedor.cnpj instead of the cpf. This applies where capacidades.devedorPJ is true in GET /v2/ex/config; where it is false, the cnpj is rejected. Send one of the two, never both.

Where capacidades.cobrancaSemDevedor is true, the charge may be created without devedor.cpf and without devedor.cnpj, and then anyone can pay it. On these accounts, a devedor.cpf or devedor.cnpj that is not a valid document is discarded together with devedor, and the charge is created without it; a document with punctuation that is valid without it is used, without the punctuation.

The Pix only becomes balance when the payer has the same document as devedor. If another person or company pays the QR, the amount does not become balance and stays with the payer: you receive cob.pagamento_rejeitado with motivo equal to TITULARIDADE and, if the money did come in, devolucao.criada with the same reason. Send in devedor the document of the person who will actually pay.

On some accounts the institution reports the CPF of the payer only masked, such as ***456789**. Where it confirms that this is the CPF of the payer, the Pix is matched by the six visible digits and by the first and last name in devedor.nome, and the CPF of the payer also reaches you masked. On these accounts capacidades.cobrancaSemNome is false: a charge with devedor.cpf requires devedor.nome with the first name and the surname of the person who will pay, or it responds 422 nome_do_pagador_obrigatorio and is not created. On the other accounts where the CPF arrives masked, a charge with devedor responds 422 titularidade_sem_confirmacao and is not created, and so does a charge with devedor.cnpj on the accounts that match by the six digits.

Response fields #

Field Type Description
status string ATIVA, CONCLUIDA, REMOVIDA_PELO_USUARIO_RECEBEDOR or REMOVIDA_PELO_PSP.
pixCopiaECola string The BR Code. Show it as a QR or as text to copy.
revisao integer Goes up with each change to the charge.
calendario.criacao string Instant of creation.

When the payment becomes balance, you receive the webhook pix.creditado. A rejected Pix does not produce pix.creditado: it arrives as pix.recebido with situacaoFundos equal to EM_DEVOLUCAO, followed by devolucao.criada. Look up the charge in Get charge.

There is also POST /v2/cob, with the same body, in which the txid is generated by us. Prefer the PUT.

Errors #

Status title When
400 txid_invalido txid outside 26 to 35 alphanumeric characters.
400 valor_invalido Amount outside the format "0.00" or not positive.
400 cpf_invalido devedor.cpf outside the format. Where capacidades.cobrancaSemDevedor is true this error does not happen: the charge proceeds without the payer.
400 cnpj_invalido devedor.cnpj outside the format or with a wrong check digit. Where capacidades.cobrancaSemDevedor is true this error does not happen: the charge proceeds without the payer.
400 documento_invalido devedor.cpf and devedor.cnpj together.
400 devedor_obrigatorio Neither devedor.cpf nor devedor.cnpj, where capacidades.cobrancaSemDevedor is false. The reason comes in detail.
400 devedor_pj_nao_permitido devedor.cnpj where capacidades.devedorPJ is false.
400 campo_desconhecido A field that does not exist inside ex.
403 subconta_indisponivel ex.subconta exists and is not ATIVA.
409 txid_duplicado The same txid already exists with a different debtor document, amount, ex.subconta or ex.splitConfig.
422 nome_do_pagador_obrigatorio The account requires devedor.nome and it was not sent, or it was sent without the first name and the surname where they match the Pix. The charge was not created.
422 titularidade_sem_confirmacao The account does not report who paid, and a charge with the payer document would be returned. The charge was not created; contact support.
422 cobranca_recusada_no_custodiante The institution of the account refused to issue the QR. The reason comes in detail. The charge was not created; do not repeat with the same body.
422 expiracao_nao_suportada_no_custodiante calendario.expiracao below the minimum the account accepts. The limits come in violacoes.
422 valor_abaixo_do_minimo valor.original below the minimum charge amount of the account. The minimum comes in detail, and the charge is not created.
422 valor_acima_do_maximo valor.original above the maximum charge amount of the account. The maximum comes in detail, and the charge is not created.
422 subconta_nao_encontrada ex.subconta does not exist.
422 split_config_nao_encontrada ex.splitConfig does not exist.
502 custodiante_indisponivel Failure to issue the QR at the institution. The charge was not created; repeat with the same txid. If it responds 502 again without the Retry-After header, create it with a new txid. With Retry-After, repeat with the same txid after the indicated time, in seconds: 1 when the institution was slow and the issuance continues (the QR that arrives is saved, and the retry receives the charge), when the same charge is being issued in another request, or when the institution has too many charges waiting or yours already take half of its slots; the time left in the pause when the institution stopped issuing the QR for your charges and their issuance is paused; and the time the institution asked for when it limited the requests.