# Publish Template

> Share a template through its public link and the gallery.

Requires an API key with the `write` scope.

**Publishing makes the template's subject and body readable by anyone who has its share link, immediately.** It appears in the public gallery list only after FoxReach approves it. Publishing a template again keeps its link, updates the listing and resets approval. [Unpublish](/api-reference/templates/unpublish-template) ends the sharing and invalidates the link.

Each publish is recorded as an `audit.template.published` event with the key as the actor.

## Path Parameters

<ParamField path="template_id" type="string" required>The template id.</ParamField>

## Body Parameters

<ParamField body="shareDescription" type="string" required>Gallery description, 1 to 1,000 characters.</ParamField>
<ParamField body="shareCategory" type="string" required>`cold_outreach`, `follow_up`, `intro` or `breakup`.</ParamField>

## Response

<ResponseField name="data" type="object">
  <Expandable title="data">
    <ResponseField name="shareSlug" type="string">The share slug.</ResponseField>
    <ResponseField name="shareUrl" type="string">The public page, `https://foxreach.io/gallery/{shareSlug}`.</ResponseField>
    <ResponseField name="galleryApproved" type="boolean">Always `false` right after publishing: the gallery list shows the template once it is approved.</ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
```bash cURL
curl -X POST "https://api.foxreach.io/api/v1/templates/tpl_abc123/publish" \
  -H "X-API-Key: otr_your_key" \
  -H "Content-Type: application/json" \
  -d '{"shareDescription": "A short first touch for founders", "shareCategory": "cold_outreach"}'
```

```python Python SDK
from foxreach import FoxReach

client = FoxReach(api_key="otr_your_key")
shared = client.templates.publish("tpl_abc123", share_description="A short first touch for founders", share_category="cold_outreach")
```

```typescript TypeScript SDK
import { FoxReach } from "foxreach";

const client = new FoxReach({ apiKey: "otr_your_key" });
const shared = await client.templates.publish("tpl_abc123", { shareDescription: "A short first touch for founders", shareCategory: "cold_outreach" });
```
</RequestExample>

<ResponseExample>
```json
{
  "data": {"shareSlug": "k3Jx9aQ2mZc", "shareUrl": "https://foxreach.io/gallery/k3Jx9aQ2mZc", "galleryApproved": false}
}
```
</ResponseExample>

## Errors

| Status | Description |
|--------|-------------|
| `401` | Missing, invalid, revoked or expired API key |
| `403` | API key does not have the required scope: `write` |
| `404` | `Template not found`: the template does not exist in this workspace |
| `422` | `shareDescription` is empty or over 1,000 characters, or `shareCategory` is not one of the four values |

## Rate Limit

- **120 requests per minute, shared by every `write` call in your workspace.** Fixed 60-second window.
- Every response includes `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset` (unix epoch seconds) and `X-RateLimit-Bucket` (`write`).
- A `429` response includes a `Retry-After` header (seconds until the bucket resets).

For client-side patterns, see [Rate Limiting](/rate-limiting).
