# (2) Get active purpose

## Get active purpose

<mark style="color:blue;">`GET`</mark> `https://api.domain.com/api/services/app/ConsentPoints/GetActivePurposes`

#### Query Parameters

| Name           | Type    | Description                                                      |
| -------------- | ------- | ---------------------------------------------------------------- |
| consentPointId | string  | เลขที่ consent point ได้จากเจ้าหน้าที่ส่งให้ตามแต่ละ application |
| identifier     | string  | ข้อมูลที่ใช้แยกบุคคลแต่ละคน                                      |
| langCode       | boolean | รหัส ภาษา สามารถดู code ได้จากใน link                            |

#### Headers

| Name           | Type   | Description         |
| -------------- | ------ | ------------------- |
| Authentication | string | Bearer Token ของคุณ |

{% tabs %}
{% tab title="200 purposes คือ array ของวัตถุประสงค์ที่นำไปเสนอเพื่อขอความยินยอม
isRequireOtp หากมีค่าเป็น true การ submit consent จะ require otp จากผู้ให้ความยินยอม
otpType คือ (UserDefine = 0,  Email = 1, SMS = 2) โดยหากเป็น UserDefine ฝั่ง application อาจจะต้องมี option เพื่อให้ผู้ให้ความยินยอมเลือกว่าจะต้องการ otp ด้วยช่องทางไหน และเมื่อ submit consent ต้องระบุ otpType พร้อม ค่า email หรือเบอร์โทรมาด้วย" %}

```aspnet
{
  "result": {
    "purposes": [
      {
        "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "name": "string"
      }
    ],
    "isRequireOtp": true,
    "otpType": 0
  },
  "targetUrl": null,
  "success": true,
  "error": null,
  "unAuthorizedRequest": false,
  "__abp": true
}
```

{% endtab %}

{% tab title="404 Could not find a purpose matching this query." %}

```
[]
```

{% endtab %}
{% endtabs %}


---

# 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.reddot.co.th/consent-senario-get-purposes/get-purpose.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.
