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

# Mint a workspace API key (owner/admin + multi-workspace plan)

> Returns the raw sk_ws_… key ONCE. 402 with code API_KEYS_NOT_AVAILABLE on a single-workspace plan.



## OpenAPI

````yaml /openapi.json post /api/workspaces/{id}/keys
openapi: 3.1.0
info:
  title: Syvon API
  version: 1.0.0
  description: >-
    Two client-facing surfaces: the Portal management plane (syvon.ai/api/*,
    portal JWT) and the Brain read plane (brain.syvon.ai/v1/*, workspace key
    sk_ws_…). Schemas are generated from the @syvon/sdk TypeScript types — the
    shipped .d.ts files are the authoritative contract.
servers:
  - url: https://syvon.ai
    description: Portal (management plane)
  - url: https://brain.syvon.ai
    description: Brain (read plane)
security: []
tags:
  - name: Auth
    description: Minting the portal JWT
  - name: Portal
    description: Management plane — user-scoped (portal JWT)
  - name: Brain
    description: Published-agent read plane — workspace-scoped (sk_ws_…)
paths:
  /api/workspaces/{id}/keys:
    post:
      tags:
        - Portal
      summary: Mint a workspace API key (owner/admin + multi-workspace plan)
      description: >-
        Returns the raw sk_ws_… key ONCE. 402 with code API_KEYS_NOT_AVAILABLE
        on a single-workspace plan.
      operationId: mintApiKey
      parameters:
        - name: id
          in: path
          required: true
          description: Workspace id
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                rateLimit:
                  type: number
              required:
                - name
      responses:
        '200':
          description: The minted key (raw key shown once)
          content:
            application/json:
              schema:
                type: object
                properties:
                  key:
                    $ref: '#/components/schemas/MintedApiKey'
                required:
                  - key
        '402':
          description: API keys not available on this plan
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
      security:
        - bearerAuth: []
      servers:
        - url: https://syvon.ai
components:
  schemas:
    MintedApiKey:
      allOf:
        - $ref: '#/components/schemas/ApiKeyMetadata'
        - type: object
          description: ''
          properties:
            key:
              description: The raw key. Returned ONCE at mint time — capture or lose it.
              type: string
          required:
            - key
    ApiKeyMetadata:
      type: object
      description: ''
      properties:
        id:
          description: ''
          type: string
        name:
          description: ''
          type: string
        prefix:
          description: 12-char display prefix (e.g. `sk_ws_abcdef`).
          type: string
        rateLimit:
          description: ''
          anyOf:
            - type: number
            - type: 'null'
        lastUsedAt:
          description: ''
          anyOf:
            - type: string
            - type: 'null'
        createdAt:
          description: ''
          type: string
        revokedAt:
          description: ''
          anyOf:
            - type: string
            - type: 'null'
      required:
        - id
        - name
        - prefix
        - rateLimit
        - lastUsedAt
        - createdAt
        - revokedAt
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Portal API JWT (user-scoped, ~1h)

````