> For the complete documentation index, see [llms.txt](https://docs.oneroute.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.oneroute.io/oneotp-api/oneotp-api/fetch-otp-templates.md).

# Fetch OTP Templates

## Fetch OTP Templates

<mark style="color:blue;">`GET`</mark> `https://api.oneroute.io/api/oneotp/templates`

With this endpoint, you can choose from a list of OTP templates and retrieve the ID of the template you wish to send to the customer.

#### Headers

| Name   | Type   | Description                 |
| ------ | ------ | --------------------------- |
| apikey | string | API key for Authentication. |

{% tabs %}
{% tab title="200 OneOTP Templates fetched successfully." %}

```
{
    "body": [
        {
            "id": "86681a74-ecdb-4492-9e75-93dadb9f8a29",
            "body": "Your {{firm}} OTP code is {{otp}}.",
            "name": "otp_template_simple",
            "namespace": "5000f34c_d9ab_4fd8_aa48_d9091f1d21ff",
            "data": [],
            "locale": "en",
            "policy": "DETERMINISTIC",
            "status": "approved",
            "type": "text",
            "scope": "oneOTP",
            "createdAt": "2021-10-02T14:00:29.937Z",
            "updatedAt": "2021-10-02T14:00:29.937Z",
            "firm_id": null
        },
        {
            "id": "ad90555b-46fa-433c-a350-9cc8911b4362",
            "body": "Your One Time Password (OTP) for {{firm}} is {{otp}}. Do not share your OTP with anyone.",
            "name": "otp_template",
            "namespace": "5000f34c_d9ab_4fd8_aa48_d9091f1d21ff",
            "data": [],
            "locale": "en_GB",
            "policy": "DETERMINISTIC",
            "status": "approved",
            "type": "text",
            "scope": "oneOTP",
            "createdAt": "2021-10-02T14:00:29.937Z",
            "updatedAt": "2021-10-02T14:00:29.937Z",
            "firm_id": null
        },
        {
            "id": "63d45b42-0898-43b3-b81d-1fb2d45bc78f",
            "body": "Your One Time Password (OTP) for {{firm}} is {{otp}}. Do not share your OTP with anyone. This code will expire in {{minutes}} minutes.",
            "name": "otp_template_expiry",
            "namespace": "5000f34c_d9ab_4fd8_aa48_d9091f1d21ff",
            "data": [],
            "locale": "en",
            "policy": "DETERMINISTIC",
            "status": "approved",
            "type": "text",
            "scope": "oneOTP",
            "createdAt": "2021-10-02T14:00:29.937Z",
            "updatedAt": "2021-10-02T14:00:29.937Z",
            "firm_id": null
        }
    ],
    "message": "OneOTP Templates fetched successfully",
    "success": true
}
```

{% endtab %}

{% tab title="401 " %}

```
{
    "data": null,
    "message": "Invalid API Key",
    "success": false
}
```

{% endtab %}
{% endtabs %}
