Skip to content

Templates

APIs for discovering email templates available to your Lindris account.

As a reminder, all requests must be authenticated and use the base URL: https://api.lindris.com

List templates

GET api/templates

Retrieve a paginated list of email templates accessible to your account. Includes your own templates and published Lindris templates.

Note: each template's previewUrl opens an authenticated preview page in the dashboard. It requires a logged-in browser session — not the API key — so hand it to the end user to open rather than fetching it programmatically.

Query Parameters

  • page integer optional - Page number for pagination. Defaults to 1. Example: 2
  • perPage integer optional - Number of items per page. Defaults to 10, maximum 100. Example: 25

Request

bash
curl --request GET \
    --get "https://api.lindris.com/api/templates?page=2&perPage=25" \
    --header "Authorization: Bearer {YOUR_API_KEY}" \
    --header "Content-Type: application/json"
php
$client = new \GuzzleHttp\Client();
$url = 'https://api.lindris.com/api/templates';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_API_KEY}',
            'Content-Type' => 'application/json',
        ],
        'query' => [
            'page' => '2',
            'perPage' => '25',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
javascript
const url = new URL(
    "https://api.lindris.com/api/templates"
);

const params = {
    "page": "2",
    "perPage": "25",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_API_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Responses

json
{
   "data": [
      {
         "id": "01JQXYZ1234567890ABCDEFGH",
         "name": "Welcome Email",
         "description": "A welcome email template for new subscribers",
         "previewUrl": "/templates/01JQXYZ1234567890ABCDEFGH/preview",
         "createdAt": "2024-01-19T08:30:00+00:00"
      }
   ],
   "meta": {
      "currentPage": 1,
      "lastPage": 1,
      "from": 1,
      "to": 1,
      "total": 1,
      "perPage": 10,
      "path": "/api/templates"
   },
   "links": {
      "next": null,
      "prev": null,
      "first": "/api/templates?page=1",
      "last": "/api/templates?page=1"
   }
}
json
{
   "message": "Unauthenticated"
}