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

# Crear cuenta de servicio de la cuenta

> Crea una cuenta de servicio y revela su token una sola vez.

<script src="/locale-bridge.js" />


## OpenAPI

````yaml /openapi.es.json POST /v1/public/accounts/{account_id}/auth/service-accounts
openapi: 3.1.0
info:
  title: Code API (Public)
  version: 1.0.0
servers:
  - url: https://api.hybridbox.io
security: []
paths:
  /v1/public/accounts/{account_id}/auth/service-accounts:
    post:
      tags:
        - public-accounts
        - public-account-auth
      summary: Crear cuenta de servicio de la cuenta
      description: Crea una cuenta de servicio y revela su token una sola vez.
      operationId: >-
        create_public_account_service_account_v1_public_accounts__account_id__auth_service_accounts_post
      parameters:
        - in: path
          name: account_id
          required: true
          schema:
            format: uuid
            title: Account Id
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ServiceAccountCreateRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceAccountCreateResponse'
          description: ''
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Error de validación
      security:
        - PublicBearerAuth: []
components:
  schemas:
    ServiceAccountCreateRequest:
      description: Cuerpo de la solicitud para crear una cuenta de servicio.
      properties:
        expires_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          description: Marca de tiempo UTC opcional de caducidad del token
          title: expira en
        name:
          description: Nombre legible de la cuenta de servicio
          maxLength: 120
          minLength: 1
          title: Nombre
          type: string
      required:
        - name
      title: ServiceAccountCreateRequest
      type: object
    ServiceAccountCreateResponse:
      properties:
        account_id:
          format: uuid
          title: Id de cuenta
          type: string
        created_at:
          format: date-time
          title: Creado el
          type: string
        created_by_user_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          title: creado por User ID
        expires_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: expira en
        id:
          format: uuid
          title: ID
          type: string
        last_used_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Usado por última vez el
        name:
          title: Nombre
          type: string
        revoked_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: revocado en
        revoked_by_user_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          title: Revocado por ID de usuario
        token:
          description: >-
            Token bearer en texto claro. Guárdalo ahora; nunca se volverá a
            devolver.
          title: token
          type: string
        token_last4:
          title: Últimos 4 del token
          type: string
        token_prefix:
          title: Prefijo del token
          type: string
        token_public_id:
          title: ID público del token
          type: string
        updated_at:
          format: date-time
          title: Actualizado el
          type: string
      required:
        - id
        - account_id
        - name
        - token_public_id
        - token_prefix
        - token_last4
        - created_at
        - updated_at
        - token
      title: ServiceAccountCreateResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detalle
          type: array
      title: HTTPValidationError
      type: object
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Ubicación
          type: array
        msg:
          title: Mensaje
          type: string
        type:
          title: Tipo de error
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
  securitySchemes:
    PublicBearerAuth:
      bearerFormat: JWT or Hybridbox Service account token
      description: >-
        Public API bearer credential sent as `Authorization: Bearer <token>`.
        Use either an OAuth access token or a Hybridbox Service account token.
      scheme: bearer
      type: http

````