# API Authentication

In order to start using the Pyas API, you are required to create API keys.

To authenticate, you will need to pass your API key in the request headers as `x-api-key` .

Note: API Keys are app based. When generating API keys, you generate them for an app. whenever you use your API key, accounts you connect will be associated with the app that the API key belongs to.

## Generate API Keys

1. Login to your Pyas account.
2. Click on the Apps tab to open the Apps page.
3. Select the Pyas App that you want to generate API keys for. If you don't have any apps yet, click on the **+ New App** button to create a new one.
4. Click on the **Settings** tab.
5. Then, click on the **API Keys** tab

<figure><img src="/files/431l8bwSFTdpIN9E8Yoc" alt=""><figcaption></figcaption></figure>

6. Click on **Generate New API Key**
7. Add a name for your API key
8. Select an expiration for your API key
9. Select scopes
10. **Click Generate API Key**

<figure><img src="/files/6uKcUayebFqEI5vxXJmE" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/V5m7Im9fiwmIk1p3rUrl" alt=""><figcaption></figcaption></figure>

Your API Key is generated, and you can now use it to authenticate by passing it in the `x-api-key` request header.


---

# 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://docs.pyas.io/rest-api-reference/api-authentication.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.
