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

# List dunning schedules

> Lists the dunning schedules of the tenant with their dunning steps, newest first by creation time. Archived dunning schedules are listed only when `includeArchived` is true.

Requires the role `dunning:read`.



## OpenAPI

````yaml /api-reference/openapi.yaml get /v1/dunning-schedules/
openapi: 3.1.0
info:
  title: API Reference
  version: '1.0'
  description: Aira API Reference
  x-logo:
    url: https://static.useaira.com/images/airalogo.svg
    backgroundColor: '#FFFFFF'
    altText: Aira Logo
servers:
  - url: https://api.useaira.com
    description: API base URL
security:
  - ApiKey: []
paths:
  /v1/dunning-schedules/:
    get:
      tags:
        - Dunning
      summary: List dunning schedules
      description: >-
        Lists the dunning schedules of the tenant with their dunning steps,
        newest first by creation time. Archived dunning schedules are listed
        only when `includeArchived` is true.


        Requires the role `dunning:read`.
      parameters:
        - schema:
            type: string
          example: padrão
          in: query
          name: search
          required: false
          description: >-
            Free-text search over the dunning schedule name, ignoring case and
            accents.
        - schema:
            type: boolean
            default: false
          in: query
          name: includeArchived
          required: false
          description: Whether archived dunning schedules should be returned.
        - schema:
            type: integer
            default: 0
            minimum: 0
            maximum: 2147483647
          in: query
          name: offset
          required: false
          description: Number of items to skip before collecting the page.
        - schema:
            type: integer
            minimum: 1
            default: 100
            maximum: 100
          in: query
          name: limit
          required: false
          description: Maximum number of items to return per page.
      responses:
        '200':
          description: The dunning schedules that match the filters.
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      type: object
                      description: >-
                        A dunning schedule: the sequence of e-mails about an
                        invoice, from its issue to after its due date, and after
                        its payment. Each customer follows at most one.
                      properties:
                        id:
                          type: string
                          format: uuid
                          description: >-
                            The unique identifier of the dunning schedule in our
                            system.
                        name:
                          type: string
                          minLength: 1
                          description: The name of the dunning schedule.
                          example: Régua padrão
                        isDefault:
                          type: boolean
                          description: >-
                            Whether the dunning schedule is the default one of
                            the tenant, which a customer follows when its
                            creation leaves out the dunning schedule. A tenant
                            has at most one default dunning schedule, and an
                            archived dunning schedule is never the default.
                        archivedAt:
                          type:
                            - 'null'
                            - string
                          format: date-time
                          description: >-
                            The timestamp when the dunning schedule was
                            archived, or null if not archived. An archived
                            dunning schedule cannot be changed or assigned to a
                            customer.
                        steps:
                          type: array
                          items:
                            type: object
                            description: >-
                              A dunning step: one e-mail of a dunning schedule,
                              sent on the issue day, on the due date, a number
                              of days before or after the due date, or after the
                              payment. A dunning step goes out inside the
                              `dispatchWindow` of the dunning settings, so with
                              `business_hours` a dunning step whose day falls on
                              a Saturday or a Sunday goes out at 09:00 of the
                              next Monday.
                            properties:
                              id:
                                type: string
                                format: uuid
                                description: >-
                                  The unique identifier of the dunning step in
                                  our system.
                              name:
                                type: string
                                minLength: 1
                                description: The name of the dunning step.
                                example: Lembrete de vencimento
                              anchor:
                                type: string
                                enum:
                                  - issued
                                  - on_due_date
                                  - due_date
                                  - on_payment_confirmation
                                description: >-
                                  When the dunning step sends its e-mail:
                                  `issued` on the issue day of the invoice,
                                  `on_due_date` on its due date, `due_date` the
                                  number of days in `offsetDays` from its due
                                  date, and `on_payment_confirmation` after Aira
                                  records its payment.
                              offsetDays:
                                type:
                                  - 'null'
                                  - integer
                                description: >-
                                  The number of days from the due date on which
                                  a `due_date` step sends, after the due date
                                  when positive and before it when negative. It
                                  is null for every other anchor.
                                example: 5
                              channel:
                                type: string
                                enum:
                                  - email
                                description: >-
                                  The channel through which the dunning step
                                  reaches the invoice recipients.
                              content:
                                type: object
                                description: >-
                                  The e-mail that the dunning step sends. The
                                  subject, the title and the body can hold
                                  variables in double braces, such as `{{
                                  invoiceNumber }}`, `{{ dueDate }}` or `{{
                                  paymentLink }}`, which Aira fills in for each
                                  invoice.
                                properties:
                                  subject:
                                    type: string
                                    minLength: 1
                                    description: The subject of the e-mail.
                                    example: Sua fatura {{ invoiceNumber }}
                                  title:
                                    type: string
                                    minLength: 1
                                    description: >-
                                      The title that the e-mail shows above its
                                      body.
                                    example: Sua fatura está disponível!
                                  body:
                                    type: string
                                    minLength: 1
                                    description: The text of the e-mail.
                                    example: >-
                                      Olá {{ billingAccountBusinessName }}, sua
                                      fatura vence em {{ dueDate }}.
                                  attachments:
                                    type: object
                                    description: >-
                                      The files that the e-mail of the dunning
                                      step attaches. A dunning step can attach
                                      only the files that the
                                      `attachmentOptions` of the dunning
                                      settings list.
                                    properties:
                                      artifacts:
                                        type: array
                                        description: >-
                                          The invoice artifacts that the e-mail
                                          attaches.
                                        items:
                                          type: object
                                          properties:
                                            type:
                                              anyOf:
                                                - enum:
                                                    - default:invoice_pdf
                                                - type: string
                                                  pattern: ^custom:.+$
                                              description: >-
                                                The type of the invoice artifact:
                                                `default:invoice_pdf` for the invoice
                                                PDF, or `custom:*` for an invoice
                                                artifact of the tenant.
                                          required:
                                            - type
                                          additionalProperties: false
                                      paymentFiles:
                                        type: boolean
                                        description: >-
                                          Whether the e-mail attaches the files of
                                          the payment of the invoice: the boleto,
                                          the Pix file or both, as the payment
                                          method of its contract produces. A
                                          dunning step that sends after the
                                          payment cannot attach them.
                                      fiscalDocumentFiles:
                                        type: boolean
                                        description: >-
                                          Whether the e-mail attaches the PDF and
                                          the XML of the fiscal document of the
                                          invoice.
                                      invoiceAttachmentFiles:
                                        type: boolean
                                        description: >-
                                          Whether the e-mail attaches the invoice
                                          attachments that the tenant marked to go
                                          out with the invoice.
                                    required:
                                      - artifacts
                                      - paymentFiles
                                      - fiscalDocumentFiles
                                      - invoiceAttachmentFiles
                                    additionalProperties: false
                                required:
                                  - subject
                                  - title
                                  - body
                                  - attachments
                                additionalProperties: false
                            required:
                              - id
                              - name
                              - anchor
                              - offsetDays
                              - channel
                              - content
                            additionalProperties: false
                          description: >-
                            The dunning steps of the dunning schedule, ordered
                            by when they send: the issue day first, then by the
                            days from the due date, and the payment last.
                      required:
                        - id
                        - name
                        - isDefault
                        - archivedAt
                        - steps
                      additionalProperties: false
                    description: A list of items.
                  hasMore:
                    description: Indicates if there are more items to fetch.
                    type: boolean
                required:
                  - items
                  - hasMore
                additionalProperties: false
        '400':
          description: >-
            The request cannot succeed as sent.


            - `json_schema_validation_error`: a query parameter breaks the
            schema of the endpoint.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: >-
                      A sentence for a person that says what failed. It can
                      change, so a system compares the code instead.
                  code:
                    type: string
                    description: >-
                      The identifier of the error, which a system compares to
                      decide what to do. It never changes.
                    enum:
                      - json_schema_validation_error
                  details:
                    oneOf:
                      - type: object
                        additionalProperties: true
                      - type: array
                    description: >-
                      The data of the error, when it has any, such as the fields
                      that failed the validation.
                  causations:
                    type: array
                    description: >-
                      The errors that caused this one, when several did, each
                      with its own message, code and details.
                    items:
                      type: object
                      properties:
                        message:
                          type: string
                          description: A sentence for a person that says what failed.
                        code:
                          type: string
                          description: The identifier of the error.
                        details:
                          type: object
                          additionalProperties: true
                          description: The data of the error, when it has any.
                      required:
                        - message
                        - code
                      additionalProperties: false
                required:
                  - message
                  - code
                additionalProperties: false
              examples:
                json_schema_validation_error:
                  value:
                    message: '''search'' must be string'
                    code: json_schema_validation_error
        '401':
          description: >-
            The request carries no API key.


            - `no_authorization`: the request carries no API key in the
            `X-API-KEY` header.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: >-
                      A sentence for a person that says what failed. It can
                      change, so a system compares the code instead.
                  code:
                    type: string
                    description: >-
                      The identifier of the error, which a system compares to
                      decide what to do. It never changes.
                    enum:
                      - no_authorization
                  details:
                    oneOf:
                      - type: object
                        additionalProperties: true
                      - type: array
                    description: >-
                      The data of the error, when it has any, such as the fields
                      that failed the validation.
                  causations:
                    type: array
                    description: >-
                      The errors that caused this one, when several did, each
                      with its own message, code and details.
                    items:
                      type: object
                      properties:
                        message:
                          type: string
                          description: A sentence for a person that says what failed.
                        code:
                          type: string
                          description: The identifier of the error.
                        details:
                          type: object
                          additionalProperties: true
                          description: The data of the error, when it has any.
                      required:
                        - message
                        - code
                      additionalProperties: false
                required:
                  - message
                  - code
                additionalProperties: false
              examples:
                no_authorization:
                  value:
                    message: No authorization provided
                    code: no_authorization
        '403':
          description: >-
            The API key cannot call the endpoint.


            - `bad_auth`: the API key does not hold the role that the endpoint
            requires.

            - `invalid_api_key`: the API key does not exist.

            - `deactivated_api_key`: the API key is deactivated.

            - `revoked_api_key`: the API key is revoked.

            - `expired_api_key`: the API key is past its expiry date.

            - `ip_not_allowed`: the tenant does not allow the IP of the request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: >-
                      A sentence for a person that says what failed. It can
                      change, so a system compares the code instead.
                  code:
                    type: string
                    description: >-
                      The identifier of the error, which a system compares to
                      decide what to do. It never changes.
                    enum:
                      - bad_auth
                      - invalid_api_key
                      - deactivated_api_key
                      - revoked_api_key
                      - expired_api_key
                      - ip_not_allowed
                  details:
                    oneOf:
                      - type: object
                        additionalProperties: true
                      - type: array
                    description: >-
                      The data of the error, when it has any, such as the fields
                      that failed the validation.
                  causations:
                    type: array
                    description: >-
                      The errors that caused this one, when several did, each
                      with its own message, code and details.
                    items:
                      type: object
                      properties:
                        message:
                          type: string
                          description: A sentence for a person that says what failed.
                        code:
                          type: string
                          description: The identifier of the error.
                        details:
                          type: object
                          additionalProperties: true
                          description: The data of the error, when it has any.
                      required:
                        - message
                        - code
                      additionalProperties: false
                required:
                  - message
                  - code
                additionalProperties: false
              examples:
                bad_auth:
                  value:
                    message: role dunning:read can not be satisfied
                    code: bad_auth
                invalid_api_key:
                  value:
                    message: Invalid API key
                    code: invalid_api_key
                deactivated_api_key:
                  value:
                    message: Deactivated API key
                    code: deactivated_api_key
                revoked_api_key:
                  value:
                    message: Revoked API key
                    code: revoked_api_key
                expired_api_key:
                  value:
                    message: Expired API key
                    code: expired_api_key
                ip_not_allowed:
                  value:
                    message: IP not allowed
                    code: ip_not_allowed
        '429':
          description: >-
            The tenant reached one of its limits of reads.


            - `too_many_reads_per_second`: the tenant already made 50 reads in
            this second.

            - `too_many_reads_in_flight`: the tenant already has 20 reads in
            flight.
          headers:
            Retry-After:
              schema:
                type: integer
              description: The seconds to wait before the next read.
            RateLimit-Limit:
              schema:
                type: integer
              description: >-
                The limit that the read hit: 20 for the reads in flight, 50 for
                the reads per second.
            RateLimit-Remaining:
              schema:
                type: integer
              description: The reads left under that limit, which is 0.
            RateLimit-Reset:
              schema:
                type: integer
              description: >-
                The seconds to wait before the next read, as in Retry-After. The
                limit of reads per second takes new reads in the next second,
                but the limit of reads in flight takes a new read only once one
                of the reads in flight ends.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: >-
                      A sentence for a person that says what failed. It can
                      change, so a system compares the code instead.
                  code:
                    type: string
                    description: >-
                      The identifier of the error, which a system compares to
                      decide what to do. It never changes.
                    enum:
                      - too_many_reads_per_second
                      - too_many_reads_in_flight
                  details:
                    oneOf:
                      - type: object
                        additionalProperties: true
                      - type: array
                    description: >-
                      The data of the error, when it has any, such as the fields
                      that failed the validation.
                  causations:
                    type: array
                    description: >-
                      The errors that caused this one, when several did, each
                      with its own message, code and details.
                    items:
                      type: object
                      properties:
                        message:
                          type: string
                          description: A sentence for a person that says what failed.
                        code:
                          type: string
                          description: The identifier of the error.
                        details:
                          type: object
                          additionalProperties: true
                          description: The data of the error, when it has any.
                      required:
                        - message
                        - code
                      additionalProperties: false
                required:
                  - message
                  - code
                additionalProperties: false
              examples:
                too_many_reads_per_second:
                  value:
                    message: >-
                      Too many reads: a tenant can make at most 50 reads per
                      second. Retry after 1 second.
                    code: too_many_reads_per_second
                too_many_reads_in_flight:
                  value:
                    message: >-
                      Too many reads in flight: a tenant can have at most 20
                      reads in flight. Retry after 1 second.
                    code: too_many_reads_in_flight
components:
  securitySchemes:
    ApiKey:
      type: apiKey
      description: API Key Authentication.
      name: X-API-KEY
      in: header

````

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