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

# Export deals

> Exports the deals of your organization as a CSV or XLSX file.

The file has every deal that matches the same filters and order as the deal list, one per row, with six columns whose headers are in Portuguese: `Descrição` (the description), `Cliente` (the payer's name), `Quantidade` (the number of installments), `Data de vencimento` (the deal's end date, as `DD/MM/YYYY`, UTC), `Status` (`Ativo`, `Cancelado`, `Terminado`, `Expirado` or `Revogado`) and `Valor` (what the invoices are expected to charge in total, in reais, as `1.234,56`). When no deal matches, the file has the header and one row with `Quantidade` `0` and `Valor` `0,00`.

`?type=csv` answers a UTF-8 CSV file; `?type=xlsx` an Excel workbook, base64-encoded. An export is limited to 50,000 deals and 4 MiB: narrow the filters to export more. Any member of the organization, or an admin of the realm, can export them.


## OpenAPI

````yaml /api-reference/billing.openapi.json get /realms/{realmId}/organizations/{organizationId}/deals/export
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}/deals/export:
    get:
      tags:
        - Deals
      summary: Export deals
      description: Exports the deals of your organization as a CSV or XLSX file.
      operationId: getRealmsByRealmIdOrganizationsByOrganizationIdDealsExport
      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 your organization: the one whose deals you export.

            Format: `UUID`
          schema:
            type: string
            format: uuid
          example: c4bd3f21-dfbd-44e8-8055-68ba15bed410
        - name: type
          in: query
          required: true
          description: Format of the exported file.
          schema:
            type: string
            enum:
              - csv
              - xlsx
          example: csv
        - name: encoding
          in: query
          required: false
          description: >-
            How an `xlsx` file is encoded in the response body: always `base64`,
            the default. A `csv` file is always sent as plain text.
          schema:
            default: base64
            type: string
            enum:
              - base64
          example: base64
        - name: status
          in: query
          required: false
          description: |-
            Only deals in these statuses.

            ---

            Example (comma-separated list): `?status=OPEN,TERMINATED`
          schema:
            type: array
            items:
              type: string
              enum:
                - OPEN
                - CANCELED
                - TERMINATED
                - EXPIRED
                - REVOKED
          style: form
          explode: false
        - name: debitPartyDocuments
          in: query
          required: false
          description: >-
            Only deals whose debit party has one of these documents (exact
            match).


            ---


            Example (comma-separated list):
            `?debitPartyDocuments=11144477735,39053344705`
          schema:
            type: array
            items:
              type: string
          style: form
          explode: false
        - name: debitPartyOrgIds
          in: query
          required: false
          description: >-
            Only deals whose payer (the debit party) pays from a Portão 3 wallet
            of one of these organizations. It matches the organization of the
            payer's wallet, so a payer with no wallet (a customer who pays by
            boleto or PIX, for example) is not found by it: filter by
            `debitPartyDocuments` instead.


            Format: `UUID`


            ---


            Example: `?debitPartyOrgIds=5e0a1c2b-3d4f-4a6b-8c9d-0e1f2a3b4c5d`
          schema:
            type: array
            items:
              type: string
              format: uuid
          style: form
          explode: false
        - name: chargeType
          in: query
          required: false
          description: Only deals with this charge type.
          schema:
            type: string
            enum:
              - SINGLE
              - RECURRENT
              - SUBSCRIPTION
          example: RECURRENT
        - name: numberOfInstallments
          in: query
          required: false
          description: Only deals with exactly this number of installments.
          schema:
            type: integer
            minimum: 1
          example: 12
        - name: description
          in: query
          required: false
          description: Only deals whose description contains this text (case-insensitive).
          schema:
            type: string
            maxLength: 250
          example: Gold plan
        - name: startAt
          in: query
          required: false
          description: >-
            Only deals that start on or after this date (ISO 8601 date or
            date-time).
          schema:
            anyOf:
              - type: string
                format: date
              - type: string
                format: date-time
          example: '2026-01-01T00:00:00.000Z'
        - name: endAt
          in: query
          required: false
          description: >-
            Only deals that end on or before this date (ISO 8601 date or
            date-time). Combines with `endAtFrom` and `endAtTo`: every bound you
            send applies.
          schema:
            anyOf:
              - type: string
                format: date
              - type: string
                format: date-time
          example: '2026-12-31T00:00:00.000Z'
        - name: endAtFrom
          in: query
          required: false
          description: >-
            Only deals that end on or after this date, inclusive (ISO 8601 date
            or date-time). Send `endAtTo` as well for a closed range.
          schema:
            anyOf:
              - type: string
                format: date
              - type: string
                format: date-time
          example: '2026-02-01T00:00:00.000Z'
        - name: endAtTo
          in: query
          required: false
          description: >-
            Only deals that end on or before this date, inclusive (ISO 8601 date
            or date-time). Send `endAtFrom` as well for a closed range.
          schema:
            anyOf:
              - type: string
                format: date
              - type: string
                format: date-time
          example: '2026-03-01T00:00:00.000Z'
        - name: startDate
          in: query
          required: false
          description: >-
            Only deals created on or after this date, inclusive (ISO 8601 date
            or date-time). Send `endDate` as well for a closed window.
          schema:
            anyOf:
              - type: string
                format: date
              - type: string
                format: date-time
          example: '2026-04-01T00:00:00.000Z'
        - name: endDate
          in: query
          required: false
          description: >-
            Only deals created on or before this date, inclusive (ISO 8601 date
            or date-time). Send `startDate` as well for a closed window.
          schema:
            anyOf:
              - type: string
                format: date
              - type: string
                format: date-time
          example: '2026-05-01T00:00:00.000Z'
        - name: order
          in: query
          required: false
          description: Sort direction. Case-insensitive.
          schema:
            default: DESC
            type: string
            enum:
              - ASC
              - DESC
          example: DESC
        - name: orderBy
          in: query
          required: false
          description: Field to sort the deals by.
          schema:
            default: createdAt
            type: string
            enum:
              - createdAt
              - description
              - startAt
          example: createdAt
      responses:
        '200':
          description: >-
            `application/csv` — The deals as a UTF-8 CSV file, when `type` is
            `csv`.


            `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`
            — The Excel workbook, base64-encoded, when `type` is `xlsx`.
          content:
            application/csv:
              schema:
                type: string
                description: The deals as a UTF-8 CSV file, when `type` is `csv`.
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
              schema:
                type: string
                format: byte
                description: The Excel workbook, base64-encoded, when `type` is `xlsx`.
        '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
        '422':
          description: >-
            `EXPORT_TOO_LARGE` — More than 50,000 deals match, or the file would
            exceed 4 MiB.


            `BAD_REQUEST` — A path or query parameter is invalid, such as a
            missing `type`; `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:
                      - EXPORT_TOO_LARGE
                      - 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: EXPORT_TOO_LARGE
                origin: BILLING
                message: >-
                  This export is too large to generate in a single request.
                  Narrow the filters (for example a shorter date range) and try
                  again.

````

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