> ## Documentation Index
> Fetch the complete documentation index at: https://developers.portao3.com.br/llms.txt
> Use this file to discover all available pages before exploring further.

# Add entries to an invoice

> Adds charges (line items) to an open invoice your organization issued: an on-demand charge for the invoice's period, on top of the entries generated from the deal's products.

Each entry's `amount` is added to the invoice amount, so the invoice must be `OPEN`: a closed, paid or canceled invoice refuses the request with `INVOICE_NOT_OPEN`. Send from 1 to 50 entries; they are created together, in the order sent. A field that is not documented is ignored and never stored. `createdBy` and `updatedBy` are set to the ID of the authenticated caller; they can't be sent in the body.

An entry whose `chargeMethod` is `INSTANT` is also charged to the payer's Portão 3 account right away, as a P2P payment of its amount, when P2P is enabled for your organization. That charge is attempted after the entries are saved and its outcome is not reported: a `201` does not mean the payer was charged. When the charge fails the entry stays on the invoice; check the invoice's statements to see which payments were created.

Any member of the organization, or an admin of the realm, can add entries. Answers the entries it created.


## OpenAPI

````yaml /api-reference/billing.openapi.json post /realms/{realmId}/organizations/{organizationId}/invoices/{invoiceId}/entries
openapi: 3.0.3
info:
  title: Billing
  version: 1.0.0
  description: >-
    Portão 3 billing API. Every endpoint requires a bearer token in the
    Authorization header (Authorization: Bearer <token>) unless its page states
    otherwise; see the Authentication guide. That requirement is not repeated
    per endpoint. Generated by tools/openapi from code (routes + security) and
    the hand-written spec (request/response bodies). Full billing surface —
    contracts, deals, invoices, statements, payment links, checkout and NFSe
    orchestration. (The product/supplier catalog moved to registry.) Confidence
    tiers: generated:typed=74 copied:manual=0 unknown=5.
servers:
  - url: https://api.billing.v2.portao3.com.br/
    description: production
  - url: https://api.billing.dev.3pers.com.br/
    description: development
security: []
tags:
  - name: Contracts
  - name: Deals
  - name: Invoices
  - name: Invoice Entries
  - name: Invoice Statements
  - name: NFSe Configuration
  - name: Payment Links
paths:
  /realms/{realmId}/organizations/{organizationId}/invoices/{invoiceId}/entries:
    post:
      tags:
        - Invoice Entries
      summary: Add entries to an invoice
      description: >-
        Adds charges (line items) to an open invoice your organization issued:
        an on-demand charge for the invoice's period, on top of the entries
        generated from the deal's products.
      operationId: >-
        postRealmsByRealmIdOrganizationsByOrganizationIdInvoicesByInvoiceIdEntries
      parameters:
        - name: realmId
          in: path
          required: true
          description: |-
            ID of your realm.

            Format: `UUID`
          schema:
            type: string
            format: uuid
          example: f495ff0c-ab54-4f99-8e92-ca8682e4de9b
        - name: organizationId
          in: path
          required: true
          description: |-
            ID of the organization that issued the invoice.

            Format: `UUID`
          schema:
            type: string
            format: uuid
          example: c4bd3f21-dfbd-44e8-8055-68ba15bed410
        - name: invoiceId
          in: path
          required: true
          description: |-
            ID of the invoice the entries are added to.

            Format: `UUID`
          schema:
            type: string
            format: uuid
          example: 0b7c2a44-6f1e-4d3b-9a8e-5c2f1d0e9b7a
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                entries:
                  minItems: 1
                  maxItems: 50
                  type: array
                  items:
                    type: object
                    properties:
                      identifier:
                        type: string
                        minLength: 1
                        maxLength: 100
                        description: >-
                          What the charge is for, such as `SETUP_FEE`. Free
                          text, 1–100 characters; a number is read as its text.
                          Entries with the same identifier (ignoring case) are
                          grouped when you list with `details`.
                        example: SETUP_FEE
                      description:
                        description: Free text describing the charge, up to 100 characters.
                        example: Taxa de instalação
                        type: string
                        maxLength: 100
                      chargeMethod:
                        type: string
                        enum:
                          - INSTANT
                          - LATER
                        description: >-
                          When the charge is collected. `LATER`: it is added to
                          the invoice and paid with it. `INSTANT`: it is also
                          debited from the payer's Portão 3 account right away.
                        example: LATER
                      productType:
                        type: string
                        enum:
                          - RECURRENT
                          - ONE_TIME
                          - ON_EVENT
                        description: >-
                          How the charge is classified, with the values a deal's
                          products use: `RECURRENT`, `ONE_TIME` or `ON_EVENT` (a
                          charge made when something happens, which is what an
                          entry added here usually is). It is stored as a label:
                          it does not change how the entry is charged.
                        example: ON_EVENT
                      amount:
                        type: integer
                        minimum: 1
                        description: >-
                          Amount of the charge in centavos (`15000` is R$
                          150,00). A whole number, `1` or more; a string of
                          digits is also accepted.
                        example: 15000
                    required:
                      - identifier
                      - chargeMethod
                      - productType
                      - amount
                  description: The charges to add, from 1 to 50 per request.
              required:
                - entries
      responses:
        '201':
          description: Successful response
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: string
                      description: ID of the entry.
                      example: 3f9a1c2e-7b4d-4e8a-9c1f-2d5b6a7c8e90
                      format: uuid
                    identifier:
                      type: string
                      description: >-
                        What the charge is for: the identifier of the deal
                        product that generated the entry, or the label sent when
                        it was added through the API. Free text.
                      example: SETUP_FEE
                    invoice:
                      type: string
                      description: ID of the invoice the entry belongs to.
                      example: 0b7c2a44-6f1e-4d3b-9a8e-5c2f1d0e9b7a
                      format: uuid
                    amount:
                      type: integer
                      description: >-
                        Amount of the charge in centavos (`15000` is R$ 150,00).
                        It counts toward the invoice amount while the entry is
                        `OPEN`.
                      example: 15000
                    chargeMethod:
                      type: string
                      enum:
                        - INSTANT
                        - LATER
                      description: >-
                        When the charge is collected. `LATER`: it is added to
                        the invoice and paid with it. `INSTANT`: it is also
                        debited from the payer's Portão 3 account as soon as it
                        is added.
                      example: LATER
                    productType:
                      type: string
                      enum:
                        - RECURRENT
                        - ONE_TIME
                        - ON_EVENT
                      description: >-
                        When the charge's product is billed. `RECURRENT`: on
                        every invoice of the deal. `ONE_TIME`: on the first
                        invoice only. `ON_EVENT`: never automatically; such an
                        entry is added through the API, when the event happens.
                      example: ON_EVENT
                    effectiveAt:
                      type: string
                      description: 'When the entry took effect: the moment it was created.'
                      example: '2026-10-01T09:00:00.000Z'
                      format: date-time
                    external:
                      type: object
                      properties:
                        transaction:
                          type: string
                          description: >-
                            ID of the payment transaction linked to the entry,
                            when there is one. Entries created through this API
                            don't carry one.
                          example: 6711b4c0d8e1a30012b7c9f2
                      description: References of the entry outside the invoice.
                    description:
                      type: string
                      description: >-
                        Free text describing the charge. Empty when there is
                        none.
                      example: Taxa de instalação
                    status:
                      type: string
                      enum:
                        - OPEN
                        - DELETED
                      description: >-
                        `OPEN`: the entry counts toward the invoice amount.
                        `DELETED`: the entry was deleted and no longer counts.
                      example: OPEN
                    createdBy:
                      type: string
                      description: >-
                        ID of who created the entry: the authenticated caller of
                        the API that added it, or the Portão 3 service that
                        generated it from the deal.
                      example: 5f0c2b1e-8a3d-4e6f-9b7c-2d1a0e9f8c7b
                    updatedBy:
                      type: string
                      description: >-
                        ID of who last changed the entry: who created it, until
                        someone deletes it.
                      example: 5f0c2b1e-8a3d-4e6f-9b7c-2d1a0e9f8c7b
                    createdAt:
                      type: string
                      description: >-
                        When the entry was created. Entries added in the same
                        request are one minute apart, in the order they were
                        sent, so that a listing keeps that order.
                      example: '2026-10-01T09:00:00.000Z'
                      format: date-time
                    updatedAt:
                      type: string
                      description: >-
                        When the entry was last changed. Deleting an entry does
                        not refresh it.
                      example: '2026-10-01T09:00:00.000Z'
                      format: date-time
                  required:
                    - id
                    - identifier
                    - invoice
                    - amount
                    - chargeMethod
                    - productType
                    - effectiveAt
                    - external
                    - description
                    - status
                    - createdBy
                    - updatedBy
                    - createdAt
                    - updatedAt
                  description: >-
                    One charge (line item) of an invoice. The invoice amount is
                    the sum of the amounts of its `OPEN` entries.
        '403':
          description: >-
            `INSUFFICIENT_PERMISSIONS` — You are not a member of the
            organization nor an admin of the realm.
          content:
            application/json:
              schema:
                type: object
                properties:
                  traceId:
                    type: string
                    description: >-
                      Identifier of the request that failed. Quote it when
                      contacting support.
                    example: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                  code:
                    type: string
                    enum:
                      - INSUFFICIENT_PERMISSIONS
                    description: >-
                      Stable, machine-readable error code. Branch on this, never
                      on `message`.
                  origin:
                    type: string
                    enum:
                      - BILLING
                    description: Service that produced the error.
                  message:
                    type: string
                    description: >-
                      Human-readable explanation. Its wording may change without
                      notice.
                required:
                  - traceId
                  - code
                  - origin
                  - message
              example:
                traceId: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                code: INSUFFICIENT_PERMISSIONS
                origin: BILLING
                message: insufficient permissions
        '404':
          description: >-
            `INVOICE_NOT_FOUND` — No invoice with this ID was issued by the
            organization.
          content:
            application/json:
              schema:
                type: object
                properties:
                  traceId:
                    type: string
                    description: >-
                      Identifier of the request that failed. Quote it when
                      contacting support.
                    example: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                  code:
                    type: string
                    enum:
                      - INVOICE_NOT_FOUND
                    description: >-
                      Stable, machine-readable error code. Branch on this, never
                      on `message`.
                  origin:
                    type: string
                    enum:
                      - BILLING
                    description: Service that produced the error.
                  message:
                    type: string
                    description: >-
                      Human-readable explanation. Its wording may change without
                      notice.
                required:
                  - traceId
                  - code
                  - origin
                  - message
              example:
                traceId: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                code: INVOICE_NOT_FOUND
                origin: BILLING
                message: invoice not found
        '422':
          description: >-
            `INVOICE_NOT_OPEN` — The invoice is closed, paid or canceled.


            `BAD_REQUEST` — The body is invalid, such as a missing or empty
            `entries`, an unknown `chargeMethod` or `productType`, an `amount`
            that is not a whole number of centavos, or a path parameter that is
            not a valid ID; `fields` lists each one.
          content:
            application/json:
              schema:
                type: object
                properties:
                  traceId:
                    type: string
                    description: >-
                      Identifier of the request that failed. Quote it when
                      contacting support.
                    example: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                  code:
                    type: string
                    enum:
                      - INVOICE_NOT_OPEN
                      - BAD_REQUEST
                    description: >-
                      Stable, machine-readable error code. Branch on this, never
                      on `message`.
                  origin:
                    type: string
                    enum:
                      - BILLING
                    description: Service that produced the error.
                  message:
                    type: string
                    description: >-
                      Human-readable explanation. Its wording may change without
                      notice.
                  fields:
                    type: array
                    description: >-
                      One entry per invalid request field (validation errors
                      only).
                    items:
                      type: object
                      properties:
                        field:
                          type: string
                          description: >-
                            Path of the invalid field, e.g. `label` or
                            `values[0].value`.
                          example: label
                        message:
                          type: string
                          description: Why the field was rejected.
                          example: label is required
                        code:
                          type: string
                          description: >-
                            `<FIELD>_<REASON>` — e.g. `LABEL_REQUIRED`,
                            `TYPE_ONE_OF`, `VALUES_VALUE_TYPE_ERROR`.
                          example: LABEL_REQUIRED
                        values:
                          type: array
                          items:
                            type: string
                          description: >-
                            The accepted values, when the field is an
                            enumeration.
                      required:
                        - field
                        - message
                        - code
                required:
                  - traceId
                  - code
                  - origin
                  - message
              example:
                traceId: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                code: INVOICE_NOT_OPEN
                origin: BILLING
                message: invoice is not open for changes

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.