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

# Create an API key

> Creates a new scoped key for trusted integrations and MCP clients. This endpoint accepts only the in-product browser session cookie — `bp_` API keys cannot create other API keys. Use the in-app UI rather than calling this endpoint directly. The plaintext `bp_` key is returned once; store it immediately.



## OpenAPI

````yaml /openapi.yaml post /api/api-keys
openapi: 3.1.0
info:
  title: Blueprints API
  version: '1.0'
  description: >-
    API for approved Blueprints product clients and integrations. Account
    resources require bearer authentication.
servers:
  - url: https://api.useblueprints.ai
security:
  - apiKeyBearer: []
tags:
  - name: Health
    description: Service status endpoints that do not require authentication.
  - name: Market data
    description: Authenticated read-only helpers for finding supported market inputs.
  - name: Blueprints
    description: Create, inspect, update, deploy, and stop account-owned blueprints.
  - name: Orders
    description: Read account order activity.
  - name: Portfolio
    description: Read account-level balances, positions, and portfolio summary data.
  - name: Risk rules
    description: Read and update account-level trading safeguards.
  - name: API keys
    description: Manage API keys used by trusted external integrations and MCP clients.
paths:
  /api/api-keys:
    post:
      tags:
        - API keys
      summary: Create an API key
      description: >-
        Creates a new scoped key for trusted integrations and MCP clients. This
        endpoint accepts only the in-product browser session cookie — `bp_` API
        keys cannot create other API keys. Use the in-app UI rather than calling
        this endpoint directly. The plaintext `bp_` key is returned once; store
        it immediately.
      operationId: createApiKey
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 200
                scopes:
                  type: array
                  items:
                    $ref: '#/components/schemas/ApiKeyScope'
                  description: >-
                    Scopes granted to the new key. Send explicit least-privilege
                    scopes for API-created keys.
      responses:
        '200':
          description: Created API key including one-time plaintext key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKeyCreated'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      security: []
components:
  schemas:
    ApiKeyScope:
      type: string
      enum:
        - blueprints:read
        - blueprints:write
        - blueprints:deploy
        - orders:read
        - orders:write
        - market_data:read
        - portfolio:read
        - portfolio:write
        - risk:read
        - risk:write
        - api_keys:read
        - api_keys:write
    ApiKeyCreated:
      allOf:
        - $ref: '#/components/schemas/ApiKey'
        - type: object
          properties:
            key:
              type: string
              example: bp_YOUR_API_KEY
    ApiKey:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        scopes:
          type: array
          items:
            $ref: '#/components/schemas/ApiKeyScope'
        createdAt:
          type: string
          format: date-time
        lastUsedAt:
          type:
            - string
            - 'null'
          format: date-time
        revokedAt:
          type:
            - string
            - 'null'
          format: date-time
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
        message:
          type: string
  responses:
    Unauthorized:
      description: Missing, invalid, revoked, or expired credentials.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: Credential is valid but cannot perform this action.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    apiKeyBearer:
      type: http
      scheme: bearer
      bearerFormat: bp_ API key
      x-default: bp_YOUR_API_KEY

````