> ## 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.

# Update an API key

> Updates the display name and spending controls of an API key. Only the fields you send are changed. The environment (`token_type`) cannot be changed. Returns 409 if the new name is already used by one of the owner's active keys. Requires the `manage:write` scope.



## OpenAPI

````yaml https://api.edenai.run/v2/info/splitted-schema/management_api/openapi.json patch /v3/manage/keys/{key_id}/
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/{key_id}/:
    patch:
      tags:
        - API Keys
      summary: Update an API key
      description: >-
        Updates the display name and spending controls of an API key. Only the
        fields you send are changed. The environment (`token_type`) cannot be
        changed. Returns 409 if the new name is already used by one of the
        owner's active keys. Requires the `manage:write` scope.
      operationId: manage_keys_partial_update
      parameters:
        - in: path
          name: key_id
          schema:
            type: string
            format: uuid
          required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchedManagementKeyUpdateRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/PatchedManagementKeyUpdateRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/PatchedManagementKeyUpdateRequest'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ManagementKey'
          description: ''
      security:
        - ManagementKeyAuth: []
components:
  schemas:
    PatchedManagementKeyUpdateRequest:
      type: object
      description: >-
        Editable API key fields: the display `name` and the spending controls.
        All fields are

        optional; only the fields you send are changed. The environment
        (`token_type`) cannot be changed:

        create a new key instead. Renaming to a name already used by one of the
        owner's active keys

        returns 409.
      properties:
        name:
          type: string
          minLength: 1
          description: The token name
          maxLength: 200
        active_balance:
          type: boolean
          description: Weither to use the balance field or not.
        balance:
          type: string
          format: decimal
          pattern: ^-?\d{0,5}(?:\.\d{0,9})?$
          nullable: true
          description: >-
            Optional remaining credits balance for this Token, if
            `active_balance` is set to True and the balance reaches 0, this
            token will become unusable
        balance_reset_amount:
          type: string
          format: decimal
          pattern: ^-?\d{0,5}(?:\.\d{0,9})?$
          nullable: true
          description: >-
            The amount this token's balance is reset to at the start of each
            balance_reset_period. Null when balance_reset_period is 'none'.
        balance_reset_period:
          allOf:
            - $ref: '#/components/schemas/BalanceResetPeriodEnum'
          description: >-
            How often this token's balance is reinitialized to
            balance_reset_amount. 'none' = one-time balance (default, current
            behaviour).


            * `none` - None

            * `daily` - Daily

            * `weekly` - Weekly

            * `monthly` - Monthly
    ManagementKey:
      type: object
      description: >-
        An API key belonging to the organization. The secret is never included:
        `masked` shows the

        key prefix and last characters for identification, and `id` is the
        stable identifier used in

        `/manage/keys/{key_id}` URLs.


        `balance` is the remaining spendable amount, including usage not yet
        settled, or null when the

        key has no spending cap. Revoked keys stay listed with `revoked: true`
        and a `revoked_at`

        timestamp. `id` is null for a legacy key that has not been regenerated
        yet; such a key is

        listed but cannot be addressed by URL until it is regenerated.
      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
      required:
        - balance
        - id
        - masked
        - member
        - name
        - revoked
    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.

````