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

# Rotate an API key

> Revokes the key and issues a replacement. The new plaintext secret is returned exactly once. Requires SIWE bearer auth.



## OpenAPI

````yaml /api-spec/openapi.yaml post /me/api-keys/{id}/rotate
openapi: 3.0.3
info:
  title: United Market API
  version: 1.0.0
  description: >-
    Public backend API for market data, trading, authentication, profiles,
    comments, and leaderboards.
servers:
  - url: https://api.unitedmarket.ai
    description: United Market backend
security: []
tags:
  - name: Markets
    description: >-
      Market discovery, market details, orderbooks, tickers, price history, and
      trades.
  - name: Orders
    description: Signed order submission, cancellation, order lookup, and balances.
  - name: Authentication
    description: SIWE wallet authentication.
  - name: Discovery
    description: Tags and market groups.
  - name: Social
    description: Comments, users, and leaderboard data.
  - name: Fees
    description: Effective trading fee rate per market.
  - name: Referral
    description: Referral codes, attribution, and reward summaries.
paths:
  /me/api-keys/{id}/rotate:
    post:
      tags:
        - API Keys
      summary: Rotate an API key
      description: >-
        Revokes the key and issues a replacement. The new plaintext secret is
        returned exactly once. Requires SIWE bearer auth.
      operationId: rotateApiKey
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: API key id.
      responses:
        '201':
          description: New API key issued. The `key` field appears only in this response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKeyWithSecret'
        '404':
          $ref: '#/components/responses/NotFound'
      security:
        - bearerAuth: []
components:
  schemas:
    ApiKeyWithSecret:
      allOf:
        - $ref: '#/components/schemas/ApiKey'
        - type: object
          properties:
            key:
              type: string
              description: >-
                The full plaintext secret. Returned only once, at creation or
                rotation.
              example: umk_live_xxxxxxxxxxxxxxxxxxxxxxxx
    ApiKey:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
          example: trading-bot
        prefix:
          type: string
          description: Non-secret display fragment of the key.
          example: umk_live_AbC123
        tier:
          type: string
          enum:
            - DEFAULT
            - PRO
            - INTERNAL
          description: Rate-limit tier.
        lastUsedAt:
          type: string
          format: date-time
          nullable: true
        revokedAt:
          type: string
          format: date-time
          nullable: true
        createdAt:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        message:
          type: string
        statusCode:
          type: integer
  responses:
    NotFound:
      description: Resource not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: SIWE access token returned by POST /auth/verify.

````