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

# Create Account Hierarchy

> Single endpoint for viewing, creating, and updating Account Hierarchies. The `method`/`action` fields in the request body select the operation.



## OpenAPI

````yaml POST /billspree/users/account-config
openapi: 3.1.0
info:
  title: Billspree API
  description: REST API for Billspree — billing, AR management, and workspace operations.
  version: 1.0.0
servers:
  - url: https://{workspace}.spreesuite.com
    variables:
      workspace:
        default: your-workspace
        description: Your organization's subdomain (e.g. demo → demo.spreesuite.com)
security:
  - apiKeyAuth: []
paths:
  /billspree/users/account-config:
    post:
      tags:
        - Account Hierarchy
      summary: Manage Account Hierarchies
      description: >-
        Single endpoint for viewing, creating, and updating Account Hierarchies.
        The `method`/`action` fields in the request body select the operation.
      operationId: manageAccountHierarchies
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AccountConfigRequest'
            examples:
              view:
                summary: View Account Hierarchies
                value:
                  method: Retrieve
                  action: Fetch Hierarchies
                  apiVersion: v2
              create:
                summary: Create Account Hierarchy
                value:
                  data:
                    - name: Standard Hierarchy
                      accounts:
                        - accountName: Region
                          level: 1
                          billingAccount: false
                        - accountName: Site
                          level: 2
                          billingAccount: false
                  method: Create
                  action: Create Account Configuration
                  apiVersion: v2
              update:
                summary: Update Account Hierarchy
                value:
                  data:
                    - id: 5
                      name: Standard Hierarchy
                      accounts:
                        - id: 12
                          accountName: Region
                          level: 1
                          billingAccount: false
                  method: Update
                  action: Update Account
                  apiVersion: v2
      responses:
        '200':
          description: Request succeeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountConfigOperationResponse'
              examples:
                view:
                  summary: View Account Hierarchies response
                  value:
                    success: true
                    statusCode: 200
                    message: Request Succeeded.
                    error: null
                    data:
                      - id: 5
                        name: Standard Hierarchy
                        accounts:
                          - id: 12
                            accountName: Region
                            level: 1
                            billingAccount: false
                          - id: 13
                            accountName: Site
                            level: 2
                            billingAccount: false
                create:
                  summary: Create Account Hierarchy response
                  value:
                    success: true
                    statusCode: 200
                    message: Account configuration created.
                    error: null
                    data: {}
                update:
                  summary: Update Account Hierarchy response
                  value:
                    success: true
                    statusCode: 200
                    message: Account configuration updated.
                    error: null
                    data: {}
components:
  schemas:
    AccountConfigRequest:
      oneOf:
        - $ref: '#/components/schemas/FetchHierarchiesRequest'
        - $ref: '#/components/schemas/CreateAccountConfigRequest'
        - $ref: '#/components/schemas/UpdateAccountConfigRequest'
    AccountConfigOperationResponse:
      oneOf:
        - $ref: '#/components/schemas/FetchHierarchiesResponse'
        - $ref: '#/components/schemas/AccountConfigResponse'
    FetchHierarchiesRequest:
      type: object
      required:
        - method
        - action
        - apiVersion
      properties:
        method:
          type: string
          example: Retrieve
        action:
          type: string
          example: Fetch Hierarchies
        apiVersion:
          type: string
          example: v2
    CreateAccountConfigRequest:
      type: object
      required:
        - data
        - method
        - action
        - apiVersion
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/HierarchyInput'
        method:
          type: string
          example: Create
        action:
          type: string
          example: Create Account Configuration
        apiVersion:
          type: string
          example: v2
    UpdateAccountConfigRequest:
      type: object
      required:
        - data
        - method
        - action
        - apiVersion
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/HierarchyInput'
        method:
          type: string
          example: Update
        action:
          type: string
          example: Update Account
        apiVersion:
          type: string
          example: v2
    FetchHierarchiesResponse:
      type: object
      properties:
        success:
          type: boolean
        data:
          type: array
          items:
            $ref: '#/components/schemas/HierarchyDetail'
        message:
          type: string
        statusCode:
          type: integer
        error:
          nullable: true
    AccountConfigResponse:
      type: object
      properties:
        success:
          type: boolean
        data:
          type: object
        message:
          type: string
        statusCode:
          type: integer
        error:
          nullable: true
    HierarchyInput:
      type: object
      required:
        - name
        - accounts
      properties:
        id:
          type: integer
          description: Only present when updating an existing hierarchy.
        name:
          type: string
        accounts:
          type: array
          items:
            $ref: '#/components/schemas/HierarchyAccountInput'
    HierarchyDetail:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        accounts:
          type: array
          items:
            $ref: '#/components/schemas/HierarchyAccountDetail'
    HierarchyAccountInput:
      type: object
      required:
        - accountName
        - level
      properties:
        id:
          type: integer
          description: Only present when updating an existing account row.
        accountName:
          type: string
        level:
          type: integer
          description: >-
            Auto-assigned sequentially by position in the accounts array; not
            settable independently.
        billingAccount:
          type: boolean
    HierarchyAccountDetail:
      type: object
      properties:
        id:
          type: integer
        accountName:
          type: string
        level:
          type: integer
        billingAccount:
          type: boolean
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Auth token returned from the login endpoint. Send as: `Authorization:
        <token>` (no Bearer prefix)

````