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

# Update Account

> Updates an account's name or ID, and links or unlinks customers. Account IDs are optional and only ever set by you. A customer belongs to at most one account. Look the account up by `account_id` or by any linked customer's `customer_id`; when that customer has no account yet, linking customers to it creates one. Linking a customer that is already in another account fails unless you pass `move: true`. Removing the last customer deletes the account and returns `null`.

### Body Parameters

The account's ID, if one was set. Pass this or `customer_id`.

Look the account up through one of its customers. Pass this or `account_id`.

A display name for the account. Pass `null` to clear it.

Set the account's ID, unique in this environment. Pass `null` to clear it. Accounts have no ID until you set one.

Customers to link. When looking up by `customer_id` and that customer has no account yet, linking creates one.

Customers to unlink. The customers themselves are unchanged. Removing the last customer deletes the account.

Move customers in `add_customer_ids` out of any other account they belong to. Without it, linking a customer that's in another account fails.

### Response

The account's ID, if you've set one. Autumn never generates it.

The account's name, if set.

Customers linked to the account, oldest link first.

**properties**

The customer's ID.

The customer's name.

The customer's email.

When the account was created, ms since epoch.

```json 200 theme={null}
{
  "id": "acme",
  "name": "Acme Corp",
  "customers": [
    {
      "id": "acme-us",
      "name": "Acme US",
      "email": "billing@acme.com"
    },
    {
      "id": "acme-eu",
      "name": "Acme EU",
      "email": "eu-billing@acme.com"
    }
  ],
  "created_at": 1781113864000
}
```


## OpenAPI

````yaml openapi POST /v1/accounts.update
openapi: 3.1.0
info:
  title: Autumn API
  version: 2.6.0
servers:
  - url: https://api.useautumn.com
    description: Production server
security:
  - secretKey: []
paths:
  /v1/accounts.update:
    post:
      tags:
        - accounts
      description: >-
        Updates an account's name or ID, and links or unlinks customers. Account
        IDs are optional and only ever set by you. A customer belongs to at most
        one account. Look the account up by `account_id` or by any linked
        customer's `customer_id`; when that customer has no account yet, linking
        customers to it creates one. Linking a customer that is already in
        another account fails unless you pass `move: true`. Removing the last
        customer deletes the account and returns `null`.
      operationId: updateAccount
      parameters:
        - name: x-api-version
          in: header
          required: true
          schema:
            type: string
            default: 2.6.0
          x-speakeasy-globals-hidden: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                account_id:
                  type: string
                  minLength: 1
                  maxLength: 256
                  pattern: ^[a-zA-Z0-9_\-.]+$
                  description: >-
                    The account's ID, if one was set. Pass this or
                    `customer_id`.
                customer_id:
                  $ref: '#/components/schemas/CustomerId'
                  description: >-
                    Look the account up through one of its customers. Pass this
                    or `account_id`.
                name:
                  anyOf:
                    - type: string
                      maxLength: 256
                    - type: 'null'
                  description: A display name for the account. Pass `null` to clear it.
                new_account_id:
                  anyOf:
                    - type: string
                      minLength: 1
                      maxLength: 256
                      pattern: ^[a-zA-Z0-9_\-.]+$
                    - type: 'null'
                  description: >-
                    Set the account's ID, unique in this environment. Pass
                    `null` to clear it. Accounts have no ID until you set one.
                add_customer_ids:
                  type: array
                  maxItems: 100
                  items:
                    $ref: '#/components/schemas/CustomerId'
                  description: >-
                    Customers to link. When looking up by `customer_id` and that
                    customer has no account yet, linking creates one.
                remove_customer_ids:
                  type: array
                  maxItems: 100
                  items:
                    $ref: '#/components/schemas/CustomerId'
                  description: >-
                    Customers to unlink. The customers themselves are unchanged.
                    Removing the last customer deletes the account.
                move:
                  type: boolean
                  description: >-
                    Move customers in `add_customer_ids` out of any other
                    account they belong to. Without it, linking a customer
                    that's in another account fails.
              title: UpdateAccountParams
              examples:
                - customer_id: acme-us
                  name: Acme Corp
                  add_customer_ids:
                    - acme-eu
            example:
              customer_id: acme-us
              name: Acme Corp
              add_customer_ids:
                - acme-eu
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    properties:
                      id:
                        anyOf:
                          - type: string
                          - type: 'null'
                        description: >-
                          The account's ID, if you've set one. Autumn never
                          generates it.
                      name:
                        anyOf:
                          - type: string
                          - type: 'null'
                        description: The account's name, if set.
                      customers:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              anyOf:
                                - type: string
                                - type: 'null'
                              description: The customer's ID.
                            name:
                              anyOf:
                                - type: string
                                - type: 'null'
                              description: The customer's name.
                            email:
                              anyOf:
                                - type: string
                                - type: 'null'
                              description: The customer's email.
                          required:
                            - id
                            - name
                            - email
                        description: Customers linked to the account, oldest link first.
                      created_at:
                        type: number
                        description: When the account was created, ms since epoch.
                    required:
                      - id
                      - name
                      - customers
                      - created_at
                  - type: 'null'
                title: UpdateAccountResponse
                description: >-
                  The updated account, or `null` when its last customer was
                  removed and the account was deleted.
                examples:
                  - id: acme
                    name: Acme Corp
                    customers:
                      - id: acme-us
                        name: Acme US
                        email: billing@acme.com
                      - id: acme-eu
                        name: Acme EU
                        email: eu-billing@acme.com
                    created_at: 1781113864000
              example:
                id: acme
                name: Acme Corp
                customers:
                  - id: acme-us
                    name: Acme US
                    email: billing@acme.com
                  - id: acme-eu
                    name: Acme EU
                    email: eu-billing@acme.com
                created_at: 1781113864000
      x-codeSamples:
        - lang: typescript
          label: Typescript (SDK)
          source: |-
            import { Autumn } from 'autumn-js'

            const autumn = new Autumn()

            const result = await autumn.accounts.update({
              customerId: "acme-us",
              name: "Acme Corp",
              addCustomerIds: [
                "acme-eu",
              ],
            });
        - lang: python
          label: Python (SDK)
          source: |-
            from autumn_sdk import Autumn

            autumn = Autumn(secret_key="am_sk_test...")

            res = autumn.accounts.update(
                customer_id="acme-us",
                name="Acme Corp",
                add_customer_ids=[
                    "acme-eu",
                ],
            )
components:
  schemas:
    CustomerId:
      type: string
      title: CustomerId
      description: Your unique identifier for the customer
  securitySchemes:
    secretKey:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

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