> ## Documentation Index
> Fetch the complete documentation index at: https://docs.autosend.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Search Templates

> Search for email templates by name or other criteria using the AutoSend API.

```bash cURL theme={null}
curl --request GET \
  --url 'https://api.autosend.com/v1/templates/search?query=welcome&templateType=transactional&page=1&limit=10' \
  --header 'Authorization: Bearer <token>'
```

```python Python theme={null}
import requests

url = "https://api.autosend.com/v1/templates/search"

headers = {
    "Authorization": "Bearer <token>"
}

params = {
    "query": "welcome",
    "templateType": "transactional",
    "page": 1,
    "limit": 10
}

response = requests.get(url, headers=headers, params=params)
print(response.json())
```

```javascript JavaScript theme={null}
const params = new URLSearchParams({
  query: 'welcome',
  templateType: 'transactional',
  page: '1',
  limit: '10'
});

fetch(`https://api.autosend.com/v1/templates/search?${params}`, {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer <token>'
  }
})
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));
```

```php PHP theme={null}
<?php

$params = http_build_query([
    'query' => 'welcome',
    'templateType' => 'transactional',
    'page' => 1,
    'limit' => 10
]);

$url = "https://api.autosend.com/v1/templates/search?{$params}";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer <token>'
]);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>
```

```go Go theme={null}
package main

import (
    "fmt"
    "io"
    "net/http"
)

func main() {
    url := "https://api.autosend.com/v1/templates/search?query=welcome&templateType=transactional&page=1&limit=10"

    req, _ := http.NewRequest("GET", url, nil)
    req.Header.Set("Authorization", "Bearer <token>")

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        fmt.Println("Error:", err)
        return
    }
    defer resp.Body.Close()

    body, _ := io.ReadAll(resp.Body)
    fmt.Println(string(body))
}
```

```java Java theme={null}
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class SearchTemplates {
    public static void main(String[] args) {
        try {
            URL url = new URL("https://api.autosend.com/v1/templates/search?query=welcome&templateType=transactional&page=1&limit=10");
            HttpURLConnection con = (HttpURLConnection) url.openConnection();

            con.setRequestMethod("GET");
            con.setRequestProperty("Authorization", "Bearer <token>");

            BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuilder content = new StringBuilder();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            con.disconnect();

            System.out.println(content.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

```ruby Ruby theme={null}
require 'net/http'
require 'uri'

uri = URI('https://api.autosend.com/v1/templates/search?query=welcome&templateType=transactional&page=1&limit=10')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri)
request['Authorization'] = 'Bearer <token>'

response = http.request(request)
puts response.body
```

```json Response theme={null}
{
  "success": true,
  "data": {
    "templates": [
      {
        "templateId": "A-abc123def456ghi789jk",
        "templateName": "Welcome Email",
        "description": "Welcome email for new users",
        "subject": "Welcome to Our Platform!",
        "previewText": "We're glad to have you on board",
        "templateType": "transactional",
        "builderType": "code",
        "createdAt": "2026-01-15T10:30:00.000Z",
        "updatedAt": "2026-02-20T14:45:00.000Z"
      }
    ],
    "pagination": {
      "page": 1,
      "limit": 10,
      "total": 1,
      "pages": 1
    }
  }
}
```

### Authorizations

**Authorizations** `string | header` *required*

Bearer authentication header of the form Bearer `<token>`, where `<token>` is your auth token.

### Query Parameters

**query** `string`

Search query string. Searches across template name, subject, and template ID.

Example: `"welcome"`

**templateType** `string`

Filter templates by type.

Allowed values: `transactional`, `marketing`

Example: `"transactional"`

**templateName** `string`

Filter by exact template name.

Example: `"Welcome Email"`

**subject** `string`

Filter by subject line.

Example: `"Welcome"`

**templateId** `string`

Filter by template ID.

Example: `"A-abc123def456ghi789jk"`

**page** `integer`

Page number for pagination (starts at 1).

Minimum: `1`

Example: `1`

**limit** `integer`

Number of results per page.

Range: `1` - `100`

Example: `10`

**sortBy** `string`

Field to sort results by.

Default: `"createdAt"`

Example: `"createdAt"`

### Response

Templates search results

**success** `boolean`

Indicates if the request was successful

Example: `true`

**data** `object`

**child attributes**

**data.templates** `object[]`

Array of matching template objects

**child attributes**

**templateId** `string`

Unique template identifier

Example: `"A-abc123def456ghi789jk"`

**templateName** `string`

Name of the template

Example: `"Welcome Email"`

**description** `string`

Template description

Example: `"Welcome email for new users"`

**subject** `string`

Email subject line

Example: `"Welcome to Our Platform!"`

**previewText** `string`

Email preview text

Example: `"We're glad to have you on board"`

**templateType** `string`

Type of template

Example: `"transactional"`

**builderType** `string`

Builder type used

Example: `"code"`

**createdAt** `string`

ISO 8601 timestamp of creation

Example: `"2026-01-15T10:30:00.000Z"`

**updatedAt** `string`

ISO 8601 timestamp of last update

Example: `"2026-02-20T14:45:00.000Z"`

**data.pagination** `object`

Pagination metadata

**child attributes**

**pagination.page** `integer`

Current page number

Example: `1`

**pagination.limit** `integer`

Results per page

Example: `10`

**pagination.total** `integer`

Total number of matching templates

Example: `1`

**pagination.pages** `integer`

Total number of pages

Example: `1`


## OpenAPI

````yaml GET /templates/search
openapi: 3.1.0
info:
  title: AutoSend API
  description: AutoSend REST API for managing email templates
  version: 1.0.0
servers:
  - url: https://api.autosend.com/v1
security:
  - bearerAuth: []
paths:
  /templates/search:
    get:
      summary: Search Templates
      description: >-
        Search templates by name, subject, or template ID with pagination
        support.
components: {}

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.