# Create a share link

> A link anyone can open to view a template, optionally ending after some days.

<Endpoint method="POST" path="/v1/templates/{id}/share" />

<CodeTabs>

```bash tab="cURL"
curl -X POST https://api.muzekit.com/v1/templates/tpl_G2l2bmhk8Pq/share \
  -H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "mode": "view", "days": 30 }'
```

```javascript tab="Node"
const res = await fetch(
  "https://api.muzekit.com/v1/templates/tpl_G2l2bmhk8Pq/share",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ mode: "view", days: 30 }),
  },
);
const share = await res.json(); // share.url, shown only now
```

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

share = requests.post(
    "https://api.muzekit.com/v1/templates/tpl_G2l2bmhk8Pq/share",
    headers={"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"},
    json={"mode": "view", "days": 30},
).json()
```

</CodeTabs>

`{id}` is the template's `tpl_…` id or its key: a workspace template or one of your users' designs.

## Body

<ParamTable params={[
  { name: "mode", type: "string", description: "view (the design only, the default) or play (its motion and video play too)." },
  { name: "days", type: "number", description: "The link ends after this many days, 1 to 365. Never when left out." }
]} />

The link works as one your users make in the editor (see [Share links](/docs/sharing)): anyone with it can look at the design but not change it, opening it doesn't count as a session, and it sends no webhooks. `url` is in this answer only; Muzekit keeps a hash of it, so store it if you need it again. A design keeps up to 20 live links; one more answers `409 too_many_links`. Your team can turn a link off from the editor's **Share** dialog. Making a link is recorded in the editor's audit log.

## Examples

### Send a client a design to approve

Make a link that ends after a week and put it in your own email or chat message.

<CodeTabs>

```bash tab="cURL"
URL=$(curl -s -X POST https://api.muzekit.com/v1/templates/tpl_G2l2bmhk8Pq/share \
  -H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "days": 7 }' | jq -r .url)
echo "Please review: $URL"
```

```javascript tab="Node"
const res = await fetch(
  "https://api.muzekit.com/v1/templates/tpl_G2l2bmhk8Pq/share",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ days: 7 }),
  },
);
const { url, expires_at } = await res.json();
await sendEmail(client, `Please review: ${url} (until ${expires_at})`);
```

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

share = requests.post(
    "https://api.muzekit.com/v1/templates/tpl_G2l2bmhk8Pq/share",
    headers={"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"},
    json={"days": 7},
).json()
send_email(client, f"Please review: {share['url']}")
```

</CodeTabs>

### Share a video design that plays

`play` lets the visitor play the design's motion, video and audio, for example to preview a video ad before you render it.

<CodeTabs>

```bash tab="cURL"
curl -X POST https://api.muzekit.com/v1/templates/promo-reel/share \
  -H "Authorization: Bearer $MUZEKIT_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "mode": "play" }'
```

```javascript tab="Node"
const res = await fetch("https://api.muzekit.com/v1/templates/promo-reel/share", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MUZEKIT_SECRET_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ mode: "play" }),
});
const { url } = await res.json();
```

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

url = requests.post(
    "https://api.muzekit.com/v1/templates/promo-reel/share",
    headers={"Authorization": f"Bearer {os.environ['MUZEKIT_SECRET_KEY']}"},
    json={"mode": "play"},
).json()["url"]
```

</CodeTabs>

## Response

`201` with the link.

```json
{
  "object": "share",
  "id": "shr_Tz4kQ9vLm2c",
  "template": "tpl_G2l2bmhk8Pq",
  "mode": "view",
  "url": "https://app.muzekit.com/s/9fJ2kLmQ4xTzR8vWb1nC6yHd3pS7eA0u",
  "expires_at": "2026-12-30T09:12:04.511Z",
  "created_at": "2026-11-30T09:12:04.511Z"
}
```
