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

# Delete User Api Key

> Delete a system API key created by the service.

This endpoint allows the automations service to clean up API keys
it previously created for users.

Args:
    user_id: The user ID
    org_id: The organization ID
    key_name: The name of the key to delete (without __SYSTEM__: prefix)
    x_service_api_key: Service API key header for authentication

Returns:
    dict: Success message

Raises:
    HTTPException: 401 if service key is invalid
    HTTPException: 404 if key not found



## OpenAPI

````yaml /openapi/openhands-cloud.json delete /api/service/users/{user_id}/orgs/{org_id}/api-keys/{key_name}
openapi: 3.1.0
info:
  title: OpenHands
  description: 'OpenHands: Code Less, Make More'
  version: 0.0.1
servers: []
security: []
paths:
  /api/service/users/{user_id}/orgs/{org_id}/api-keys/{key_name}:
    delete:
      tags:
        - Service
      summary: Delete User Api Key
      description: |-
        Delete a system API key created by the service.

        This endpoint allows the automations service to clean up API keys
        it previously created for users.

        Args:
            user_id: The user ID
            org_id: The organization ID
            key_name: The name of the key to delete (without __SYSTEM__: prefix)
            x_service_api_key: Service API key header for authentication

        Returns:
            dict: Success message

        Raises:
            HTTPException: 401 if service key is invalid
            HTTPException: 404 if key not found
      operationId: >-
        delete_user_api_key_api_service_users__user_id__orgs__org_id__api_keys__key_name__delete
      parameters:
        - name: user_id
          in: path
          required: true
          schema:
            type: string
            title: User Id
        - name: org_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Org Id
        - name: key_name
          in: path
          required: true
          schema:
            type: string
            title: Key Name
        - name: X-Service-API-Key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Service-Api-Key
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: >-
                  Response Delete User Api Key Api Service Users  User Id  Orgs 
                  Org Id  Api Keys  Key Name  Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````