GetOTP Documentation

Template

The Template API provides a way to get your custom Template.

Request for Template API

To get your Template, make a GET request to our Template endpoint.

https://api.otp.dev/v1/templates/{template_id}

With the following Basic HTTP verification method:

DescriptionRequiredData TypeExample
Your API KeyYesStringmtbi2w4hlendfpxa1igthcu5p6mzxf7k

Note

With the following parameters:

NameDescriptionRequiredData TypeExample
template_idThe unique identifier of the templateYesString3fa85f64-5717-4562-b3fc-2c963f66afa6

Examples

Below is an example request using cURL:

curl --request GET \
     --url https://api.otp.dev/v1/templates/3fa85f64-5717-4562-b3fc-2c963f66afa6 \
     --header 'X-OTP-Key: {YOUR_API_KEY}' \
     --header 'accept: application/json'

The response would be a JSON structure, returned with HTTP 200 Codestatus code:

{
    "data": {
        "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "account_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "name": "My Template",
        "text": "Your code is {code}",
        "channel": "SMS",
        "status": "COMPLETED",
        "type": "text",
        "create_date": "2025-10-15T06:01:14.478Z",
        "update_date": "2025-10-15T06:01:14.478Z",
        "links": {
            "self": "string",
            "account": "string"
        }
    }
}

Response data details:

NameDescriptionData TypeExample
data.idThe unique identifier of the templateString (UUID)3fa85f64-5717-4562-b3fc-2c963f66afa6
data.account_idThe unique identifier of the accountString (UUID)3fa85f64-5717-4562-b3fc-2c963f66afa6
data.nameThe name of the templateStringMy Template
data.textThe text of the templateStringhttps://example.com
data.channelThe channel of the templateString1234567890
data.statusThe status of the templateStringDELIVERY
data.typeThe type of the templateStringMy Webhook
data.create_dateCreation date of the template in UTC, formatted as yyyy-mm-dd hh:mm:ssString (datetime)2025-09-24 07:09:20
data.update_dateUpdated date of the template in UTC, formatted as yyyy-mm-dd hh:mm:ssString (datetime)2025-09-24 07:09:20
data.links.selfURL of the templateString (URL)string
data.links.accountURL of the accountString (URL)string

If there is an error with the API call, you will receive a JSON response with 400+ status code, error code and message.

{
    "errors": [{
        "timestamp": "2025-08-18 00:00:00",
        "path": "/v1/templates/3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "method": "GET",
        "status": 404,
        "message": "Template not found",
        "code": "1251"
    }]
}

Please refer to this table for details:

Error CodeDescriptionHTTP Code
1251Template not found404