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

# Create a workspace API key

> Admin-only route. Creates a DB-backed scoped API key. The `api_secret` is returned only in this create response.




## OpenAPI

````yaml /api-reference/openapi.yaml post /api/v1/workspaces/{workspace_id}/api-keys
openapi: 3.0.3
info:
  title: Blockops Wallet API
  version: 0.1.0
  description: >
    The Blockops Wallet API: create MPC wallets, attach assets and read deposit
    addresses and balances, request withdrawals and signing, and manage webhooks
    and API keys.
servers:
  - url: https://wallet-sandbox.blockops.network
security:
  - AccessApiKey: []
    AccessTimestamp: []
    AccessSign: []
tags:
  - name: catalog
  - name: wallets
  - name: balances
  - name: withdrawals
  - name: transactions
  - name: signing
  - name: webhooks
  - name: api-keys
  - name: audit
  - name: observability
paths:
  /api/v1/workspaces/{workspace_id}/api-keys:
    post:
      tags:
        - api-keys
      summary: Create a workspace API key
      description: >
        Admin-only route. Creates a DB-backed scoped API key. The `api_secret`
        is returned only in this create response.
      parameters:
        - $ref: '#/components/parameters/WorkspaceID'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/APIKeyCreateRequest'
      responses:
        '201':
          description: Created API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIKeyCreatedEnvelope'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '503':
          $ref: '#/components/responses/RouteUnavailable'
components:
  parameters:
    WorkspaceID:
      name: workspace_id
      in: path
      required: true
      schema:
        type: string
  schemas:
    APIKeyCreateRequest:
      type: object
      required:
        - scopes
      properties:
        name:
          type: string
        scopes:
          type: array
          minItems: 1
          items:
            type: string
          example:
            - wallets:read
            - balances:read
        wallet_ids:
          type: array
          items:
            type: string
        walletIds:
          type: array
          items:
            type: string
        ip_allowlist:
          type: array
          items:
            type: string
        ipAllowlist:
          type: array
          items:
            type: string
        expires_at:
          type: string
          format: date-time
        expiresAt:
          type: string
          format: date-time
        created_by:
          type: string
        createdBy:
          type: string
    APIKeyCreatedEnvelope:
      allOf:
        - $ref: '#/components/schemas/EnvelopeBase'
        - type: object
          required:
            - data
          properties:
            data:
              $ref: '#/components/schemas/APIKeyCreated'
    EnvelopeBase:
      type: object
      required:
        - success
        - message
        - code
      properties:
        success:
          type: boolean
        message:
          type: string
          example: success
        code:
          oneOf:
            - type: integer
            - type: string
          example: 0
    APIKeyCreated:
      allOf:
        - $ref: '#/components/schemas/APIKey'
        - type: object
          required:
            - api_secret
          properties:
            api_secret:
              type: string
              description: Secret returned only when the key is created.
    ErrorEnvelope:
      allOf:
        - $ref: '#/components/schemas/EnvelopeBase'
        - type: object
          required:
            - data
          properties:
            success:
              type: boolean
              example: false
            data:
              nullable: true
    APIKey:
      type: object
      required:
        - id
        - api_key
        - workspace_id
        - scopes
        - wallet_ids
        - ip_allowlist
      properties:
        id:
          type: string
        api_key:
          type: string
        name:
          type: string
        workspace_id:
          type: string
        scopes:
          type: array
          items:
            type: string
        wallet_ids:
          type: array
          items:
            type: string
        ip_allowlist:
          type: array
          items:
            type: string
        created_by:
          type: string
        revoked_at:
          type: string
          format: date-time
        expires_at:
          type: string
          format: date-time
        last_used_at:
          type: string
          format: date-time
        last_used_ip:
          type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
  responses:
    BadRequest:
      description: Invalid request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Unauthorized:
      description: Authentication failed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            success: false
            message: invalid api signature
            code: unauthorized
            data: null
    Forbidden:
      description: Authenticated key is not allowed to access the route.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    RouteUnavailable:
      description: Route disabled, upstream missing, or dependency unavailable.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
  securitySchemes:
    AccessApiKey:
      type: apiKey
      in: header
      name: ACCESS-API-KEY
      description: HMAC API-key identifier.
    AccessTimestamp:
      type: apiKey
      in: header
      name: ACCESS-TIMESTAMP
      description: Unix timestamp in seconds.
    AccessSign:
      type: apiKey
      in: header
      name: ACCESS-SIGN
      description: Base64-encoded hex HMAC signature.

````