# List a template's versions (/docs/api-reference/email-templates/list-email-template-versions)

Published versions, newest first. Pass the last `version` as `after` to get the next page while `has_more` is true.

`GET https://api.coss.com/v1/email_templates/{id}/versions`

Authenticate with your API key as a bearer token (`Authorization: Bearer coss_test_…`). Responses are JSON with snake_case fields; errors are `{ error: { type, code, message, param?, issues?, request_id } }` (https://coss.com/docs/api-reference/errors.md).

## Path parameters

- `id` (string, required): The template's id or alias.

## Query parameters

- `limit` (integer, 1-20): 1-20, default 10.
- `after` (integer, at least 1): Cursor: the `version` of the last version of the previous page.

## Example request

TypeScript (the `coss` package):

```ts
import { Coss } from "coss";

const coss = new Coss({
  apiKey: process.env.COSS_API_KEY,
  baseUrl: "https://api.coss.com",
});

const { data, error } = await coss.email.templates.versions.list("etpl_01k7c8m4q2f3e9v6t5r1n0p8yz");
```

HTTP:

```sh
curl -X GET "https://api.coss.com/v1/email_templates/etpl_01k7c8m4q2f3e9v6t5r1n0p8yz/versions" \
  -H "Authorization: Bearer $COSS_API_KEY"
```

Python:

```python
from coss import Coss

client = Coss()  # api_key= or COSS_API_KEY

client.email.templates.versions.list(
    id="etpl_01k7c8m4q2f3e9v6t5r1n0p8yz",
)
```

Go:

```go
import (
	"context"

	cossclient "github.com/cosscom/coss-go/client"
	templates "github.com/cosscom/coss-go/email/templates"
)

client := cossclient.NewClient() // option.WithAPIKey(…) or COSS_API_KEY

request := &templates.ListVersionsRequest{
    ID: "etpl_01k7c8m4q2f3e9v6t5r1n0p8yz",
}
client.Email.Templates.Versions.List(
    context.TODO(),
    request,
)
```

Ruby:

```ruby
require "coss"

client = Coss::Client.new # api_key: or COSS_API_KEY

client.email.templates.versions.list(id: "etpl_01k7c8m4q2f3e9v6t5r1n0p8yz")
```

PHP:

```php
<?php

use Coss\Coss;
use Coss\Email\Templates\Versions\Requests\ListVersionsRequest;

$client = new Coss(); // apiKey: or COSS_API_KEY

$client->email->templates->versions->list(
    'etpl_01k7c8m4q2f3e9v6t5r1n0p8yz',
    new ListVersionsRequest([]),
);
```

Java:

```java
import com.coss.Coss;
import com.coss.resources.email.templates.versions.requests.ListVersionsRequest;

Coss client = Coss.builder().build(); // .apiKey(…) or COSS_API_KEY

client.email().templates().versions().list(
    "etpl_01k7c8m4q2f3e9v6t5r1n0p8yz",
    ListVersionsRequest
        .builder()
        .build()
);
```

.NET:

```csharp
using Coss;
using Coss.Email.Templates;

var client = new CossClient(); // apiKey: or COSS_API_KEY

await client.Email.Templates.Versions.ListAsync(
    new ListVersionsRequest { Id = "etpl_01k7c8m4q2f3e9v6t5r1n0p8yz" }
);
```

## Response 200

A page of versions.

- `object` ("list", required)
- `data` (object[], required)
  - `object` ("email_template_version", required)
  - `template_id` (string, required): The template's id.
  - `version` (integer | null, required): The version number; `null` for the draft.
  - `revision` (integer, required): Counts the draft's saves. A published version keeps the revision it was published from.
  - `default_locale` (string, required): The locale sends fall back to when they ask for none, or for one without content.
  - `variables` (object[], required): The variables the template uses, with their types.
    - `name` (string, required): Used in the template as `{{name}}`.
    - `type` ("string" | "number" | "boolean" | "list", required): `string`, `number`, `boolean`, or `list` (an array of objects with the declared `fields`).
    - `required` (boolean, required): Whether sends must pass it, unless it has a `default`.
    - `default` (string | number | boolean): Used when a send leaves it out.
    - `description` (string): What it's for, shown in the dashboard.
    - `fields` (object[]): A list's item fields.
      - `name` (string, required): Used inside `{{#each}}` as `{{name}}`.
      - `type` ("string" | "number" | "boolean", required): The field's type.
      - `required` (boolean, required): Whether each item must have it.
  - `sample_variables` (map of any, required): Example values for previews and test sends in the dashboard.
  - `contents` (object[], required): The subject, HTML and text per locale.
    - `locale` (string, required): The BCP 47 language tag this content is for.
    - `subject` (string, required): The subject template.
    - `html` (string | null, required): The HTML template. `null`: text only.
    - `text` (string | null, required): The plain-text template. `null`: HTML only.
  - `problems` (object[], required): Syntax errors and undeclared variables per locale and field, which keep a draft from being published. Always empty for published versions.
    - `locale` (string, required): The locale whose content it's in.
    - `field` ("subject" | "html" | "text", required): The part of the content it's in.
    - `message` (string, required): What's wrong.
    - `line` (integer, required): The line it's on, from 1.
    - `column` (integer, required): The column it's at, from 1.
  - `published_at` (string | null, required, date-time): When this version was published. `null` for the draft.
  - `created_at` (string, required, date-time)
  - `updated_at` (string, required, date-time)
- `has_more` (boolean, required)

Example:

```json
{
  "object": "list",
  "data": [
    {
      "object": "email_template_version",
      "template_id": "etpl_01k7c8m4q2f3e9v6t5r1n0p8yz",
      "version": 2,
      "revision": 3,
      "default_locale": "en",
      "variables": [
        {
          "name": "first_name",
          "type": "string",
          "required": true
        }
      ],
      "sample_variables": {
        "first_name": "Ada"
      },
      "contents": [
        {
          "locale": "en",
          "subject": "Welcome, {{first_name}}",
          "html": "<p>Hi {{first_name}}, thanks for signing up!</p>",
          "text": null
        }
      ],
      "problems": [],
      "published_at": "2026-10-10T12:00:00.000Z",
      "created_at": "2026-10-10T12:00:00.000Z",
      "updated_at": "2026-10-10T12:00:00.000Z"
    }
  ],
  "has_more": false
}
```

## Errors

- `400`: The `Coss-Version` header names an unknown API version (`invalid_api_version`).
- `401`: The API key is missing, invalid, revoked or expired (`authentication_error`).
- `403`: The API key lacks the permission this endpoint needs (`permission_error`), or its organization is suspended (`organization_suspended`).
- `404`: No template with this id or alias exists in the API key's environment (`not_found`).
- `422`: A query parameter failed validation (`validation_error`, see `issues`).
- `429`: Too many requests with this API key (`rate_limited`), or too many requests with invalid keys from this address (`too_many_failed_authentications`). Retry after `Retry-After` seconds. Successful responses carry `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset` (seconds until the limit is fully restored).
- `500`: Unexpected server error (`api_error` / `internal_error`).
- `503`: The API key could not be verified right now; retry (`service_unavailable`).