Skip to main content

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:

  1. Go to the Ory Console.
  2. Go to Access & APIs.
  3. Click the + icon in the API Keys section.
  4. Enter the API Key name and click Create API Key.
  5. Copy the created API Key from the prompt that shows at the bottom right of the screen.
caution

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.

API Keys are bound to an Ory Network project, and not to a specific user. This means that any user with access to the API Key can perform the operations that the API Key allows, even if they are no longer part of the project. Make sure to keep your API Keys secure and rotate them if necessary.

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}