1. Clients

API key client

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

MethodDescription
GET /api/content/v1/apikeysRetrieves the API keys.
POST /api/content/v1/apikeysCreates 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:

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);
}
If you have suggestions for improving this article, let us know!