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

# Create a new API token



## OpenAPI

````yaml https://vooi-api-app.fly.dev/swagger/json post /user/tokens
openapi: 3.1.0
info:
  title: VOOI API
  description: Unified perps API
  version: '1.0'
  contact: {}
servers:
  - url: https://perps-api.vooi.io
security: []
tags: []
paths:
  /user/tokens:
    post:
      tags:
        - Tokens
      summary: Create a new API token
      operationId: TokensController_createToken
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTokenBodyDto'
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateTokenResultDto'
components:
  schemas:
    CreateTokenBodyDto:
      type: object
      properties:
        expiresIn:
          description: >-
            Token lifetime in seconds. Defaults to 604800 (7 days). Must be > 0.
            When > 604800, `name` is required.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        name:
          description: >-
            Token name. Required when `expiresIn` > 604800 (7 days). Must be
            unique per user. Tokens without a name are session tokens and are
            not enumerable.
          type: string
        signature:
          type: string
          pattern: ^[0-9a-f]{128}$
          description: >-
            Ed25519 signature of the token creation request.


            Message: `createToken:<timestamp>:<expiresIn>:<name>:<userId>` —
            data fields sorted alphabetically by key. Omitted optional fields
            become an empty slot (not a dropped slot):

            - name omitted → `createToken:<ts>:<expiresIn>::<userId>`

            - expiresIn omitted → `createToken:<ts>::<name>:<userId>`

            - both omitted → `createToken:<ts>:::<userId>`


            Sign the UTF-8 bytes of the message with the Ed25519 private key
            whose public key is registered for the user. Encode the signature as
            lowercase hex, 128 chars, no 0x prefix.
          example: >-
            a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2
        timestamp:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: >-
            Unix timestamp in milliseconds. Must be within ±2 minutes of server
            time or the request is rejected with 401 Signature expired.
        userId:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
          description: >-
            User identifier. Send the value verbatim — do not re-case it, since
            the signed message must match byte-for-byte.
      required:
        - signature
        - timestamp
        - userId
      title: CreateTokenBody
    CreateTokenResultDto:
      type: object
      properties:
        expiresAt:
          description: Token expiration date
          type: string
          format: date
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
        id:
          type: string
          description: Token ID
        token:
          type: string
          description: Bearer token value
      required:
        - expiresAt
        - id
        - token
      title: CreateTokenResult

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.