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

# List Templates

> Retrieve a list of templates

## List

Retrieve a list of templates with pagination options using the default context.

```go theme={null}
func (s *TemplatesSvcImpl) List(options *ListOptions) (*ListTemplatesResponse, error)
```

### Parameters

<ParamField path="options" type="*ListOptions">
  Pagination options for the list request.
</ParamField>

### Returns

Returns a `*ListTemplatesResponse` containing the list of templates.

### Example

```go theme={null}
options := &resend.ListOptions{
  Limit: 10,
}

response, err := client.Templates.List(options)
if err != nil {
  panic(err)
}

for _, template := range response.Data {
  fmt.Println("Template:", template.Name, "Status:", template.Status)
}
```

***

## ListWithContext

Retrieve a list of templates with custom context and pagination options.

```go theme={null}
func (s *TemplatesSvcImpl) ListWithContext(ctx context.Context, options *ListOptions) (*ListTemplatesResponse, error)
```

### Parameters

<ParamField path="ctx" type="context.Context" required>
  Context for the request, useful for timeouts and cancellation.
</ParamField>

<ParamField path="options" type="*ListOptions">
  Pagination options for the list request.
</ParamField>

### Returns

Returns a `*ListTemplatesResponse` containing the list of templates.

### Example

```go theme={null}
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()

options := &resend.ListOptions{
  Limit: 20,
}

response, err := client.Templates.ListWithContext(ctx, options)
if err != nil {
  panic(err)
}

fmt.Println("Has more:", response.HasMore)
```

***

## Types

### ListTemplatesResponse

Response from listing templates.

```go theme={null}
type ListTemplatesResponse struct {
  Object  string              `json:"object"`
  Data    []*TemplateListItem `json:"data"`
  HasMore bool                `json:"has_more"`
}
```

<ResponseField name="Object" type="string">
  The object type, always "list".
</ResponseField>

<ResponseField name="Data" type="[]*TemplateListItem">
  Array of template items.
</ResponseField>

<ResponseField name="HasMore" type="bool">
  Indicates whether there are more templates available beyond the current page.
</ResponseField>

### TemplateListItem

Represents a template in a list response.

```go theme={null}
type TemplateListItem struct {
  Id          string  `json:"id"`
  Name        string  `json:"name"`
  Status      string  `json:"status"`
  PublishedAt *string `json:"published_at"`
  CreatedAt   string  `json:"created_at"`
  UpdatedAt   string  `json:"updated_at"`
  Alias       string  `json:"alias"`
}
```

<ResponseField name="Id" type="string">
  The unique identifier of the template.
</ResponseField>

<ResponseField name="Name" type="string">
  The name of the template.
</ResponseField>

<ResponseField name="Status" type="string">
  The status of the template (e.g., "draft", "published").
</ResponseField>

<ResponseField name="PublishedAt" type="*string">
  ISO 8601 timestamp of when the template was published. Null if not published.
</ResponseField>

<ResponseField name="CreatedAt" type="string">
  ISO 8601 timestamp of when the template was created.
</ResponseField>

<ResponseField name="UpdatedAt" type="string">
  ISO 8601 timestamp of when the template was last updated.
</ResponseField>

<ResponseField name="Alias" type="string">
  The unique alias of the template.
</ResponseField>
