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

# Crear un Tipo de Cuenta

> Utilice este endpoint para crear un Tipo de Cuenta. Puede crear múltiples Tipos de Cuenta, pero deben agregarse uno a la vez.



## OpenAPI

````yaml es/openapi/v3-current/ledger.yaml post /v1/organizations/{organization_id}/ledgers/{ledger_id}/account-types
openapi: 3.1.0
info:
  title: API de Midaz Ledger
  description: >-
    Referencia completa de la API para los servicios de Midaz Ledger, incluyendo
    gestión de organizaciones, operaciones de ledger, activos, segmentos,
    portafolios, cuentas, tipos de cuenta, transacciones, operaciones, saldos,
    rutas de operación, rutas de transacción e índices de metadatos.
  version: 3.7.8
servers:
  - url: https://ledger.sandbox.lerian.net
security: []
tags:
  - name: Organizations API
  - name: Ledgers API
  - name: Assets API
  - name: Segments API
  - name: Portfolios API
  - name: Account Types API
  - name: Accounts API
  - name: Balances API
  - name: Transactions API
  - name: Operations API
  - name: Operation Routes API
  - name: Transaction Routes API
  - name: Metadata Indexes API
  - name: Holders API
  - name: Instruments API
  - name: Billing Packages API
  - name: Packages API
  - name: Billing Calculation API
  - name: Estimation API
  - name: Encryption API
  - name: Protection API
  - name: Asset Rates API
paths:
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/account-types:
    post:
      tags:
        - Account types API
      summary: Crear un Tipo de Cuenta
      description: >-
        Utilice este endpoint para crear un Tipo de Cuenta. Puede crear
        múltiples Tipos de Cuenta, pero deben agregarse uno a la vez.
      parameters:
        - $ref: '#/components/parameters/OrganizationId'
        - $ref: '#/components/parameters/LedgerId'
        - $ref: '#/components/parameters/ContentType'
        - $ref: '#/components/parameters/XRequestId'
        - $ref: '#/components/parameters/Authorization'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAccountTypeRequest'
            example:
              name: Deposit Account
              description: Deposit Account
              keyValue: deposit
              metadata:
                supportsOverdraft: true
                minimumBalance: 0
                statementFrequency: monthly
                category: retail
                internalCode: ACC_TYPE_TX_001
      responses:
        '201':
          description: >-
            Indica que el recurso fue creado exitosamente y la operación se
            completó como se esperaba.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateAccountTypeResponse'
          headers: {}
        '400':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorFormat'
              examples:
                Error0009:
                  $ref: '#/components/examples/Error0009'
                Error0047:
                  $ref: '#/components/examples/Error0047'
                Error0050:
                  $ref: '#/components/examples/Error0050'
                Error0051:
                  $ref: '#/components/examples/Error0051'
                Error0053:
                  $ref: '#/components/examples/Error0053'
                Error0067:
                  $ref: '#/components/examples/Error0067'
                Error0094:
                  $ref: '#/components/examples/Error0094'
                Error0120:
                  $ref: '#/components/examples/Error0120'
        '401':
          description: No autorizado
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorFormat'
              examples:
                Error0041:
                  $ref: '#/components/examples/Error0041'
                Error0042:
                  $ref: '#/components/examples/Error0042'
        '403':
          description: Prohibido
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorFormat'
              examples:
                Error0043:
                  $ref: '#/components/examples/Error0043'
        '404':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorFormat'
              examples:
                Error0037:
                  $ref: '#/components/examples/Error0037'
                Error0038:
                  $ref: '#/components/examples/Error0038'
        '409':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorFormat'
              examples:
                Error0108:
                  $ref: '#/components/examples/Error0108'
        '500':
          description: Error Interno del Servidor
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorFormat'
              examples:
                Error0046:
                  $ref: '#/components/examples/Error0046'
components:
  parameters:
    OrganizationId:
      name: organization_id
      in: path
      description: El identificador único de la Organización asociada al Ledger.
      required: true
      example: 019c96a0-0a98-7287-9a31-786e0809c769
      schema:
        type: string
        format: uuid
    LedgerId:
      name: ledger_id
      in: path
      description: El identificador único del Ledger asociado.
      required: true
      example: 019c96a0-0ac0-7de9-9f53-9cf842a2ee5a
      schema:
        type: string
        format: uuid
    ContentType:
      name: Content-Type
      in: header
      description: >-
        El tipo de medio del recurso. El valor recomendado es
        `application/json`.
      required: false
      example: application/json
      schema:
        type: string
    XRequestId:
      name: X-Request-Id
      in: header
      description: Un identificador único utilizado para rastrear y seguir cada solicitud.
      required: false
      example: 019c96a0-0a98-7287-9a31-786e0809c769
      schema:
        type: string
        format: uuid
    Authorization:
      name: Authorization
      in: header
      required: false
      schema:
        type: string
      description: >
        Token JWT bearer para autenticación.

        Requerido cuando `PLUGIN_AUTH_ENABLED=true` (obligatorio en despliegues
        multiinquilino).

        Opcional en el modo OSS de inquilino único predeterminado.

        Formato: `Bearer <token>`
  schemas:
    CreateAccountTypeRequest:
      type: object
      properties:
        name:
          type: string
          maxLength: 100
          description: Nombre del Tipo de Cuenta.
        description:
          type: string
          maxLength: 500
          description: Descripción del Tipo de Cuenta.
        keyValue:
          type: string
          maxLength: 50
          pattern: ^[a-zA-Z0-9_-]+$
          description: >
            Identificador único del Tipo de Cuenta que se está creando.

            **Importante:** Si la funcionalidad de Tipos de Cuenta está
            habilitada, este valor se vuelve **obligatorio** al [crear
            cuentas](/es/reference/midaz/create-an-account) — solo se aceptarán
            los `keyValues` registrados previamente en el campo `type` de la API
            de Cuentas.

            Caracteres aceptados: alfanuméricos (mayúsculas y minúsculas),
            guiones (-) y guiones bajos (_).
        metadata:
          $ref: '#/components/schemas/Metadata'
      required:
        - name
        - keyValue
    CreateAccountTypeResponse:
      type: object
      properties:
        id:
          type: string
          description: El identificador único del Tipo de Cuenta.
          format: uuid
        organizationId:
          type: string
          format: uuid
          description: El identificador único de la Organización.
        ledgerId:
          type: string
          description: El identificador único del Ledger.
          format: uuid
        name:
          type: string
          description: Nombre del Tipo de Cuenta.
        description:
          type: string
          description: Descripción del Tipo de Cuenta.
        keyValue:
          type: string
          description: Identificador único del Tipo de Cuenta creado.
        createdAt:
          type: string
          format: date-time
          description: Fecha y hora de creación (UTC).
        updatedAt:
          type: string
          format: date-time
          description: Fecha y hora de la última actualización (UTC).
        deletedAt:
          type:
            - string
            - 'null'
          format: date-time
          description: Fecha y hora de la eliminación lógica, si aplica (UTC).
        metadata:
          $ref: '#/components/schemas/Metadata'
    ErrorFormat:
      type: object
      description: El mensaje de error de respuesta.
      required:
        - code
        - title
        - message
      properties:
        code:
          type: string
          description: Un identificador único y estable para el error.
        title:
          type: string
          description: Un breve resumen del problema.
        message:
          type: string
          description: Orientación detallada para resolver el error.
        entityType:
          type: string
          description: >-
            El tipo de entidad a la que se refiere el error (p. ej.
            organization, ledger, account, transaction). Opcional.
        fields:
          type: object
          additionalProperties: true
          description: Información adicional sobre los campos que causaron el error.
    Metadata:
      type: object
      additionalProperties:
        oneOf:
          - type: string
            maxLength: 2000
          - type: number
          - type: boolean
      description: >-
        Un objeto que contiene pares clave-valor para agregar como metadatos,
        donde el campo `name` es la clave y el campo `value` es el valor. Por
        ejemplo, para agregar un Centro de Costo, use `'costCenter':
        'BR_11101997'`.


        **Restricciones:** las claves deben tener como máximo 100 caracteres;
        los valores de cadena de texto, como máximo 2000 caracteres. No se
        permiten objetos anidados (los valores deben ser cadena de texto, número
        o booleano), la estructura no puede exceder una profundidad máxima de
        10, y se permite un máximo de 100 claves.
  examples:
    Error0009:
      summary: Missing Fields in Request
      value:
        code: 9
        title: Missing Fields in Request
        message: >-
          Your request is missing one or more required fields. Please refer to
          the documentation to ensure all necessary fields are included in your
          request.
        fields:
          metadataKey: metadataKey is a required field
    Error0047:
      summary: Bad Request
      value:
        code: '0047'
        title: Bad Request
        message: >-
          The server could not understand the request due to malformed syntax.
          Please check the listed fields and try again.
    Error0050:
      value:
        code: '0050'
        title: Invalid Metadata
        message: >-
          One or more metadata entries are invalid. Please ensure metadata keys
          and values follow the allowed format.
      summary: Invalid Metadata
    Error0051:
      value:
        code: '0051'
        title: Invalid Metadata Key
        message: >-
          A metadata key contains unsupported characters or exceeds length
          limits. Please correct the key and try again.
      summary: Invalid Metadata Key
    Error0053:
      value:
        code: '0053'
        title: Unexpected Fields in the Request
        message: >-
          The request body contains more fields than expected. Please send only
          the allowed fields as per the documentation. The unexpected fields are
          listed in the fields object.
        fields:
          '{{field}}': '{{value}}'
      summary: Unexpected Fields in the Request
    Error0067:
      value:
        code: '0067'
        title: Invalid Metadata Nesting
        message: >-
          The metadata object cannot contain nested values. Please ensure that
          the value {{value}} is not nested and try again.
      summary: Invalid Metadata Nesting
    Error0094:
      value:
        code: 94
        title: Invalid Request Body
        message: >-
          The request body is invalid or could not be parsed. Please check JSON
          structure and field types.
      summary: Invalid Request Body
    Error0120:
      value:
        code: '0120'
        title: Invalid Characters
        message: >-
          The field 'keyValue' contains invalid characters. Use only letters,
          numbers, underscores and hyphens.
      summary: Invalid Characters
    Error0041:
      summary: Token Missing
      value:
        code: '0041'
        title: Token Missing
        message: >-
          A valid token must be provided in the request header. Please include a
          token and try again.
    Error0042:
      summary: Invalid Token
      value:
        code: '0042'
        title: Invalid Token
        message: >-
          The provided token is expired, invalid or malformed. Please provide a
          valid token and try again.
    Error0043:
      summary: Insufficient Privileges
      value:
        code: '0043'
        title: Insufficient Privileges
        message: >-
          You do not have the necessary permissions to perform this action.
          Please contact your administrator if you believe this is an error.
    Error0037:
      summary: Ledger ID Not Found
      value:
        code: '0037'
        title: Ledger ID Not Found
        message: >-
          The provided ledger ID does not exist in our records. Please verify
          the ledger ID and try again.
    Error0038:
      summary: Organization ID Not Found
      value:
        code: 38
        title: Organization ID Not Found
        message: >-
          The provided organization ID does not exist in our records. Please
          verify the organization ID and try again.
    Error0108:
      value:
        code: 108
        title: Duplicate Account Type Key Value Error
        message: >-
          An account type with the specified key value already exists for this
          organization and ledger. Please use a different key value or update
          the existing account type.
      summary: Duplicate Account Type Key Value Error
    Error0046:
      summary: Internal Server Error
      value:
        code: '0046'
        title: Internal Server Error
        message: >-
          The server encountered an unexpected error. Please try again later or
          contact support.

````