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

# Create a personal access token.

> Returns the plain-text token once. Store it securely; it cannot be read
again from the API.



## OpenAPI

````yaml api/openapi.json post /api/tokens
openapi: 3.0.2
info:
  contact:
    name: OpenAgents
    url: https://openagents.com
  description: >-
    OpenAgents REST API (Laravel). Primary auth is Sanctum bearer tokens for
    /api endpoints.
  title: OpenAgents API
  version: 1.0.0
servers:
  - description: Primary production server
    url: https://openagents.com
security:
  - SanctumToken: []
tags:
  - description: Authentication context and token lifecycle endpoints.
    name: Auth
  - description: Conversation, run, and stream endpoints.
    name: Chat
  - description: Autopilot resources, thread scoping, and stream alias routes.
    name: Autopilot
  - description: Authenticated profile management endpoints.
    name: Profile
  - description: Global public broadcast messages, optionally scoped by zone.
    name: Shouts
  - description: Direct messages between two users, inbox and thread retrieval.
    name: Whispers
  - description: Lightning L402 wallet, receipts, and deployment telemetry endpoints.
    name: L402
  - description: >-
      Per-user Spark wallet lifecycle and payment APIs (invoice + pay + spark
      transfers).
    name: Agent Payments
paths:
  /api/tokens:
    post:
      tags:
        - Auth
      summary: Create a personal access token.
      description: |-
        Returns the plain-text token once. Store it securely; it cannot be read
        again from the API.
      requestBody:
        content:
          application/json:
            schema:
              properties:
                abilities:
                  example:
                    - chat:read
                    - chat:write
                  items:
                    type: string
                  type: array
                expires_at:
                  format: date-time
                  nullable: true
                  type: string
                name:
                  example: api-cli
                  type: string
              required:
                - name
              type: object
        description: Create a new Sanctum personal access token
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                properties:
                  data:
                    properties:
                      abilities:
                        items:
                          type: string
                        type: array
                      expiresAt:
                        format: date-time
                        nullable: true
                        type: string
                      name:
                        type: string
                      token:
                        type: string
                      tokenableId:
                        type: integer
                    type: object
                type: object
          description: Token created; plain token value is returned once
        '401':
          content:
            application/json:
              schema:
                properties:
                  message:
                    example: Unauthenticated.
                    type: string
                type: object
          description: Authentication required
        '422':
          content:
            application/json:
              schema:
                properties:
                  errors:
                    additionalProperties:
                      items:
                        type: string
                      type: array
                    type: object
                  message:
                    example: The given data was invalid.
                    type: string
                type: object
          description: Validation error
components:
  securitySchemes:
    SanctumToken:
      bearerFormat: Sanctum PAT
      scheme: bearer
      type: http

````