---
title: "API key client"
slug: "api-key-client"
abstract: "Overview of the methods available for retrieving, creating, updating, or deleting API keys."
---
# API key client

In Content Hub ONE, API keys are used to authenticate. The following methods are available.

| Method | Description |
| --- | --- |
| `GET /api/content/v1/apikeys` | Retrieves the API keys. |
| `POST /api/content/v1/apikeys` | Creates a new API key. |
| `PUT /api/content/v1/apikeys/<HASH>` | Updates the name of a specific API key. |
| `DELETE /api/content/v1/apikeys/<HASH>` | Deletes a specific API key. |

The following example illustrates these methods:

::::tabs
:::tab{title=".NET"}

```shell
public interface IApiKeyClient
{
  // GET /api/content/v1/apikeys
  Task<PagedResponse<HeadlessApiKey>> GetAsync(
    int? pageNumber = null,
    int? pageSize = null,
    CancellationToken cancellationToken = default);

  // POST /api/content/v1/apikeys
  Task<string> CreateAsync(
    string name,
    EdgeApiKeyType type,
    CancellationToken cancellationToken = default);

  // PUT /api/content/v1/apikeys/{hash}
  Task RenameAsync(
    string hash,
    string newName,
    CancellationToken cancellationToken = default);

  // DELETE /api/content/v1/apikeys/<hash>
  Task RevokeAsync(
    string hash,
    CancellationToken cancellationToken = default);
}
```

:::
:::tab{title="Javascript"}

```shell
export interface IApiKeyClient {
 /**
  * GET /api/content/v1/apikeys
  */
 createAsync(
  name: string,
  type: EdgeApiKeyType,
  cancelToken?: CancelToken
 ): Promise<string>;

 /**
  * POST /api/content/v1/apikeys
  */
 getAsync(
  pageNumber?: number,
  pageSize?: number,
  cancelToken?: CancelToken
 ): Promise<PagedResponse<EdgeApiKey>>;

 /**
  * PUT /api/content/v1/apikeys/<hash>
  */
 renameAsync(
  hash: string,
  newName: string,
  cancelToken?: CancelToken
 ): Promise<void>;

 /**
  * DELETE /api/content/v1/apikeys/<hash>
  */
 revokeAsync(hash: string, cancelToken?: CancelToken): Promise<void>;

 /**
  * Calls onto getAsync()
  */
 enumerate(
  pageSize?: number,
  cancelToken?: CancelToken
 ): Promise<Array<EdgeApiKey>>;
}
```

:::::::
