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

# Rotate API Key

> Generates a new API key with the same configuration as the invoking key.



## OpenAPI

````yaml post /v1/api-keys/rotate
openapi: 3.0.1
info:
  title: REST API
  description: >-
    The Coinbase Prime REST API provides programmatic access to trading,
    custody, staking, market data, and account management functionality.
  version: '0.1'
servers:
  - url: https://api.prime.coinbase.com/
security: []
tags:
  - name: PrimeRESTAPI
paths:
  /v1/api-keys/rotate:
    post:
      tags:
        - API Key Management
      summary: Rotate API Key
      description: Generates a new API key with the same configuration as the invoking key.
      operationId: PrimeRESTAPI_RotateAPIKey
      requestBody:
        description: Request body for rotating an API key.
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/coinbase.public_rest_api.RotateAPIKeyRequest
        required: true
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/coinbase.public_rest_api.RotateAPIKeyResponse
components:
  schemas:
    coinbase.public_rest_api.RotateAPIKeyRequest:
      type: object
      properties:
        duration_seconds:
          type: integer
          description: >-
            How long the old key remains active after the new key is approved.
            Set to 0 for immediate expiry on approval. Cannot extend beyond the
            original key's expiry.
          format: int64
      description: Request body for rotating an API key.
    coinbase.public_rest_api.RotateAPIKeyResponse:
      type: object
      properties:
        encrypted_credentials:
          type: string
          description: >-
            Base64-encoded encrypted payload containing new API key credentials.
            Wire format after base64 decode: version(1 byte) | salt(32 bytes) |
            nonce(12 bytes) | ciphertext+tag.
        activity_id:
          type: string
          description: >-
            The Prime activity ID tracking the consensus approval for this
            rotation. Use with the Activities endpoints to monitor approval
            status.
      description: >-
        Response containing encrypted credentials for the newly created API key.
        Decrypt using your current secret_key with HKDF-SHA256 + AES-256-GCM.
        See the Rotate API Key guide for decryption instructions.

````