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

# Share an API key

> Shares the key with people by email, so they can reveal and use it. Only
the key's owner (or a manager of the owning team) can share. Emails
with no varg account are returned in `not_found` and nothing is shared
with them. A key can be shared with at most 50 people. Rate limited
per user. Requires an app session (Supabase JWT), not an API key.




## OpenAPI

````yaml /openapi.yaml post /api-keys/{id}/shares
openapi: 3.1.0
info:
  title: varg API
  version: 2.0.0
  description: |
    Unified REST API for AI media generation at `api.varg.ai/v2`.

    One API key, ~80 models across 8 providers, async jobs, stable output URLs
    on `s3.varg.ai`, files with lineage, and transparent credit billing
    (1 credit = 1 cent = $0.01).

    **The async job pattern:** every generation request returns `202 Accepted`
    with a job object (`status: queued`). Poll `GET /jobs/{id}` until the job
    reaches a terminal status (`completed`, `failed`, or `cancelled`), then read
    `output.outputs[0].url`. Alternatively, set `options.webhook_url` in the
    request to receive an HMAC-signed callback when the job finishes.
servers:
  - url: https://api.varg.ai/v2
security:
  - bearerAuth: []
tags:
  - name: Generation
    description: >-
      Create generation jobs (image, video, speech, music, transcription,
      ffmpeg, render, pipeline)
  - name: Tools
    description: Discover tools, their schemas, and call any tool generically
  - name: Jobs
    description: Poll and manage job lifecycle
  - name: Files
    description: Upload, import, probe, and manage files
  - name: Folders
    description: Group files into folders and file generated output automatically
  - name: Lineage
    description: Resolve which job produced a file
  - name: Presets
    description: Browse and apply reusable parameter values — voices, styles
  - name: Templates
    description: Browse, publish, use and render community templates
  - name: Pricing
    description: Estimate costs and browse the price catalog
  - name: Billing
    description: Balance, usage, and transaction history
  - name: Analytics
    description: >-
      Spend, runs and files over time — summaries, time series, breakdowns,
      activity
  - name: Account
    description: Identity and API key management
paths:
  /api-keys/{id}/shares:
    post:
      tags:
        - Account
      summary: Share an API key
      description: |
        Shares the key with people by email, so they can reveal and use it. Only
        the key's owner (or a manager of the owning team) can share. Emails
        with no varg account are returned in `not_found` and nothing is shared
        with them. A key can be shared with at most 50 people. Rate limited
        per user. Requires an app session (Supabase JWT), not an API key.
      operationId: shareApiKey
      parameters:
        - name: id
          in: path
          required: true
          description: API key id
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApiKeyShareRequest'
            examples:
              share:
                value:
                  emails:
                    - teammate@example.com
      responses:
        '200':
          description: Updated shares, plus emails that could not be shared
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ApiKeyShares'
                  - type: object
                    required:
                      - not_found
                    properties:
                      not_found:
                        type: array
                        description: Emails with no varg account
                        items:
                          type: string
                          format: email
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          description: >-
            Only app sessions can manage API keys (API keys and connected
            applications are rejected)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Unknown API key, or you have no access to it
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: >-
            Invalid body, or the key is already shared with the maximum number
            of people (`share_limit_reached`)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Too many share requests
          headers:
            Retry-After:
              schema:
                type: string
            X-RateLimit-Remaining:
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    ApiKeyShareRequest:
      type: object
      required:
        - emails
      properties:
        emails:
          type: array
          minItems: 1
          maxItems: 20
          items:
            type: string
            format: email
            maxLength: 254
    ApiKeyShares:
      type: object
      properties:
        owner:
          oneOf:
            - $ref: '#/components/schemas/ApiKeyPerson'
            - type: 'null'
        shares:
          type: array
          items:
            $ref: '#/components/schemas/ApiKeyShare'
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: model_not_found
            message:
              type: string
              example: 'Unknown model: flux-shnell'
            details: {}
    ApiKeyPerson:
      type: object
      properties:
        user_id:
          type: string
          format: uuid
        email:
          type:
            - string
            - 'null'
        display_name:
          type:
            - string
            - 'null'
        avatar_url:
          type:
            - string
            - 'null'
    ApiKeyShare:
      allOf:
        - $ref: '#/components/schemas/ApiKeyPerson'
        - type: object
          properties:
            shared_at:
              type: string
              format: date-time
  responses:
    Unauthorized:
      description: Missing or invalid API key / JWT
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            unauthorized:
              value:
                error:
                  code: unauthorized
                  message: Invalid or missing API key or JWT
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: |
        varg API key (`varg_...`). Get one at [app.varg.ai](https://app.varg.ai)
        or run `bunx vargai login`. App sessions may alternatively send a
        Supabase JWT.

````

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