GetOTP Documentation

Templates

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

Request for Templates API

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

https://api.otp.dev/v1/templates

With the following Basic HTTP verification method:

DescriptionRequiredData TypeExample
Your API KeyYesStringmtbi2w4hlendfpxa1igthcu5p6mzxf7k

Note

With the following parameters:

NameDescriptionRequiredData TypeExample
filter[status]Status of the templateNoStringCOMPLETED
filter[name]Filter(Starts With) Templates by NameNoStringMy Template
page_sizeThe number of templates to returnNoString10
page_tokenFound in pagination links and can be used to get 'previous' or 'next' itemsNoString

Note

Notes on the filter[status] parameter:

  • You can filter templates by status. Available statuses are: COMPLETED, IN_PROCESS, CANCELED.
  • Notes on the page_size parameter:

  • You can specify the number of templates to return. Defaults to 10, with a maximum of 1000.
  • Examples

    Below is an example request using cURL:

    curl --request GET \
        --url https://api.otp.dev/v1/templates \
        --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": "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"
            }
        ],
        "pagination": {
            "number": 0,
            "size": 0,
            "total": 0,
            "links": {
                "first": "string",
                "current": "string",
                "previous": "string",
                "next": "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
    pagination.numberCurrent page numberInteger1
    pagination.sizeRequested page sizeInteger10
    pagination.totalTotal items availableInteger11
    pagination.links.firstURL of the first pageString (URL)string
    pagination.links.currentURL of the current pageString (URL)string
    pagination.links.previousURL of the previous pageString (URL)string
    pagination.links.nextURL of the next pageString (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",
            "method": "GET",
            "status": 400,
            "message": "'filter[channel]' value should be: [SMS, VIBER, WHATSAPP]",
            "code": "1257"
        }]
    }

    Please refer to this table for details:

    Error CodeDescriptionHTTP Code
    1257'filter[channel]' value should be: [SMS, VIBER, WHATSAPP]400