> ## 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.

# Создать сервисную учетную запись аккаунта

> Создает сервисную учетную запись и один раз показывает ее токен.

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


## OpenAPI

````yaml /openapi.ru.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: Создать сервисную учетную запись аккаунта
      description: Создает сервисную учетную запись и один раз показывает ее токен.
      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: Ошибка валидации
      security:
        - PublicBearerAuth: []
components:
  schemas:
    ServiceAccountCreateRequest:
      description: Тело запроса для создания сервисной учетной записи.
      properties:
        expires_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          description: Необязательная UTC-метка времени истечения срока действия токена
          title: истекает время
        name:
          description: Понятное человеку имя сервисной учетной записи
          maxLength: 120
          minLength: 1
          title: Имя
          type: string
      required:
        - name
      title: ServiceAccountCreateRequest
      type: object
    ServiceAccountCreateResponse:
      properties:
        account_id:
          format: uuid
          title: Id аккаунта
          type: string
        created_at:
          format: date-time
          title: Создано в
          type: string
        created_by_user_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          title: ID создавшего пользователя
        expires_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: истекает время
        id:
          format: uuid
          title: ID
          type: string
        last_used_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Последнее использование
        name:
          title: Имя
          type: string
        revoked_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Время отзыва
        revoked_by_user_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          title: Отозвано пользователем с ID
        token:
          description: >-
            Bearer-токен в открытом виде. Сохраните его сейчас; он больше
            никогда не возвращается.
          title: токен
          type: string
        token_last4:
          title: Последние 4 символа токена
          type: string
        token_prefix:
          title: Префикс токена
          type: string
        token_public_id:
          title: Публичный ID токена
          type: string
        updated_at:
          format: date-time
          title: Обновлено в
          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: Сведения
          type: array
      title: HTTPОшибка проверки
      type: object
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Расположение
          type: array
        msg:
          title: Сообщение
          type: string
        type:
          title: Тип ошибки
          type: string
      required:
        - loc
        - msg
        - type
      title: Ошибка проверки
      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

````