> For the complete documentation index, see [llms.txt](https://api.senderwiz.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api.senderwiz.com/customer/templates/search-templates.md).

# Search Templates

### 🔍 Search Templates

Use this endpoint to search templates by name or other attributes. This is useful for dynamically retrieving matching templates.

***

#### 🔹 HTTP Request

```http
GET API-URL/templates
```

***

#### 🧾 Query Parameters

| Parameter  | Type  | Default | Required | Description                                                       |
| ---------- | ----- | ------- | -------- | ----------------------------------------------------------------- |
| `page`     | int   | 1       | No       | Current page to retrieve.                                         |
| `per_page` | int   | 10      | No       | Number of items per page.                                         |
| `filters`  | array | —       | Yes      | Indexed array of template attributes to filter by (e.g., `name`). |

***

#### 🔐 Authorization Header

```
X-API-KEY: your-api-key-here
```

***

#### 💻 PHP Example

```php
// Search ALL ITEMS
$response = $endpoint->searchTemplates($pageNumber = 1, $perPage = 10, [
    'name' => 'summer_offer_template'
]);

// DISPLAY RESPONSE
echo '<pre>';
print_r($response->body);
echo '</pre>';
```

***

#### 📦 Sample JSON Response

```json
{
  "status": "success",
  "data": {
    "records": [
      {
        "name": "summer_offer_template",
        "content": "HTML content...",
        "screenshot": "https:\/\/demo.com\/frontend\/assets\/gallery\/tpl9847xyz123\/img_preview.png"
      }
    ]
  }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://api.senderwiz.com/customer/templates/search-templates.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.
