Manage API keys using the API

To use the Preview or Delivery API, you must have a valid API key, which you enter on the HEADERS tab in the GraphQL IDE. You can create, rename, or delete API keys using either the API or the Content Hub ONE app, if you have the necessary permissions.

Note

An API key is only valid for a specific tenant (app) within an organization.

Create an API key

Use this method to create an API key.

RequestResponsehttp
POST {Base URL}/content/v1/apikeys

Request

Note

Only lowercase API key type names are valid (that is, delivery and preview).

RequestResponsehttp
POST {Base URL}/content/v1/apikeys

Parameters

  • name is the name you define for the key.
  • type is the type of key. There are two types: delivery when you are generating an API key for a production environment or preview when you are generating a key for a staging or testing environment.

Response

RequestResponseshell
{
  apiKey: "AaBaCcDdEdFfGg=="
}

List the API keys

Use this method to list all the API keys.

RequestResponsehttp
GET api/content/v1/apikeys

Request

RequestResponsehttp
GET {Base URL}/content/v1/apikeys

A request to list API keys includes the following parameters:

  • pageNumber is the page number to return. The default is 1.
  • pageSize is the number of results to return per page. The default is 20. The maximum is 100.

Response

RequestResponseshell
{
  "totalCount": 2,
  "pageSize": 20,
  "pageNumber": 1,
  "data": [
    { 
      "name": "My Delivery Key",
      "type": "delivery",
      "hash": "R4ZkQ4emoyMzR5aEx3c0dCcTJnZEplcnVlbDV",
      "createdBy": "Administrator",
      "createdAt": "2022-04-25T12:11:32"
    },
    {
      "name": "My Preview Key",
      "type": "preview",
      "hash": "Ex3c0dCcTJnZEplcnVlbDVRbz18bXRzdC1kLTA",
      "createdBy": "John Johnson",
      "createdAt": "2022-03-29T02:11:02" 
    }
  ]
}

Rename an API key

Use this method to rename an API key. To do this, you need the hash. You can fetch the hash by retrieving a list of API keys.

RequestResponsehttp
PUT {Base URL}/content/v1/apikeys/{hash}

Request

RequestResponsehttp
PUT {Base URL}/content/v1/apikeys/{hash}

Parameters:

  • hash is the hash code.

Delete an API key

Use this method to delete a specific API key.

RequestResponsehttp
DELETE {Base URL}/content/v1/apikeys

Parameters:

  • pageNumber is the page number to return. The default is 1.
  • pageSize is the number of results to return per page. The default is 20. The maximum is 100.

Request

RequestResponsehttp
DELETE {Base URL}/content/v1/apikeys

Do you have some feedback for us?

If you have suggestions for improving this article,