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

# Rotate key

> Generates a new API key and revokes the current one. The new key is returned exactly once. The old key stops working immediately.



## OpenAPI

````yaml POST /v1/auth/keys/rotate
openapi: 3.1.0
info:
  title: Docent API
  description: >-
    REST API for programmatic trading on Hyperliquid and Polymarket via Docent.
    Create API agents, fund a dedicated wallet, place trades, check balances,
    and move funds between venues with API keys.
  version: 1.0.0
  contact:
    email: support@trydocent.com
servers:
  - url: https://api.trydocent.com
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Auth
    description: Registration, key management, and auth status
  - name: Balances
    description: Unified balance across all trading venues
  - name: Positions
    description: Open positions on Hyperliquid and Polymarket
  - name: Markets
    description: Market metadata and search
  - name: Orders
    description: Place orders on Hyperliquid perpetuals, spot, and Polymarket
  - name: Transfers
    description: Move funds between trading venues
  - name: Actions
    description: Poll workflow execution status
  - name: Strategies
    description: Coming soon. Reserved for future strategy endpoints.
paths:
  /v1/auth/keys/rotate:
    post:
      tags:
        - Auth
      summary: Rotate API key
      description: >-
        Generates a new API key and revokes the current one. The new key is
        returned exactly once. The old key stops working immediately.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RotateRequest'
      responses:
        '200':
          description: New API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RotateResponse'
components:
  schemas:
    RotateRequest:
      type: object
      properties:
        label:
          type: string
          description: Optional new label for the key
          maxLength: 64
    RotateResponse:
      type: object
      properties:
        apiKey:
          type: string
          description: Your new API key. The old key is now revoked.
          example: dk_live_f6e5d4c3b2a1f6e5d4c3b2a1f6e5d4c3
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key in the format `dk_live_...`. Pass as `Authorization: Bearer
        dk_live_...`

````