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

# Create an API key

> JWT-only; the secret is shown exactly once. JWT provisioning operation.



## OpenAPI

````yaml /api-reference/openapi.yaml post /v1/api-keys
openapi: 3.1.0
info:
  title: Bonya Compute REST API
  version: 0.1.0
  description: >
    Public REST and WebSocket surface on TApi behind Caddy. Non-2xx responses
    are RFC 9457 application/problem+json with a stable machine-readable code.
    WebSocket endpoints are HTTP GET upgrades; their options travel in the START
    frame, never in query strings.
servers:
  - url: https://api.bonya.ai
    description: Production
security:
  - personalApiKey: []
  - supabaseJwt: []
tags:
  - name: Sandboxes
    description: Create, look up, list, pause, fork, snapshot, and delete sandboxes.
  - name: Snapshots
    description: Named point-in-time copies of a sandbox that new sandboxes can start from.
  - name: Templates
    description: Saved, versioned launch configurations for sandboxes.
  - name: Registry Connections
    description: Credentials for pulling private container images.
  - name: Secrets
    description: Write-only secrets and secret sets injected into sandboxes and jobs.
  - name: Previews
    description: Expose a sandbox port as an HTTPS URL.
  - name: Exec
    description: Run a command in a sandbox, buffered or over a TTY.
  - name: Sessions
    description: Named, persistent command sessions that outlive a connection.
  - name: Filesystem
    description: Read, write, and manage files inside a sandbox.
  - name: Jobs
    description: Managed, tracked runs of a command or script.
  - name: Job Schedules
    description: Cron, interval, or one-shot timing wrapped around a job.
  - name: Organizations
    description: Organization membership, administration and usage reporting.
  - name: Invitations
    description: Invite members to an organization and accept invitations.
  - name: API Keys
    description: Personal API key management.
  - name: Device Login
    description: Browser-based login for the CLI.
paths:
  /v1/api-keys:
    post:
      tags:
        - API Keys
      summary: Create an API key
      description: JWT-only; the secret is shown exactly once. JWT provisioning operation.
      operationId: createApiKey
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/APIKeyCreateRequest'
      responses:
        '201':
          description: Key created; body carries the secret once
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIKeyCreateResponse'
        default:
          $ref: '#/components/responses/Problem'
      security:
        - supabaseJwt: []
components:
  schemas:
    APIKeyCreateRequest:
      type: object
      additionalProperties: false
      properties:
        name:
          type: string
          maxLength: 128
    APIKeyCreateResponse:
      type: object
      required:
        - api_key
        - secret
      properties:
        api_key:
          $ref: '#/components/schemas/APIKey'
        secret:
          type: string
          description: Shown exactly once. Store it as a user-principal API key.
    APIKey:
      type: object
      required:
        - key_id
        - display_prefix
        - display_last4
        - created_at
      properties:
        key_id:
          type: string
        name:
          type: string
          maxLength: 128
        display_prefix:
          type: string
        display_last4:
          type: string
        created_at:
          type: string
          format: date-time
        revoked_at:
          type: string
          format: date-time
    Problem:
      type: object
      required:
        - type
        - title
        - status
        - code
      properties:
        type:
          type: string
        title:
          type: string
        status:
          type: integer
        code:
          type: string
        detail:
          type: string
  responses:
    Problem:
      description: RFC 9457 problem
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
  securitySchemes:
    personalApiKey:
      type: http
      scheme: bearer
      description: >-
        Personal byk_ API key; user-principal, resolved to a tenant by org
        context.
    supabaseJwt:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Supabase-issued session JWT; required for org, invite, and key
        management.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.