Create an invoice from a transaction or refund

You can create an invoice directly from a transaction created with Create a transaction/tax calculation, or from a refund created with Create a refund. Brinta builds the invoice from the stored transaction or refund: supplier, buyer, items, taxes, currency, exchange rate and payment method all come from it, so you don't send them again.

The transaction or refund needs to be in "pending" status.

Once the invoice is created, you can Update a transaction or Update a refund with the invoice information.

Endpoint

POST https://api.brinta.com/invoices

This is the same endpoint as Create an invoice, called with a different body.

Request body

ParameterTypeRequiredDescription
transaction_idStringConditionalId of the transaction to invoice. The transaction must be in "pending" status. Send this or refund_id.
refund_idStringConditionalId of the refund to invoice. The refund must be in "pending" status. Send this or transaction_id.
document_typeStringOptionalType of the invoice document, e.g. invoice or services invoice. See possible values in Invoice document types.
e_invoiceBooleanOptionalWhether the invoice is processed electronically through the tax authority. Defaults to true.
invoice_dateStringOptionalDate of the invoice. Defaults to the creation date.
invoice_due_dateStringOptionalDue date of the invoice. Format: YYYY-MM-DD.
additional_infoStringOptionalAdditional information printed on the invoice.
buyerObjectOptionalBuyer of the invoice, with the same shape as in Create an invoice. Replaces the buyer stored on the transaction.
itemsArrayOptionalChanges to the name or description of the transaction items. Each entry has the id of the transaction item and the new name and/or description. Amounts and taxes always come from the transaction.
origin_company_idStringOptionalCompany id on Brinta's system of the supplier, when it is different from the company holder of the token.
origin_company_external_idStringOptionalCompany id on the client's system of the supplier, when it is different from the company holder of the token.

The invoice type is set for you:

  • A transaction creates a debit invoice.
  • A refund creates a credit invoice.
🚧

Send only one of transaction_id or refund_id

A body with both is rejected with a 400. Don't send invoice_type either: together with currency, document_type and buyer it makes the request a regular invoice, and it is rejected. Fields not listed above, such as currency, supplier_company_id or category, are ignored: they come from the transaction.

Examples

Invoice from a transaction (Mexico)

{
  "transaction_id": "e3e83083-9572-4697-bc19-07c9dafe1cec",
  "document_type": "invoice",
  "e_invoice": true
}

Services invoice from a transaction (Brazil)

{
  "transaction_id": "653c9a54-d56a-4824-9458-1fecc3f0e97b",
  "document_type": "services invoice",
  "e_invoice": true,
  "invoice_date": "2026-10-01",
  "invoice_due_date": "2026-10-31",
  "additional_info": "Service provided in October 2026."
}

Invoice from a transaction, changing the buyer and an item name

{
  "transaction_id": "e3e83083-9572-4697-bc19-07c9dafe1cec",
  "document_type": "invoice",
  "e_invoice": true,
  "buyer": {
    "company": {
      "legal_name": "BRINTA DEMO TEST SA DE CV",
      "type": "business",
      "email": "[email protected]",
      "address": {
        "postal_code": "06500",
        "state": "MX-CMX",
        "country": "MX"
      },
      "tax_registrations": [
        {
          "number": "BDT030917C22",
          "type": "RFC",
          "level": "country",
          "location": "MX"
        }
      ]
    }
  },
  "items": [
    {
      "id": 1,
      "name": "Monthly subscription - October 2026",
      "description": "Premium plan"
    }
  ]
}

Credit invoice from a refund, for a child company

{
  "refund_id": "7c718fe1-afeb-4482-bf09-82de8fce342d",
  "e_invoice": true,
  "origin_company_external_id": "CLI-98765",
  "additional_info": "Refund of order 4569652912."
}

Response

201 Created, with the created invoice. The response has the same shape as Create an invoice. Use its id to Get an invoice and follow its status.