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

# Delete API key

> Delete an API Key.

export const Legacy = ({title, href}) => {
  return <Note>

    This page documents an earlier version of the API client.
    For the latest version, see <a href={href}>{title}</a>.

    </Note>;
};

<Legacy title="Delete an API key" href="/doc/libraries/sdk/methods/search/delete-api-key" />

**Required ACL:** `Admin`

**Be careful** not to accidentally revoke a user's access to the Dashboard
by deleting any key that grants such access.
More generally: always be aware of a key's permissions before deleting it,
to avoid any unexpected consequences.

## Examples

To delete an existing key:

<CodeGroup>
  ```cs C# theme={"system"}
  client.DeleteApiKey("YourAPIKey");

  // Asynchronous
  await client.DeleteApiKeyAsync("YourAPIKey");
  ```

  ```go Go theme={"system"}
  res, err := client.DeleteAPIKey("YourAPIKey")
  ```

  ```java Java theme={"system"}
  client.deleteApiKey("YourAPIKey");

  // Asynchronous
  client.deleteApiKeyAsync("YourAPIKey");
  ```

  ```js JavaScript theme={"system"}
  client.deleteApiKey('YourAPIKey').then(() => {
    // done
  });
  ```

  ```kotlin Kotlin theme={"system"}
  client.deleteAPIKey(APIKey("YourAPIKey"))
  ```

  ```php PHP theme={"system"}
  $res = $client->deleteApiKey('YourAPIKey');
  ```

  ```python Python theme={"system"}
  print(client.delete_api_key('YourAPIKey'))
  ```

  ```ruby Ruby theme={"system"}
  client.delete_api_key('YourAPIKey')
  ```

  ```scala Scala theme={"system"}
  client.execute {
      delete key "YourAPIKey"
  }
  ```

  ```swift Swift theme={"system"}
  client.deleteAPIKey("YourAPIKey") { result in
    if case .success(let response) = result {
    }
  }
  ```
</CodeGroup>

## Parameters

<ParamField body="apiKey" type="string" required>
  API key to delete
</ParamField>

## Response

<ResponseField name="deletedAt" type="string">
  The date at which the key was deleted.
</ResponseField>

### Response as JSON

This section shows the JSON response returned by the API.
Each API client wraps this response in language-specific objects, so the structure may vary.
To view the response, use the `getLogs` method.
Don't rely on the order of properties—JSON objects don't preserve key order.

```jsonc JSON icon=braces theme={"system"}
{
  "deletedAt": "2017-12-16T22:21:31.871Z"
}
```
