<@U04UQ68083H> How do I add API Key Authorization ...
# ory-copilot
q
@chilly-king-10285 How do I add API Key Authorization in Ory Kratos Self Hosted for Admin API ?
c
A message from kapa.ai
To add API Key Authorization in Ory Kratos Self Hosted for Admin API, you need to create an API Key in the Ory Console. Here are the steps to create an API Key: 1. Go to Project settingsAPI Keys in the [Ory Console](https://console.ory.sh/projects/current/developers). 2. Click Create new API key 3. Enter the API Key name and click Create 4. Copy the created API Key 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 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 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. You can 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:
Copy code
bash GET /admin/identities HTTP/1.1   Host: $<http://PROJECT_SLUG.projects.oryapis.com|PROJECT_SLUG.projects.oryapis.com>   Accept: application/json   Authorization: Bearer $API_KEY
For more information, you can refer to the [Ory documentation](https://www.ory.sh/docs/concepts/personal-access-token#authorizing-ory-network-project-admin-apis).
q
I can't use the Ory Console. I am not using Ory Network. Give me the steps for locally self hosted kratos server
d
@quaint-potato-13675 if you’re self hosting, then you need to decide how to protect the admin API. There is no built in functionality for this
q
Hello Micheal. Thanks for the reply. Is it possible to use Oathkeeper for this purpose ?
d
I’m not familiar with Oathkeeper, sorry. Apparently, yes: https://github.com/ory/kratos/discussions/3236
q
Perfect! This is what I was looking for