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

# Update dunning settings

> Replaces the dunning settings of the tenant: the reply-to address, the default dunning schedule, the logo and the primary color of the dunning e-mails, and when they go out. Returns the dunning settings as the fetch of the dunning settings does, with the files that the e-mail of a dunning step can attach.

Requires the role `dunning:write`.



## OpenAPI

````yaml /api-reference/openapi.yaml put /v1/dunning-schedules/settings
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/settings:
    put:
      tags:
        - Dunning
      summary: Update dunning settings
      description: >-
        Replaces the dunning settings of the tenant: the reply-to address, the
        default dunning schedule, the logo and the primary color of the dunning
        e-mails, and when they go out. Returns the dunning settings as the fetch
        of the dunning settings does, with the files that the e-mail of a
        dunning step can attach.


        Requires the role `dunning:write`.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                replyTo:
                  type:
                    - 'null'
                    - string
                  format: email
                  description: >-
                    The address that receives the replies to the dunning
                    e-mails. When null, the replies go to the address of the
                    from e-mail of the tenant, or to an address of Aira when the
                    tenant has no from e-mail.
                  example: financeiro@acme.com
                defaultDunningScheduleId:
                  type:
                    - 'null'
                    - string
                  format: uuid
                  description: >-
                    The id of the default dunning schedule, which a customer
                    follows when its creation leaves out the dunning schedule,
                    or null for none. `PUT /v1/dunning-schedules/settings`
                    refuses an archived dunning schedule, and while the default
                    dunning schedule is archived, a customer whose creation
                    leaves out the dunning schedule follows none.
                logoUrl:
                  type:
                    - 'null'
                    - string
                  pattern: ^$|^https?://[^\s]+$
                  maxLength: 2048
                  description: >-
                    The http or https URL of the logo that the dunning e-mails
                    show, or null for the default logo. `POST
                    /v1/dunning-schedules/settings/logo` uploads a logo and
                    returns its URL.
                  example: https://acme.com/logo.png
                primaryColor:
                  type:
                    - 'null'
                    - string
                  pattern: ^$|^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$
                  description: >-
                    The primary color of the dunning e-mails, as a hex code, or
                    null for the default color.
                  example: '#123ABC'
                dispatchWindow:
                  type: string
                  enum:
                    - business_hours
                    - any_time
                  description: >-
                    When the dunning e-mails go out: `business_hours` sends them
                    from Monday to Friday, from 09:00 to 18:00, Brasília time,
                    and `any_time` sends them on any day, Saturdays and Sundays
                    included.
              required:
                - replyTo
                - defaultDunningScheduleId
                - logoUrl
                - primaryColor
                - dispatchWindow
              additionalProperties: false
        required: true
        description: >-
          The dunning settings of the tenant: the reply-to address, the default
          dunning schedule, the logo and the primary color of the dunning
          e-mails, and when they go out.
      responses:
        '200':
          description: >-
            The dunning settings of the tenant: the reply-to address, the
            default dunning schedule, the logo and the primary color of the
            dunning e-mails, and when they go out.
          content:
            application/json:
              schema:
                type: object
                properties:
                  replyTo:
                    type:
                      - 'null'
                      - string
                    format: email
                    description: >-
                      The address that receives the replies to the dunning
                      e-mails. When null, the replies go to the address of the
                      from e-mail of the tenant, or to an address of Aira when
                      the tenant has no from e-mail.
                    example: financeiro@acme.com
                  defaultDunningScheduleId:
                    type:
                      - 'null'
                      - string
                    format: uuid
                    description: >-
                      The id of the default dunning schedule, which a customer
                      follows when its creation leaves out the dunning schedule,
                      or null for none. `PUT /v1/dunning-schedules/settings`
                      refuses an archived dunning schedule, and while the
                      default dunning schedule is archived, a customer whose
                      creation leaves out the dunning schedule follows none.
                  logoUrl:
                    type:
                      - 'null'
                      - string
                    pattern: ^$|^https?://[^\s]+$
                    maxLength: 2048
                    description: >-
                      The http or https URL of the logo that the dunning e-mails
                      show, or null for the default logo. `POST
                      /v1/dunning-schedules/settings/logo` uploads a logo and
                      returns its URL.
                    example: https://acme.com/logo.png
                  primaryColor:
                    type:
                      - 'null'
                      - string
                    pattern: ^$|^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$
                    description: >-
                      The primary color of the dunning e-mails, as a hex code,
                      or null for the default color.
                    example: '#123ABC'
                  dispatchWindow:
                    type: string
                    enum:
                      - business_hours
                      - any_time
                    description: >-
                      When the dunning e-mails go out: `business_hours` sends
                      them from Monday to Friday, from 09:00 to 18:00, Brasília
                      time, and `any_time` sends them on any day, Saturdays and
                      Sundays included.
                  attachmentOptions:
                    type: object
                    description: >-
                      The files that the setup of the tenant produces, which are
                      the only ones that the e-mail of a dunning step can
                      attach.
                    properties:
                      artifacts:
                        type: array
                        description: >-
                          The invoice artifacts that Aira generates for the
                          tenant.
                        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.
                            label:
                              type:
                                - 'null'
                                - string
                              description: >-
                                The name of the invoice artifact in the setup of
                                the tenant, or null when it has none.
                              example: Demonstrativo de uso
                          required:
                            - type
                            - label
                          additionalProperties: false
                      paymentFiles:
                        type: boolean
                        description: >-
                          Whether a dunning step can attach the files of the
                          payment of the invoice, which needs the payments
                          module.
                      fiscalDocumentFiles:
                        type: boolean
                        description: >-
                          Whether a dunning step can attach the files of the
                          fiscal document of the invoice, which needs the fiscal
                          invoices module.
                      invoiceAttachmentFiles:
                        type: boolean
                        description: >-
                          Whether a dunning step can attach the invoice
                          attachments.
                    required:
                      - artifacts
                      - paymentFiles
                      - fiscalDocumentFiles
                      - invoiceAttachmentFiles
                    additionalProperties: false
                required:
                  - replyTo
                  - defaultDunningScheduleId
                  - logoUrl
                  - primaryColor
                  - dispatchWindow
                  - attachmentOptions
                additionalProperties: false
        '400':
          description: >-
            The request cannot succeed as sent.


            - `json_schema_validation_error`: the body breaks the schema of the
            endpoint.

            - `dunning_schedule_not_assignable`: the dunning schedule of the
            `defaultDunningScheduleId` is archived.
          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
                      - dunning_schedule_not_assignable
                  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: '''replyTo'' is required'
                    code: json_schema_validation_error
                dunning_schedule_not_assignable:
                  value:
                    message: cannot assign an archived dunning schedule
                    code: dunning_schedule_not_assignable
        '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:write 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
        '404':
          description: >-
            A record that the request names does not exist in the tenant.


            - `dunning_schedule_not_found`: no dunning schedule of the tenant
            has the `defaultDunningScheduleId`.
          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:
                      - dunning_schedule_not_found
                  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:
                dunning_schedule_not_found:
                  value:
                    message: dunning schedule not found
                    code: dunning_schedule_not_found
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.