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

# Set default payment account

> Makes a payment account the default one of its customer, in place of the previous default, so that `isDefault` is true only on it among the payment accounts of the customer.

Requires the role `payment_accounts:write`.



## OpenAPI

````yaml /api-reference/openapi.yaml post /v1/payment-accounts/{id}/set-default
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/payment-accounts/{id}/set-default:
    post:
      tags:
        - Payment Accounts
      summary: Set default payment account
      description: >-
        Makes a payment account the default one of its customer, in place of the
        previous default, so that `isDefault` is true only on it among the
        payment accounts of the customer.


        Requires the role `payment_accounts:write`.
      parameters:
        - schema:
            type: string
            format: uuid
          in: path
          name: id
          required: true
          description: The unique identifier of the payment account in our system.
      responses:
        '200':
          description: >-
            A payment account, the record of who pays a customer's invoices: a
            name, a tax id, an optional phone and the e-mails that receive the
            invoices. A customer can have several, with one as the default.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    description: >-
                      The unique identifier of the payment account in our
                      system.
                    type: string
                    format: uuid
                  customerId:
                    description: >-
                      The unique identifier of the customer that owns the
                      payment account.
                    type: string
                    format: uuid
                  archivedAt:
                    description: Archive timestamp for payment accounts that were archived.
                    type:
                      - 'null'
                      - string
                    format: date-time
                  isDefault:
                    description: >-
                      Whether the payment account is the default payment account
                      of its customer.
                    type: boolean
                  legalEntity:
                    type: object
                    description: >-
                      The company or person who pays the invoices of the payment
                      account: its names, its tax id, its phone, its address and
                      its invoice recipients.
                    properties:
                      id:
                        type: string
                        format: uuid
                        description: The unique identifier of the legal entity.
                      tradeName:
                        type: string
                        nullable: true
                        description: >-
                          The trade name (nome fantasia) of the legal entity, or
                          null when it has none.
                        example: Padaria Central
                      businessName:
                        type: string
                        description: >-
                          The registered business name (razão social) of the
                          legal entity.
                        example: Padaria Central Ltda
                      emails:
                        type: array
                        items:
                          type: string
                          format: email
                        default: []
                        description: >-
                          The e-mails of the legal entity. When the legal entity
                          belongs to a payment account, its e-mails are the
                          invoice recipients of that account: they receive the
                          invoices billed to it.
                      taxId:
                        type: string
                        pattern: ^(^\d{14}$|^\d{11}$)$
                        description: >-
                          The tax id of the legal entity, digits only: the 14
                          digits of a CNPJ or the 11 digits of a CPF.
                        example: '01234567000195'
                      taxIdType:
                        type: string
                        enum:
                          - cnpj
                          - cpf
                        description: >-
                          The kind of tax id in `taxId`: `cnpj` for a company or
                          `cpf` for a person.
                      zipCode:
                        type: string
                        pattern: ^[0-9]{8}$
                        nullable: true
                        description: >-
                          The postal code (CEP) of the address of the legal
                          entity, as 8 digits with no mask, or null when it has
                          none.
                        example: '01310100'
                      street:
                        type: string
                        nullable: true
                        description: >-
                          The street of the address of the legal entity, or null
                          when it has none.
                        example: Avenida Paulista
                      number:
                        type: string
                        nullable: true
                        description: >-
                          The street number of the address of the legal entity,
                          or null when it has none.
                        example: '1000'
                      neighborhood:
                        type: string
                        nullable: true
                        description: >-
                          The neighborhood (bairro) of the address of the legal
                          entity, or null when it has none.
                        example: Bela Vista
                      city:
                        type: string
                        nullable: true
                        description: >-
                          The city of the address of the legal entity, or null
                          when it has none.
                        example: São Paulo
                      state:
                        type:
                          - 'null'
                          - string
                        enum:
                          - AC
                          - AL
                          - AP
                          - AM
                          - BA
                          - CE
                          - DF
                          - ES
                          - GO
                          - MA
                          - MT
                          - MS
                          - MG
                          - PA
                          - PB
                          - PR
                          - PE
                          - PI
                          - RJ
                          - RN
                          - RS
                          - RO
                          - RR
                          - SC
                          - SP
                          - SE
                          - TO
                          - null
                        description: >-
                          The state of the address of the legal entity, as its
                          two-letter code, or null when it has none.
                      country:
                        type:
                          - 'null'
                          - string
                        enum:
                          - Brasil
                          - null
                        description: >-
                          The country of the address of the legal entity, or
                          null when it has none.
                      complement:
                        type: string
                        nullable: true
                        description: >-
                          The complement of the address of the legal entity,
                          such as a suite or a floor, or null when it has none.
                        example: Sala 12
                      customFields:
                        type: object
                        description: >-
                          Custom fields that can be associated with the entity.
                          The fields must be previously created in the system
                          before they can be used.
                        additionalProperties:
                          anyOf:
                            - type: string
                            - type: array
                              items:
                                type: string
                        default: {}
                        example:
                          customField1: value1
                          customField2:
                            - value2
                            - value3
                      phone:
                        type: string
                        pattern: ^\d{10,11}$
                        nullable: true
                        description: >-
                          Phone of the payment account: the 10 or 11 digits of a
                          Brazilian landline or mobile number with its area
                          code, with no mask and no country code. Aira rejects a
                          number that does not exist in Brazil, such as one with
                          an area code that does not exist. Null when absent.
                        errorMessage:
                          pattern: >-
                            must hold only the 10 or 11 digits of a Brazilian
                            number with its area code, as in 11987654321
                        example: '11987654321'
                    required:
                      - id
                      - businessName
                      - taxId
                      - taxIdType
                      - customFields
                    additionalProperties: false
                required:
                  - id
                  - customerId
                  - archivedAt
                  - isDefault
                  - legalEntity
                additionalProperties: false
        '400':
          description: >-
            The request cannot succeed as sent.


            - `json_schema_validation_error`: a path 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: '''id'' must match format "uuid"'
                    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 payment_accounts: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.


            - `payment_account_not_found`: no payment account of the tenant that
            is not archived has the `id`.
          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:
                      - payment_account_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:
                payment_account_not_found:
                  value:
                    message: payment account not found
                    code: payment_account_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.