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

# Modify an account

> Edits the name, description or colour of the account with the given account number. Changes apply to the account in every open fiscal year.

Other properties of an account, such as its number, type or currency, cannot be changed.

## Editing an account

The name, description and colour of an account can be changed. Only the fields you provide are changed; to remove a description or colour, set it to `null`:

```json theme={null}
{
  "name": "Main bank account",
  "description": null
}
```

Changes apply to the account in every open fiscal year, so the chart of accounts stays consistent. The account number, type and currency of an account cannot be changed.


## OpenAPI

````yaml PATCH /v1/accounts/{accountNumber}
openapi: 3.1.0
info:
  title: infinity.swiss Open API
  version: '1.0'
  summary: ''
servers:
  - url: https://api.infinity.swiss
security:
  - apiKey: []
paths:
  /v1/accounts/{accountNumber}:
    parameters:
      - schema:
          type: integer
          minimum: 1000
          maximum: 9999
        name: accountNumber
        in: path
        description: The account number of the account
        required: true
    patch:
      tags: []
      summary: Modify an account
      description: >-
        Edits the name, description or colour of the account with the given
        account number. Changes apply to the account in every open fiscal year.


        Other properties of an account, such as its number, type or currency,
        cannot be changed.
      operationId: modify-account-v1
      requestBody:
        description: >-
          Provide the changes to save to the account in the request body. Any
          fields that are not provided are left unchanged.
        content:
          application/json:
            schema:
              type: object
              x-examples:
                Example 1:
                  name: Main bank account
                  colour: '#00b583'
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 100
                  description: The new name of the account.
                description:
                  type:
                    - string
                    - 'null'
                  maxLength: 500
                  description: >-
                    The new description of the account. Set to `null` to remove
                    the description.
                colour:
                  type:
                    - string
                    - 'null'
                  pattern: ^#[0-9a-fA-F]{6}$
                  description: >-
                    The new hex colour code of the account. Set to `null` to
                    remove the colour.
      responses:
        '200':
          description: Changes saved successfully.
          content:
            application/json:
              schema:
                type: object
                required:
                  - account
                properties:
                  account:
                    $ref: '#/components/schemas/Account'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorised'
        '404':
          $ref: '#/components/responses/AccountNotFound'
components:
  schemas:
    Account:
      title: Account
      type: object
      description: >-
        An account of the chart of accounts. Accounts are identified by their
        account number.
      required:
        - number
        - name
        - type
        - currency
        - isSystemAccount
        - isTaxApplicable
      properties:
        number:
          type: integer
          minimum: 1000
          maximum: 9999
          description: The four-digit account number.
          example: 1020
        name:
          type: string
          description: The name of the account.
          example: Bank
        type:
          type: string
          enum:
            - assets
            - liabilities
            - income
            - expense
          description: The type of the account.
        description:
          type: string
          description: >-
            A description of what is booked to this account, if one was
            provided.
        colour:
          type: string
          description: >-
            The hex colour code used to display the account in the app, if one
            was set.
          example: '#0746c8'
        currency:
          type: string
          description: >-
            The 3-character currency code (ISO 4217) of the account. `CHF`
            unless the account is a foreign currency account.
          example: CHF
        isSystemAccount:
          type: boolean
          description: >-
            Whether Infinity relies on this account, e.g. for VAT. System
            accounts cannot be deleted.
        isTaxApplicable:
          type: boolean
          description: >-
            Whether ledger entries booked to this account may carry a VAT tax
            code.
  responses:
    BadRequest:
      description: >-
        A bad request is thrown if the request payload is malformed or fails
        validation.
      content:
        application/json:
          schema:
            type: object
            required:
              - code
            properties:
              code:
                type: string
                description: |-
                  The specific error code for this request. May be:
                  - `general/missing-fields`
                  - `general/malformed-request`
                  - `general/invalid-date`
                  - `general/input-too-long`
                  - `general/zero-or-negative-amount-not-allowed`
              invalidFields:
                type: array
                description: A list of the fields which were invalid, if applicable.
                items:
                  type: string
    Unauthorised:
      description: >-
        An unauthorised request was submitted. You may be using an incorrect or
        expired API token, or are attempting to access a document outside of the
        scope of the token.
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: string
                x-stoplight:
                  id: 08hkw8ukmi2lp
                description: Specific error code
          examples:
            Unauthorised request:
              value:
                code: general/unauthorised
    AccountNotFound:
      description: >-
        No account with this account number exists in an open fiscal year of the
        organisation.
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: string
                description: Specific error code.
          examples:
            Not found:
              value:
                code: ledger/account-not-found
  securitySchemes:
    apiKey:
      name: x-api-token
      type: apiKey
      in: header
      description: >-
        API token for authentication. Obtain from your Infinity account
        settings.

````