# App-Specific API Keys

App-specific API Keys are used to authorize your Clarifai applications. A key is automatically generated when you create a new application. You can also go to the [Application's List](https://portal.clarifai.com/apps), select an app of your choice and create a new key in the app details page. *Each API key is tied to a specific user and a specific app.*

You have fine-grained control over the data exposed through your app. You can control the scope of an API Key through a simple checkbox interface when you first set up your app.

## Create an API Key in Portal

Just navigate to the app management page and click "Create an API Key"

![](/files/Ps8gDpUEbCDVApdiJmY5)

## Create an API Key programmatically

For enterprise customers, it is also possible to generate applications and keys programmatically. If you are managing the work of multiple users who's data, models, and concepts need to be segregated, we recommend you create apps and a keys this way. This ensures that each individual user only has access to their own private resources.

{% tabs %}
{% tab title="cURL" %}

```
curl --location --request POST 'https://api.clarifai.com/v2/users/{{user_id}}/keys' \
--header 'Content-Type: application/json' \
--header 'X-Clarifai-Session-Token: {{session_token}}' \
--data-raw '{
    "keys": [
        {
            "description": "All permissions",
            "scopes": [
                "All"
            ],
            "apps": [
                {
                    "id": "{{app_id}}",
                    "user_id": "{{user_id}}"
                }
            ]
        }
    ]
}'
```

{% endtab %}
{% endtabs %}

API Keys do not expire. In case your API Key gets compromised, you should delete that key, and create a new one with the same scopes. We recommend that you do **not** share your API Key with other users.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://old-docs.clarifai.com/guide/clarifai-basics/authentication/app-specific-api-keys.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
