> ## 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.

# Delete an entry

> Deletes an entry of an open invoice your organization issued, and takes its amount off the invoice amount.

The entry is not removed: it is kept with `status` `DELETED` and no longer counts toward the invoice amount. The invoice must be `OPEN`; a closed, paid or canceled invoice refuses the request with `INVOICE_NOT_OPEN`. Only an admin of the organization, or an admin of the realm, can delete an entry. When taking the amount off would leave the invoice amount negative, the request is refused with `NEGATIVE_INVOICE_AMOUNT` and nothing changes.

Delete each entry once: the entry's status is not checked, so repeating the call takes its amount off the invoice again.

Answers the entry, with `status` `DELETED` and `updatedBy` set to the ID of the authenticated caller; its `updatedAt` is not refreshed.


## OpenAPI

````yaml /api-reference/billing.openapi.json post /realms/{realmId}/organizations/{organizationId}/invoices/{invoiceId}/entries/{invoiceEntryId}/delete
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/{invoiceEntryId}/delete:
    post:
      tags:
        - Invoice Entries
      summary: Delete an entry
      description: >-
        Deletes an entry of an open invoice your organization issued, and takes
        its amount off the invoice amount.
      operationId: >-
        postRealmsByRealmIdOrganizationsByOrganizationIdInvoicesByInvoiceIdEntriesByInvoiceEntryIdDelete
      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 entry belongs to.

            Format: `UUID`
          schema:
            type: string
            format: uuid
          example: 0b7c2a44-6f1e-4d3b-9a8e-5c2f1d0e9b7a
        - name: invoiceEntryId
          in: path
          required: true
          description: >-
            ID of the entry to delete, as returned by `GET
            .../invoices/{invoiceId}/entries`.


            Format: `UUID`
          schema:
            type: string
            format: uuid
          example: 3f9a1c2e-7b4d-4e8a-9c1f-2d5b6a7c8e90
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                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: MONTHLY_PLAN
                  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: RECURRENT
                  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: Mensalidade do plano Pro
                  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: DELETED
                  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.
        '400':
          description: >-
            `NEGATIVE_INVOICE_AMOUNT` — Taking the entry's amount off would
            leave the invoice amount below zero.
          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:
                      - NEGATIVE_INVOICE_AMOUNT
                    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: NEGATIVE_INVOICE_AMOUNT
                origin: BILLING
                message: Invoice amount can't be less than credit parties amount
        '403':
          description: >-
            `INSUFFICIENT_PERMISSIONS` — You are not an admin of the
            organization nor 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.


            `INVOICEENTRY_NOT_FOUND` — The invoice has no entry with this ID.
          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
                      - INVOICEENTRY_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` — A path parameter 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.