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

# Create Service Account Api Key

> Create a new API key for a service account



## OpenAPI

````yaml /api-reference/openapi.json post /v1/service-accounts/{service_account_user_id}/api-keys
openapi: 3.1.0
info:
  title: Threetone API Documentation
  description: >-
    This is the documentation for the Threetone API. You can use this API to use
    our service programmatically with API keys sent in the x-api-key header. You
    can create and manage API keys in the dashboard at
    https://threetone.in/app/developers/api-keys.
  version: '1.0'
servers:
  - url: https://api.threetone.in
    description: Production
security: []
paths:
  /v1/service-accounts/{service_account_user_id}/api-keys:
    post:
      tags:
        - workspace
      summary: Create Service Account Api Key
      description: Create a new API key for a service account
      operationId: create_service_account_api_key
      parameters:
        - name: service_account_user_id
          in: path
          required: true
          schema:
            type: string
            title: Service Account User Id
        - name: x-api-key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Your API key for programmatic access. Send it in the x-api-key
              header; you can create and manage keys from the Developers page.
            title: X-Api-Key
          description: >-
            Your API key for programmatic access. Send it in the x-api-key
            header; you can create and manage keys from the Developers page.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/Body_create_service_account_api_key_v1_service_accounts__service_account_user_id__api_keys_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkspaceCreateApiKeyResponseModel'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    Body_create_service_account_api_key_v1_service_accounts__service_account_user_id__api_keys_post:
      properties:
        name:
          type: string
          title: Name
        permissions:
          anyOf:
            - items:
                $ref: '#/components/schemas/PermissionType'
              type: array
            - type: string
              const: all
          title: Permissions
          description: The permissions of the X API key.
        credit_limit:
          anyOf:
            - type: integer
            - type: 'null'
          title: Credit Limit
          description: >-
            The credit limit of the API key per credit refresh period. If
            omitted, the key does not have its own credit cap.
        allowed_ips:
          anyOf:
            - items:
                type: string
              type: array
              maxItems: 100
              minItems: 1
            - type: 'null'
          title: Allowed Ips
          description: >-
            List of IP addresses or CIDR ranges allowed to use this API key.
            Each entry may be a CIDR range (e.g. '10.0.0.0/24') or a bare IP
            address (normalized to /32 or /128). Omit or pass null to allow all
            IPs.
        third_party_disable_allowed:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Third Party Disable Allowed
          description: >-
            Whether the holder of this key may disable it via the self-disable
            endpoint. On create, omit or pass null to use the workspace's
            default. Only honored for workspaces with self-disable access
            enabled.
      type: object
      required:
        - name
        - permissions
      title: >-
        Body_create_service_account_api_key_v1_service_accounts__service_account_user_id__api_keys_post
    WorkspaceCreateApiKeyResponseModel:
      properties:
        x-api-key:
          type: string
          title: X-Api-Key
        key_id:
          type: string
          title: Key Id
      type: object
      required:
        - x-api-key
        - key_id
      title: WorkspaceCreateApiKeyResponseModel
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    PermissionType:
      type: string
      enum:
        - models_read
        - voices_read
        - voices_write
        - workspace_read
        - workspace_write
        - convai_read
        - convai_write
        - create_user_api_key
        - workspace_analytics_full_read
        - webhooks_write
        - service_account_write
        - group_members_manage
        - workspace_members_read
        - workspace_members_invite
        - workspace_members_remove
        - terms_of_service_accept
        - audit_log_read
        - conversation_privacy_manage
        - copy_resources_cross_workspace
      title: PermissionType
      description: Public API-key permission universe supported by Threetone.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````