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

# Create an API key

> Dashboard-only — session cookie auth. The plaintext key is returned
exactly once in this response; only its prefix and metadata are
retrievable afterward. Store it immediately.




## OpenAPI

````yaml /api-reference/openapi.yaml post /v1/keys
openapi: 3.1.0
info:
  title: scrnshot API
  version: 1.0.0
  summary: Programmatic screenshot capture for developers.
  description: |
    scrnshot renders a URL and returns a hosted image. Authenticate with an
    API key (`X-API-Key`) for the endpoints under `/v1/screenshots` and
    `/v1/usage`. API-key management (`/v1/keys`) and billing endpoints use
    dashboard session cookies instead and are documented here for
    completeness — they are not part of the programmatic integration
    surface.

    Quotas are monthly (Free: 100/mo, Pro: 5,000/mo). Independently, requests
    are rate-limited per minute (Free: 5/min, Pro: 60/min). Exceeding the
    monthly quota returns `402`; exceeding the per-minute rate limit returns
    `429`.
servers:
  - url: https://api.scrnshot.site
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Screenshots
    description: Capture, list, and delete screenshots.
  - name: Usage
    description: Quota and rate-limit consumption.
  - name: API Keys
    description: |
      Dashboard-only. Authenticated with a session cookie, not an API key —
      a key cannot be used to mint or revoke other keys.
  - name: Billing
    description: Dashboard-only. Authenticated with a session cookie.
  - name: Demo
    description: |
      Unauthenticated, IP-rate-limited endpoint that powers the live demo on
      scrnshot.site. Not intended for integration — use `/v1/screenshots`
      with an API key instead.
paths:
  /v1/keys:
    post:
      tags:
        - API Keys
      summary: Create an API key
      description: |
        Dashboard-only — session cookie auth. The plaintext key is returned
        exactly once in this response; only its prefix and metadata are
        retrievable afterward. Store it immediately.
      operationId: createApiKey
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: Optional label for the key.
                  example: production
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKeyCreatedResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          description: Maximum number of API keys already reached for this account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: maximum number of api keys reached
        '500':
          $ref: '#/components/responses/ServerError'
      security:
        - SessionAuth: []
components:
  schemas:
    ApiKeyCreatedResponse:
      type: object
      required:
        - id
        - name
        - key
        - key_prefix
        - created_at
      properties:
        id:
          type: integer
        name:
          type: string
        key:
          type: string
          description: Plaintext API key. Shown only in this response — store it now.
          example: sk_live_9f2b1c7a4e6d8f0a1b2c3d4e5f6a7b8c
        key_prefix:
          type: string
          description: First segment of the key, safe to display after creation.
          example: sk_live_9f2b
        created_at:
          type: string
          format: date-time
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Human-readable error message.
  responses:
    Unauthorized:
      description: Missing, malformed, or revoked credentials.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: unauthorized
    ServerError:
      description: Unexpected server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: |
        Programmatic auth for the `/v1/screenshots` and `/v1/usage`
        endpoints. Create a key from the dashboard (`POST /v1/keys`); the
        plaintext value is shown once at creation.
    SessionAuth:
      type: apiKey
      in: cookie
      name: session
      description: |
        HttpOnly session cookie set on login. Used by the scrnshot dashboard
        only — `/v1/keys` and `/v1/billing/*` are not part of the
        programmatic API and cannot be called with an API key.

````