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

# Create an API key

> Creates a new API key for the organization, optionally attributed to a member and with spending controls. The response includes the key's `secret` exactly once; it cannot be retrieved afterwards. Returns 409 if the name is already used by one of the owner's active keys and 403 if the plan's key limit is reached. Requires the `manage:write` scope.



## OpenAPI

````yaml https://api.edenai.run/v2/info/splitted-schema/management_api/openapi.json post /v3/manage/keys/
openapi: 3.0.3
info:
  title: Organization Management
  version: '2.0'
  description: Your project description
servers:
  - url: https://api.edenai.run
security: []
paths:
  /v3/manage/keys/:
    post:
      tags:
        - API Keys
      summary: Create an API key
      description: >-
        Creates a new API key for the organization, optionally attributed to a
        member and with spending controls. The response includes the key's
        `secret` exactly once; it cannot be retrieved afterwards. Returns 409 if
        the name is already used by one of the owner's active keys and 403 if
        the plan's key limit is reached. Requires the `manage:write` scope.
      operationId: manage_keys_create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ManagementKeyCreateRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/ManagementKeyCreateRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/ManagementKeyCreateRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MintedManagementKey'
          description: ''
      security:
        - ManagementKeyAuth: []
components:
  schemas:
    ManagementKeyCreateRequest:
      type: object
      description: >-
        Settings for a new API key.


        `name` must be unique among the owner's active keys. `token_type`
        selects the production

        (`api_token`) or sandbox (`sandbox_api_token`) environment and cannot be
        changed later.

        `member` attributes the key to an organization member so their usage is
        reported per user;

        omit it to create a service key attributed to the organization itself.


        Spending controls are optional: `balance` with `active_balance` caps
        what the key can spend,

        `expire_time` sets a hard expiry (at least one day ahead), and
        `balance_reset_period` with

        `balance_reset_amount` refills the balance on a schedule. The same rules
        apply as when creating

        a key from the dashboard.
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 200
        token_type:
          allOf:
            - $ref: '#/components/schemas/ManagementKeyCreateTokenTypeEnum'
          default: api_token
        member:
          type: string
          format: email
          minLength: 1
        balance:
          type: string
          format: decimal
          pattern: ^-?\d{0,5}(?:\.\d{0,9})?$
        expire_time:
          type: string
          format: date-time
        active_balance:
          type: boolean
          default: true
        balance_reset_amount:
          type: string
          format: decimal
          pattern: ^-?\d{0,5}(?:\.\d{0,9})?$
        balance_reset_period:
          allOf:
            - $ref: '#/components/schemas/BalanceResetPeriodEnum'
          default: none
      required:
        - name
    MintedManagementKey:
      type: object
      description: >-
        A freshly created API key. Identical to the key resource plus `secret`,
        the full key value.

        The secret is shown only in this response and cannot be retrieved again;
        store it securely.
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
          nullable: true
        name:
          type: string
          description: The token name
          maxLength: 200
        token_type:
          $ref: '#/components/schemas/TokenTypeD53Enum'
        member:
          type: string
          format: email
          readOnly: true
        masked:
          type: string
          readOnly: true
        active_balance:
          type: boolean
          description: Weither to use the balance field or not.
        balance:
          type: number
          format: double
          maximum: 100000
          minimum: -100000
          exclusiveMaximum: true
          exclusiveMinimum: true
          nullable: true
          readOnly: true
        expire_time:
          type: string
          format: date-time
          nullable: true
        revoked:
          type: boolean
          readOnly: true
        revoked_at:
          type: string
          format: date-time
          nullable: true
        secret:
          type: string
          readOnly: true
      required:
        - balance
        - id
        - masked
        - member
        - name
        - revoked
        - secret
    ManagementKeyCreateTokenTypeEnum:
      enum:
        - api_token
        - sandbox_api_token
      type: string
      description: |-
        * `api_token` - api_token
        * `sandbox_api_token` - sandbox_api_token
    BalanceResetPeriodEnum:
      enum:
        - none
        - daily
        - weekly
        - monthly
      type: string
      description: |-
        * `none` - None
        * `daily` - Daily
        * `weekly` - Weekly
        * `monthly` - Monthly
    TokenTypeD53Enum:
      enum:
        - sandbox_api_token
        - api_token
      type: string
      description: |-
        * `sandbox_api_token` - Sandbox
        * `api_token` - Back
  securitySchemes:
    ManagementKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: opaque
      description: >-
        A management key (created from the organization dashboard or with `POST
        /v3/manage/auth-keys`), sent as `Authorization: Bearer
        <management_key>`. Inference API keys (`sk-eden...`) are not accepted on
        these endpoints.

````