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

# Create account

> Creates a `pending` sub-account (a master’s end-customer) under the caller’s master. The parent is resolved from the API key, never from the body. Pass `Idempotency-Key`; replaying the same key returns the original 201 instead of creating a duplicate. Emits the `account.created` webhook.



## OpenAPI

````yaml /openapi.json post /v1/accounts
openapi: 3.0.0
info:
  contact: {}
  description: >-
    Comprehensive payment platform API supporting fiat and crypto payments,
    currency conversion, and compliance management
  title: Zuba Payment Platform API
  version: '1.0'
servers: []
security: []
tags:
  - description: Manage M2M API keys and credentials
    name: API Keys
  - description: Internal ledger accounts and transactions
    name: Ledger
  - description: Handle incoming payments and deposits
    name: Pay-ins
  - description: Manage payouts, beneficiaries, and SEPA transfers
    name: Payouts
  - description: Manage outbound webhook endpoints and deliveries
    name: Webhooks
paths:
  /v1/accounts:
    post:
      tags:
        - Accounts
      summary: Create account
      description: >-
        Creates a `pending` sub-account (a master’s end-customer) under the
        caller’s master. The parent is resolved from the API key, never from the
        body. Pass `Idempotency-Key`; replaying the same key returns the
        original 201 instead of creating a duplicate. Emits the
        `account.created` webhook.
      operationId: AccountsController_createAccount
      parameters:
        - description: Client-generated idempotency key (UUID)
          in: header
          name: Idempotency-Key
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAccountRecordDto'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountResponseDto'
          description: ''
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenericErrorResponseDto'
          description: Missing Idempotency-Key or invalid body
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenericErrorResponseDto'
          description: insufficient_scope (missing create:accounts)
      security:
        - bearer: []
components:
  schemas:
    CreateAccountRecordDto:
      properties:
        country:
          description: Country of the account, ISO-3166 alpha-2
          example: SN
          type: string
        name:
          description: Human-readable account name
          example: Trans-Sahel Logistics SARL
          maxLength: 255
          type: string
      required:
        - name
        - country
      type: object
    AccountResponseDto:
      properties:
        accountType:
          enum:
            - master
            - sub
          type: string
        country:
          description: ISO-3166 alpha-2
          example: SN
          type: string
        createdAt:
          format: date-time
          type: string
        id:
          description: Account record id
          format: uuid
          type: string
        parentAccountId:
          description: The master that owns this account. Derived from the API key.
          format: uuid
          type: string
        status:
          enum:
            - pending
            - active
            - suspended
            - closed
          type: string
      required:
        - id
        - parentAccountId
        - accountType
        - status
        - country
        - createdAt
      type: object
    GenericErrorResponseDto:
      properties:
        error:
          description: Error type identifier
          example: BAD_REQUEST
          type: string
        message:
          description: Error message
          example: Bad Request
          type: string
        path:
          description: Request path that generated the error
          example: /v1/beneficiaries
          type: string
        statusCode:
          description: HTTP status code
          example: 400
          type: number
        timestamp:
          description: ISO timestamp when the error occurred
          example: '2024-01-15T10:30:00.000Z'
          type: string
      required:
        - statusCode
        - message
        - error
        - timestamp
        - path
      type: object
  securitySchemes:
    bearer:
      bearerFormat: JWT
      description: Enter Auth0 JWT token
      scheme: bearer
      type: http

````