API Keys

Grafbase provides API keys to authenticate access to a specific project environment: Preview or Production. A pair is created upon project creation.

Beware, API keys do not have an expiration date, nor do they provide any fined-grained authorization. If you need either, take a look at Authorization.

You can see your existing API keys, create a new API key, rename an existing API key, or delete an API key in the API Keys section of the Settings tab in a project's dashboard.

To use them, you need to pass them in the HTTP headers of your request:

x-api-key: API_KEY

To list your API keys:

  1. Navigate to the API Keys section of the Settings tab in the project's dashboard. You'll see your keys listed, with their name, environment, hidden value, and date created.
  2. To see a key value, select Reveal. Once the value is revealed, select Copy to copy the value to your clipboard.

You must be a project owner, or member of the owning account if the owner is an organization, to create an API key.

To create an API key:

  1. Navigate to the API Keys section of the Settings tab in the project's dashboard.
  2. Select Create API Key.
  3. Select either the Preview or Production environment.
  4. Enter a name for the key.
  5. Select Create. Note the key value as you'll need that to make API calls.

Note that you can have a maximum of 10 API keys per project.

To rename an API key:

  1. Navigate to the API Keys section of the Settings tab in the project's dashboard. You'll see your keys listed, with their name, environment, hidden value, and date created.
  2. Select the context menu (the three dots to the right of the key's created time).
  3. Select Edit.
  4. Enter a new value in the Name field. Note that despite the Environment field, you cannot reassign the key to the other environment.

To delete an API key:

  1. Navigate to the API Keys section of the Settings tab in the project's dashboard. You'll see your keys listed, with their name, environment, hidden value, and date created.
  2. Select the context menu (the three dots to the right of the key's created time).
  3. If there is more than one API key in the environment, you should see a Delete option. Select Delete to delete the key.

Note that you cannot delete every API key for either the Preview or Production environments; there must be at least one API key for each environment to be able to call APIs in that environment.

Was this page helpful?