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

# Change customer type

> This endpoint changes the type of a customer by id. It turns an individual into an organization, an organization into an individual, or a subsidiary into an individual that no longer belongs to its organization. A request for `individual` or `organization` when the customer already has that type answers 200 with the customer and changes nothing.

Requires the role `customers:write`.



## OpenAPI

````yaml /api-reference/openapi.yaml put /v1/customers/{id}/type
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/customers/{id}/type:
    put:
      tags:
        - Customers
      summary: Change customer type
      description: >-
        This endpoint changes the type of a customer by id. It turns an
        individual into an organization, an organization into an individual, or
        a subsidiary into an individual that no longer belongs to its
        organization. A request for `individual` or `organization` when the
        customer already has that type answers 200 with the customer and changes
        nothing.


        Requires the role `customers:write`.
      parameters:
        - schema:
            type: string
            format: uuid
          in: path
          name: id
          required: true
          description: The unique identifier of the customer in our system.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                type:
                  description: The type that the customer takes.
                  type: string
                  enum:
                    - organization
                    - individual
                  examples:
                    - organization
                    - individual
              required:
                - type
              additionalProperties: false
        description: The type that the customer takes, `organization` or `individual`.
      responses:
        '200':
          description: >-
            A customer: the company or person that you bill. Contracts, usage
            and invoices belong to a customer.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    description: The unique identifier of the customer in our system.
                    type: string
                    format: uuid
                  externalId:
                    description: >-
                      The external id of the customer: the key that you give it,
                      which no other customer has. Events and license balances
                      name their customer by it.
                    type: string
                    pattern: ^[a-zA-Z0-9_-]+$
                    examples:
                      - 705faf65-9c8b-4053-8c0b-2021281ce83f
                  name:
                    description: The name of the customer.
                    type: string
                    examples:
                      - Acme Inc.
                  invoicePrefix:
                    description: >-
                      The prefix of the numbers of the customer's invoices,
                      which Aira makes from the name of the customer when it
                      creates the customer, and which never changes.
                    type: string
                    examples:
                      - ACMEI
                  type:
                    description: >-
                      The type of the customer: an `individual`, an
                      `organization`, which groups zero or more subsidiaries, or
                      a `subsidiary`, which belongs to one organization.
                    type: string
                    enum:
                      - individual
                      - organization
                      - subsidiary
                    examples:
                      - individual
                  parentCustomerId:
                    description: >-
                      The id of the organization that the customer belongs to
                      when it is a subsidiary, or null for an individual or an
                      organization.
                    type:
                      - string
                      - 'null'
                    format: uuid
                  dunningScheduleId:
                    description: >-
                      The id of the dunning schedule that the customer follows,
                      or null when the customer follows none and gets no dunning
                      e-mails.
                    type:
                      - string
                      - 'null'
                    format: uuid
                  archivedAt:
                    description: >-
                      The instant when the customer was archived, or null when
                      it is not archived.
                    type:
                      - string
                      - 'null'
                    format: date-time
                  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: {}
                    examples:
                      - customField1: value1
                        customField2:
                          - value2
                          - value3
                required:
                  - id
                  - externalId
                  - name
                  - type
                additionalProperties: false
        '400':
          description: >-
            The request cannot succeed as sent.


            - `json_schema_validation_error`: a path parameter or the body
            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: '''type'' is required'
                    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: <string>
                    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 IP of the request is not among the IPs that
            your API keys accept.
          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 customers:write can not be satisfied
                    code: bad_auth
                invalid_api_key:
                  value:
                    message: <string>
                    code: invalid_api_key
                deactivated_api_key:
                  value:
                    message: <string>
                    code: deactivated_api_key
                revoked_api_key:
                  value:
                    message: <string>
                    code: revoked_api_key
                expired_api_key:
                  value:
                    message: <string>
                    code: expired_api_key
                ip_not_allowed:
                  value:
                    message: <string>
                    code: ip_not_allowed
        '404':
          description: |-
            A record that the request names does not exist.

            - `customer_not_found`: no customer 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:
                      - customer_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:
                customer_not_found:
                  value:
                    message: <string>
                    code: customer_not_found
        '409':
          description: >-
            Other data blocks the action.


            - `invalid_customer_hierarchy`: the customer is a subsidiary and the
            request asks for an organization.

            - `customer_type_change_blocked`: the customer is an organization
            that has a subsidiary, archived ones included, or a draft or active
            contract with `includeNewSubsidiariesOnUsageScope` on or the
            `invoiceAllocationStrategy` `subsidiary_usage_split`, or the
            customer is a subsidiary that a draft or active contract of its
            organization holds in its usage scope or whose payment account its
            allocation bills. The `references` of the error details name every
            blocker, in one group per kind.
          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:
                      - invalid_customer_hierarchy
                      - customer_type_change_blocked
                  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:
                invalid_customer_hierarchy:
                  value:
                    message: <string>
                    code: invalid_customer_hierarchy
                customer_type_change_blocked:
                  value:
                    message: <string>
                    code: customer_type_change_blocked
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.