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

# Delete API Key

> Delete an API key from your organization

## Endpoint

```
POST https://api.ugc.inc/org/api-key/delete
```

## Overview

Permanently delete an API key from your organization. Once deleted, the API key can no longer be used to authenticate API requests. This action cannot be undone.

<Warning>
  Deleting an API key will immediately invalidate it. Any services using this key will lose access. Make sure to update any applications using this key before deletion.
</Warning>

## Request Body

<ParamField body="apiKeyId" type="string" required>
  ID of the API key to delete
</ParamField>

## Response

<ResponseField name="data" type="object">
  Response containing the deleted API key ID

  <Expandable title="Response properties">
    <ResponseField name="id" type="string">
      ID of the deleted API key
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.ugc.inc/org/api-key/delete \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "apiKeyId": "550e8400-e29b-41d4-a716-446655440000"
    }'
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://api.ugc.inc/org/api-key/delete',
      headers={
          'Authorization': 'Bearer YOUR_API_KEY',
          'Content-Type': 'application/json'
      },
      json={
          'apiKeyId': '550e8400-e29b-41d4-a716-446655440000'
      }
  )

  data = response.json()

  if data['ok']:
      print('API key deleted:', data['data']['id'])
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.ugc.inc/org/api-key/delete', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      apiKeyId: '550e8400-e29b-41d4-a716-446655440000'
    })
  });

  const data = await response.json();

  if (data.ok) {
    console.log('API key deleted:', data.data.id);
  }
  ```

  ```typescript React theme={null}
  import { UGCClient } from 'ugcinc';

  const client = new UGCClient({
    apiKey: 'YOUR_API_KEY'
  });

  const response = await client.org.deleteApiKey({
    apiKeyId: '550e8400-e29b-41d4-a716-446655440000'
  });

  if (response.ok) {
    console.log('Deleted API key ID:', response.data.id);
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Success Response theme={null}
  {
    "ok": true,
    "code": 200,
    "message": "Success",
    "data": {
      "id": "550e8400-e29b-41d4-a716-446655440000"
    }
  }
  ```

  ```json Error Response - Not Found theme={null}
  {
    "ok": false,
    "code": 404,
    "message": "API key not found"
  }
  ```

  ```json Error Response - Missing Parameter theme={null}
  {
    "ok": false,
    "code": 400,
    "message": "apiKeyId is required"
  }
  ```
</ResponseExample>
