# List templates

> Workspace templates, or one user’s templates, newest first.

<Endpoint method="GET" path="/v1/templates" />

<CodeTabs>

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

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

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

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

</CodeTabs>

## Query

<ParamTable params={[
  { name: "user", type: "usr_…", description: "List this user’s templates instead of the workspace’s." },
  { name: "tag", type: "string", description: "Only templates with this exact tag (case matters), up to 50 characters." },
  { name: "q", type: "string", description: "Only templates whose name or key contains this text, in any case. Up to 100 characters." },
  { name: "limit", type: "number", description: "1 to 100, default 20." },
  { name: "after", type: "tpl_…", description: "next_cursor from the previous page." }
]} />

Without `user`, the list has workspace templates only, never end users' designs. `tag`, `q` and `user` combine: every filter you send must match. `q` matches its text as typed, so `%` and `_` are plain characters.

## Examples

### List one end user's designs

Pass `user` to show a user the designs they made, for example on a "My designs" page in your app. Their templates carry `user`, and usually no key (`external_id` is `null`). `thumbnail_url` is `null` until the editor saves the template once.

<CodeTabs>

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

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

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

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

</CodeTabs>

### Find templates by tag or name

Send `tag` for templates you tagged, for example `holiday`, and `q` to narrow them by name or key. Here: holiday templates whose name or key has "card" in it.

<CodeTabs>

```bash tab="cURL"
curl -G https://api.muzekit.com/v1/templates \
  --data-urlencode "tag=holiday" \
  --data-urlencode "q=card" \
  -H "Authorization: Bearer $MUZEKIT_SECRET_KEY"
```

```javascript tab="Node"
const params = new URLSearchParams({ tag: "holiday", q: "card" });
const res = await fetch(`https://api.muzekit.com/v1/templates?${params}`, {
  headers: { Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}` },
});
const { data: cards } = await res.json();
```

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

cards = requests.get(
    "https://api.muzekit.com/v1/templates",
    params={"tag": "holiday", "q": "card"},
    headers={"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"},
).json()["data"]
```

</CodeTabs>

A tag is matched whole: `tag=holiday` doesn't find `holiday-2026`. Set tags with [Update a template](/docs/api-reference/templates-update).

### Page through every template

While `has_more` is `true`, send `next_cursor` as `after` to get the next page.

<CodeTabs>

```bash tab="cURL"
AFTER=""
while : ; do
  PAGE=$(curl -s "https://api.muzekit.com/v1/templates?limit=100&after=$AFTER" \
    -H "Authorization: Bearer $MUZEKIT_SECRET_KEY")
  echo "$PAGE" | jq -r '.data[] | "\(.id) \(.name)"'
  AFTER=$(echo "$PAGE" | jq -r '.next_cursor // empty')
  [ -z "$AFTER" ] && break
done
```

```javascript tab="Node"
const all = [];
let after = null;
do {
  const params = new URLSearchParams({ limit: "100" });
  if (after) params.set("after", after);
  const res = await fetch(`https://api.muzekit.com/v1/templates?${params}`, {
    headers: { Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}` },
  });
  const page = await res.json();
  all.push(...page.data);
  after = page.next_cursor;
} while (after);
```

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

templates, after = [], None
while True:
    params = {"limit": 100}
    if after:
        params["after"] = after
    page = requests.get(
        "https://api.muzekit.com/v1/templates",
        params=params,
        headers={"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"},
    ).json()
    templates += page["data"]
    after = page["next_cursor"]
    if not after:
        break
```

</CodeTabs>

## Response

```json
{
  "object": "list",
  "data": [
    {
      "object": "template",
      "id": "tpl_Vk1t4l9xvQv",
      "name": "Product card",
      "description": null,
      "tags": [],
      "external_id": "product-card",
      "user": null,
      "source": "api",
      "version": { "id": "ver_…", "number": 1, "revision": 1 },
      "width": 1080,
      "height": 1080,
      "page_count": 1,
      "thumbnail_url": "https://storage.muzekit.com/…/r1.png",
      "created_at": "…",
      "updated_at": "…"
    }
  ],
  "has_more": false,
  "next_cursor": null
}
```
