Authorization with API Keys
API Keys are used to authorize privileged operations. For example, you must use an API Key to call the Admin API, which allows you to delete users.
API Keys work only in the context of the Project for which they were created. You create API Keys in the Ory Console.
Creating API Keys
Follow these steps to create API Keys for your Project:
- Go to the Ory Console.
- Go to Access & APIs.
- Click the + icon in the API Keys section.
- Enter the API Key name and click Create API Key.
- Copy the created API Key from the prompt that shows at the bottom right of the screen.
The API Key you created is displayed only once. When you close the prompt, you can't access the key again. Make sure to save the API Key before you close the prompt or reload the page.
Usage
Use the API Key in API calls, SDK calls, or command-line interactions. Ory API Keys have a ory_apikey_
or ory_pat_
, which
makes it easy to identify them when analyzing code.
For example, when calling the Admin API at /admin/identities
, include the API Key in the Authorization
header:
GET /admin/identities HTTP/1.1
Host: {project.slug}.projects.oryapis.com
Accept: application/json
Authorization: Bearer {API-Key}