> ## 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.

# Update Preview Text

> Update the preview text of an email template using the AutoSend API.

```bash cURL theme={null}
curl --request PATCH \
  --url https://api.autosend.com/v1/templates/A-abc123def456ghi789jk/preview-text \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "previewText": "Don'\''t miss out on our latest updates"
}'
```

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

url = "https://api.autosend.com/v1/templates/A-abc123def456ghi789jk/preview-text"

headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

payload = {
    "previewText": "Don't miss out on our latest updates"
}

response = requests.patch(url, json=payload, headers=headers)
print(response.json())
```

```javascript JavaScript theme={null}
fetch('https://api.autosend.com/v1/templates/A-abc123def456ghi789jk/preview-text', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    previewText: "Don't miss out on our latest updates"
  })
})
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));
```

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

$templateId = 'A-abc123def456ghi789jk';
$url = "https://api.autosend.com/v1/templates/{$templateId}/preview-text";

$data = [
    'previewText' => "Don't miss out on our latest updates"
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer <token>',
    'Content-Type: application/json'
]);

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

echo $response;
?>
```

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

import (
    "bytes"
    "encoding/json"
    "fmt"
    "net/http"
)

func main() {
    url := "https://api.autosend.com/v1/templates/A-abc123def456ghi789jk/preview-text"

    payload := map[string]string{
        "previewText": "Don't miss out on our latest updates",
    }

    jsonData, _ := json.Marshal(payload)

    req, _ := http.NewRequest("PATCH", url, bytes.NewBuffer(jsonData))
    req.Header.Set("Authorization", "Bearer <token>")
    req.Header.Set("Content-Type", "application/json")

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

    fmt.Println("Response Status:", resp.Status)
}
```

```java Java theme={null}
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;

public class UpdatePreviewText {
    public static void main(String[] args) {
        try {
            URL url = new URL("https://api.autosend.com/v1/templates/A-abc123def456ghi789jk/preview-text");
            HttpURLConnection con = (HttpURLConnection) url.openConnection();

            con.setRequestMethod("PATCH");
            con.setRequestProperty("Authorization", "Bearer <token>");
            con.setRequestProperty("Content-Type", "application/json");
            con.setDoOutput(true);

            String jsonInputString = "{\"previewText\": \"Don't miss out on our latest updates\"}";

            try (OutputStream os = con.getOutputStream()) {
                byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8);
                os.write(input, 0, input.length);
            }

            int status = con.getResponseCode();
            System.out.println("Response Status: " + status);

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
```

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

uri = URI('https://api.autosend.com/v1/templates/A-abc123def456ghi789jk/preview-text')

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

request = Net::HTTP::Patch.new(uri.path)
request['Authorization'] = 'Bearer <token>'
request['Content-Type'] = 'application/json'

request.body = {
  previewText: "Don't miss out on our latest updates"
}.to_json

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

```json Response theme={null}
{
  "success": true,
  "data": {
    "templateId": "A-abc123def456ghi789jk",
    "templateName": "Welcome Email",
    "description": "Welcome email for new users",
    "subject": "Welcome to Our Platform!",
    "previewText": "Don't miss out on our latest updates",
    "templateType": "transactional",
    "builderType": "code",
    "createdAt": "2026-01-15T10:30:00.000Z",
    "updatedAt": "2026-03-17T14:45:00.000Z"
  }
}
```

### Authorizations

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

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

### Path Parameters

**templateId** `string` *required*

The unique identifier of the template.

Example: `"A-abc123def456ghi789jk"`

### Body

**previewText** `string` *required*

Email preview text / preheader (max 140 characters). This text is automatically injected into the template HTML and shown in email clients before the email is opened.

Maximum length: `140`

Example: `"Don't miss out on our latest updates"`

### Response

Preview text updated successfully

**success** `boolean`

Indicates if the request was successful

Example: `true`

**data** `object`

The updated template object

**child attributes**

**data.templateId** `string`

Unique template identifier

Example: `"A-abc123def456ghi789jk"`

**data.templateName** `string`

Name of the template

Example: `"Welcome Email"`

**data.description** `string`

Template description.

**data.subject** `string`

Email subject line.

**data.previewText** `string`

Updated preview text

Example: `"Don't miss out on our latest updates"`

**data.templateType** `string`

Template type: `transactional` , `marketing` or `automations`.

**data.builderType** `string`

How the template was built: `code` or `visual`.

**data.createdAt** `string`

ISO 8601 timestamp of creation

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

**data.updatedAt** `string`

ISO 8601 timestamp of last update

Example: `"2026-03-17T14:45:00.000Z"`


## OpenAPI

````yaml PATCH /templates/{templateId}/preview-text
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/{templateId}/preview-text:
    patch:
      summary: Update Preview Text
      description: >-
        Updates only the preview text (preheader) of a template. The preview
        text is automatically injected into the template HTML.
components: {}

````

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