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

# Update a revenue account

> Changes an account. Send only what changes; an omitted field is left alone, and at least one field is required.

Three things this will refuse. A `code` another account already uses is a 409. `isDefault: false` on the *last* account holding the default is a 400: an organization with no default has nowhere to post a sale that names no account. (An organization carrying more than one default - possible from before these rules, or from a clone - can have the extras cleared, which is how that state is repaired.) And anything that would leave the default inactive - retiring the current default, or promoting a retired account - is a 400, because the readers that resolve the default match on `isDefault` alone and would go on posting sales to an account this API calls retired. Move the default onto another account first, or reactivate and promote in the same call.

Retiring an account (`isActive: false`) is otherwise how one is taken out of use. Everything already pointing at it keeps pointing at it - the flag is what tells a caller not to attach it to something new.

Requires `revenue-accounts:write`.




## OpenAPI

````yaml /openapi-platform.json patch /v1/platform/revenue-accounts/{id}
openapi: 3.0.0
info:
  title: 1club Platform API
  version: 1.0.0
  description: >-
    The 1club Platform API lets you programmatically access and manage your
    organization's data.


    ## Official API Contract


    This documentation is the official source of truth for the 1club Platform
    API.

    If an integration relies on undocumented endpoints, fields, response shapes,
    or internal behavior outside this spec, we can't guarantee backward
    compatibility.

    Build against what's documented here to stay stable as the platform evolves.


    ## Authentication


    All requests require a customer API key passed as a Bearer token:


    ```

    Authorization: Bearer 1club_sk_live_...

    ```


    Generate API keys from the admin portal under **Settings > API Tokens**.

    The key is tied to your organization - all responses are scoped to your
    org's data.


    ## Rate Limiting


    - **100 requests per minute** per API key

    - When exceeded, the API returns `429 Too Many Requests` with a
    `Retry-After` header

    - Rate limit headers are included in every response:
      - `X-RateLimit-Limit` - max requests per window
      - `X-RateLimit-Remaining` - requests remaining
      - `X-RateLimit-Reset` - seconds until the window resets

    ## Errors


    | Status | Meaning |

    |--------|---------|

    | `400` | Invalid request parameters |

    | `401` | Missing or invalid API key |

    | `404` | Resource not found (or doesn't belong to your organization) |

    | `429` | Rate limit exceeded |

    | `500` | Internal server error |
  contact:
    name: 1club API Support
    email: support@1club.ai
servers:
  - url: https://api.1club.ai
    description: Production API
security:
  - customerApiAuth: []
tags: []
paths:
  /v1/platform/revenue-accounts/{id}:
    patch:
      tags:
        - Revenue Accounts
      summary: Update a revenue account
      description: >
        Changes an account. Send only what changes; an omitted field is left
        alone, and at least one field is required.


        Three things this will refuse. A `code` another account already uses is
        a 409. `isDefault: false` on the *last* account holding the default is a
        400: an organization with no default has nowhere to post a sale that
        names no account. (An organization carrying more than one default -
        possible from before these rules, or from a clone - can have the extras
        cleared, which is how that state is repaired.) And anything that would
        leave the default inactive - retiring the current default, or promoting
        a retired account - is a 400, because the readers that resolve the
        default match on `isDefault` alone and would go on posting sales to an
        account this API calls retired. Move the default onto another account
        first, or reactivate and promote in the same call.


        Retiring an account (`isActive: false`) is otherwise how one is taken
        out of use. Everything already pointing at it keeps pointing at it - the
        flag is what tells a caller not to attach it to something new.


        Requires `revenue-accounts:write`.
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PlatformRevenueAccountUpdate'
      responses:
        '200':
          description: The updated revenue account
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlatformRevenueAccount'
        '400':
          $ref: '#/components/responses/PlatformBadRequest'
        '401':
          $ref: '#/components/responses/PlatformUnauthorized'
        '403':
          description: API key is missing the required `revenue-accounts:write` scope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlatformError'
        '404':
          $ref: '#/components/responses/PlatformNotFound'
        '409':
          description: Another account in this organization already uses that `code`
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlatformError'
        '429':
          $ref: '#/components/responses/PlatformRateLimited'
      security:
        - customerApiAuth: []
components:
  schemas:
    PlatformRevenueAccountUpdate:
      type: object
      description: >-
        Fields accepted when updating a revenue account. Send only what changes;
        an omitted field is left alone, and at least one is required.
        `isDefault: false` is refused only when this is the last account holding
        the default, or when the only other one is retired: the organization
        must be left with an active default. An organization carrying more than
        one default - possible from before this rule, or from a clone - can have
        the extras cleared, which is how that state is repaired.
      minProperties: 1
      properties:
        name:
          type: string
          maxLength: 255
        code:
          type: string
          maxLength: 50
          description: >-
            The bookkeeper's code for the account, e.g. "4000". Unique within
            the organization; a clash is a 409.
        description:
          type: string
          nullable: true
          maxLength: 2000
        isActive:
          type: boolean
          default: true
          description: >-
            False retires the account. Everything already pointing at it keeps
            pointing at it; there is no delete. Refused for any request that
            would leave the default inactive - including the first account in an
            empty chart, which is always made the default.
        isDefault:
          type: boolean
          default: false
          description: >-
            Where a sale posts when the item names no account. Setting it true
            moves the default off whichever account currently holds it, in the
            same transaction and behind a per-organization lock. Ignored when
            the chart has no default yet - the first account always takes it,
            since creating one is the only way to give the organization a
            default. The default must be active, so anything landing an inactive
            one is refused.
    PlatformRevenueAccount:
      type: object
      description: >-
        One account in the organization's chart of accounts. Reference the `id`
        as `revenueAccountId` on a membership plan, a product, a class type, an
        area type or an instructor type to decide where its sales post.
      properties:
        id:
          type: integer
        name:
          type: string
        code:
          type: string
          description: >-
            The chart-of-accounts code, which is how the club's bookkeeper names
            the account. Unique within the organization.
        description:
          type: string
          nullable: true
        isActive:
          type: boolean
          description: >-
            False for an account retired from the chart. Still valid on existing
            rows; do not attach it to something new. Never false on the default.
        isDefault:
          type: boolean
          description: >-
            Where a sale posts when nothing on the item names an account.
            Exactly one account holds it, and it is always active.
    PlatformError:
      type: object
      properties:
        error:
          type: string
  responses:
    PlatformBadRequest:
      description: Invalid request (bad parameters, or a body that fails validation)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/PlatformError'
    PlatformUnauthorized:
      description: Invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/PlatformError'
    PlatformNotFound:
      description: The requested resource does not exist in this organization
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/PlatformError'
    PlatformRateLimited:
      description: Rate limit exceeded
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/PlatformError'
  securitySchemes:
    customerApiAuth:
      type: http
      scheme: bearer
      description: >-
        Organization-scoped bearer credential: a customer API key
        (1club_sk_live_...) or an MCP OAuth access token.

````