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:
- 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.
- 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:
- Navigate to the API Keys section of the Settings tab in the project's dashboard.
- Select Create API Key.
- Select either the Preview or Production environment.
- Enter a name for the key.
- 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:
- 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.
- Select the context menu (the three dots to the right of the key's created time).
- Select Edit.
- 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:
- 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.
- Select the context menu (the three dots to the right of the key's created time).
- 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.