# Obtaining API Keys and Calling APIs

### Obtaining API Keys <a href="#toc164347053" id="toc164347053"></a>

{% hint style="warning" %}
Before applying for an API Key, it is required to configure an SMTP server to enable system-generated email notifications, including account creation alerts, password reset messages, system warnings, and API key requests.
{% endhint %}

1. Go to **Application Forms** > **API Key**, and click on the **Details** icon ![](https://content.gitbook.com/content/0choIC1BbdPOkKWOYGgk/blobs/Jg6aIzjS1YmE8cHlRTug/0.png) of the client to apply.

![](https://content.gitbook.com/content/0choIC1BbdPOkKWOYGgk/blobs/QJf3vJw5ZumMglnDc80K/1.png)

2. Enter the API Key list of that user and click **Apply** to enter the apply page.

![](https://content.gitbook.com/content/0choIC1BbdPOkKWOYGgk/blobs/IcSjJr11gxqGeW85vfMf/2.png)

3. Fill in the required fields.

![](https://content.gitbook.com/content/0choIC1BbdPOkKWOYGgk/blobs/tCxVi4Nn0cAMgobY1G0y/EN_6.1.3.png)

4. Enter the keyword to search in the **Select API** field, and select the API to apply.

![](https://content.gitbook.com/content/0choIC1BbdPOkKWOYGgk/blobs/85SNTA35rpeYsu0oNyXu/4.png)

5. Click **Save** to complete the application of the API Key.

![](https://content.gitbook.com/content/0choIC1BbdPOkKWOYGgk/blobs/atr5HT9e3pv0mZC52afv/5.png)

6. Go to **Application Forms** > **Applications**, locate the API Key application form to sign-off in the list of application forms.
7. Click on the **Submit for Review** icon, after the confirmation window pops up, click **Confirm** to complete the submission for review.

![](https://content.gitbook.com/content/0choIC1BbdPOkKWOYGgk/blobs/RvH5BQkwZXZhyW101vbj/6.png)

8. Click the **Pending order** tab to enter the pending order list, click on the **Sign-off** icon to enter the sign-off page, and click **Approve** to complete the first review.

![](https://content.gitbook.com/content/0choIC1BbdPOkKWOYGgk/blobs/H5tuDAjbkFqM6wDinzxT/7.png)

9. Click on the **Sign-off** icon to enter the sign-off page, and click  **Approve** to complete the second review to obtain the API Key.

![](https://content.gitbook.com/content/0choIC1BbdPOkKWOYGgk/blobs/DF9mPBhr7UkhkpxjwRqs/8.png)

10. Go to **System Information** > **API Key Approval History** to view the API Key applied today.

![](https://content.gitbook.com/content/0choIC1BbdPOkKWOYGgk/blobs/h29iSih1NoiqL8pTUP7h/9.png)

{% hint style="info" %}

* To verify whether emails have been sent, refer to [**Scheduled Tasks**](https://docs.tpi.dev/guide/system-information/scheduled-tasks).
* To review your email history, refer to the [**Mail Log**](https://docs.tpi.dev/guide/system-information/mail-log).
  {% endhint %}

### Calling APIs with the API Key <a href="#toc164347054" id="toc164347054"></a>

APIs registered in the system can use different OAuth Grant Type for verification, including: Client Credentials, Password, Basic, Auth and DGRK.

1. In the **Authorization** field, select **DGRK**.
2. In the **API Key** field, fill in the public key obtained from the email or database.
3. In the **Secret Key** field, fill in the private key obtained from the email or database.
4. Click **Test** to view the response. In this example, the status code is *200*, indicating that the body contains the data defined by the API.

![](https://content.gitbook.com/content/0choIC1BbdPOkKWOYGgk/blobs/Ilz7q1lA38AZNsih6up8/10.png)


---

# 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.tpi.dev/most-common-use-cases/obtaining-api-keys-and-calling-apis.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.
