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

# Create a personal access token



## OpenAPI

````yaml https://portal.unicontrol.me/v1/openapi post /v1/user/personal-access-tokens
openapi: 3.1.0
info:
  title: Unicontrol API
  description: Welcome
  version: 1.0.0
servers:
  - url: http://0.0.0.0:3000
    description: Local Server
  - url: https://portal.test.flexhome.casa
    description: Development
  - url: https://portal.unicontrol.me
    description: Production
security:
  - bearerAuth: []
paths:
  /v1/user/personal-access-tokens:
    post:
      tags:
        - User
      summary: Create a personal access token
      operationId: postV1UserPersonal-access-tokens
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
              properties:
                name:
                  type: string
                  description: Nome do token
                expiresAt:
                  type: string
                  format: date-time
                  nullable: true
                  description: Data de expiração (null = nunca expira)
            example:
              name: CLI Token
              expiresAt: null
      responses:
        '201':
          description: Token created
          content:
            application/json:
              schema:
                type: object
                properties:
                  name:
                    type: string
                  value:
                    type: string
                    description: Token value (shown only once)
                  createdAt:
                    type: string
                    format: date-time
                  expiresAt:
                    type: string
                    format: date-time
                    nullable: true
              example:
                name: CLI Token
                value: pat_xxxxxxxx
                createdAt: '2026-03-17T10:00:00Z'
                expiresAt: null
        '400':
          description: Dados inválidos
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
              example:
                message: validation error
        '401':
          description: Não autenticado
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
              example:
                error: unauthorized
        '500':
          description: Erro interno do servidor
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
              example:
                error: internal_error
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````