# List versions

> A template’s versions, newest first; one is current.

<Endpoint method="GET" path="/v1/templates/{id}/versions" />

<CodeTabs>

```bash tab="cURL"
curl https://api.muzekit.com/v1/templates/tpl_Vk1t4l9xvQv/versions \
  -H "Authorization: Bearer $MUZEKIT_SECRET_KEY"
```

```javascript tab="Node"
const res = await fetch(
  "https://api.muzekit.com/v1/templates/tpl_Vk1t4l9xvQv/versions",
  { headers: { Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}` } },
);
const { data: versions } = await res.json();
```

```python tab="Python"
import os
import requests

versions = requests.get(
    "https://api.muzekit.com/v1/templates/tpl_Vk1t4l9xvQv/versions",
    headers={"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"},
).json()["data"]
```

</CodeTabs>

`{id}` is the template's `tpl_…` id or its key. The list is ordered by `number`, highest first, 100 versions a page (`limit` sets fewer). When `has_more` is `true`, pass `next_cursor` as `after` for the next page.

The current version (`current: true`) is the one saves update in place; its `revision` goes up with each save. The others are history: versions your team named in the editor, the state at the end of an editing session, and the version that was current before a restore or a **Copy to Live**. A named copy gets a higher `number` than the current version, so find the current one by `current`, not by its place in the list.

[Get a version's document](/docs/api-reference/templates-version-document-get) reads any of them by `id` or `number`; [Get a document](/docs/api-reference/templates-document-get) always returns the current version. To restore an older one, use the version history in the editor.

## Examples

### Check whether a template changed

Store the current version's `id` and `revision` when you render or export. If either differs later, the template was saved or restored since.

<CodeTabs>

```bash tab="cURL"
curl -s https://api.muzekit.com/v1/templates/product-card/versions \
  -H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
  | jq '.data[] | select(.current) | { id, revision, updated_at }'
```

```javascript tab="Node"
const res = await fetch(
  "https://api.muzekit.com/v1/templates/product-card/versions",
  { headers: { Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}` } },
);
const current = (await res.json()).data.find((v) => v.current);

// saved is what you stored last time: { id, revision }
const changed = current.id !== saved.id || current.revision !== saved.revision;
```

```python tab="Python"
import os
import requests

data = requests.get(
    "https://api.muzekit.com/v1/templates/product-card/versions",
    headers={"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"},
).json()["data"]
current = next(v for v in data if v["current"])

# saved is what you stored last time: {"id": ..., "revision": ...}
changed = current["id"] != saved["id"] or current["revision"] != saved["revision"]
```

</CodeTabs>

A render records the revision it used too (`revision` on the [render](/docs/api-reference/renders-get)).

### List the named versions

Names mark the versions people meant to keep, like "Approved by client". Unnamed versions have `label: null`.

<CodeTabs>

```bash tab="cURL"
curl -s https://api.muzekit.com/v1/templates/product-card/versions \
  -H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
  | jq -r '.data[] | select(.label) | "\(.number)\t\(.label)\t\(.created_at)"'
```

```javascript tab="Node"
const res = await fetch(
  "https://api.muzekit.com/v1/templates/product-card/versions",
  { headers: { Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}` } },
);
const named = (await res.json()).data.filter((v) => v.label);
```

```python tab="Python"
import os
import requests

data = requests.get(
    "https://api.muzekit.com/v1/templates/product-card/versions",
    headers={"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"},
).json()["data"]
named = [v for v in data if v["label"]]
```

</CodeTabs>

## Response

```json
{
  "object": "list",
  "data": [
    {
      "object": "version",
      "id": "ver_Qa7mT2kWz9c",
      "number": 3,
      "label": "Approved by client",
      "revision": 1,
      "current": false,
      "page_count": 1,
      "width": 1080,
      "height": 1080,
      "created_at": "2026-11-20T14:02:11.384Z",
      "updated_at": "2026-11-20T14:02:11.384Z"
    },
    {
      "object": "version",
      "id": "ver_Lp0sQ7dXk2m",
      "number": 2,
      "label": null,
      "revision": 6,
      "current": true,
      "page_count": 1,
      "width": 1080,
      "height": 1080,
      "created_at": "2026-11-12T09:40:57.020Z",
      "updated_at": "2026-11-28T17:21:30.715Z"
    }
  ],
  "has_more": false,
  "next_cursor": null
}
```
