# Publish Template

POST

/

templates

/

:template\_id

/

publish

:::code-group
```typescript title="Node.js"
import { Resend } from 'resend';

const resend = new Resend('re_xxxxxxxxx');

const { data, error } = await resend.templates.publish(
  '34a080c9-b17d-4187-ad80-5af20266e535',
);
```

```php title="PHP"
$resend = Resend::client('re_xxxxxxxxx');

$resend->templates->publish('34a080c9-b17d-4187-ad80-5af20266e535');
```

```python title="Python"
import resend

resend.api_key = "re_xxxxxxxxx"

resend.Templates.publish("34a080c9-b17d-4187-ad80-5af20266e535")
```

```ruby title="Ruby"
require "resend"

Resend.api_key = "re_xxxxxxxxx"

Resend::Templates.publish("34a080c9-b17d-4187-ad80-5af20266e535")
```

```go title="Go"
package main

import (
	"context"

	"github.com/resend/resend-go/v4"
)

func main() {
	client := resend.NewClient("re_xxxxxxxxx")

	client.Templates.PublishWithContext(
		context.TODO(),
		"34a080c9-b17d-4187-ad80-5af20266e535",
	)
}
```

```rust title="Rust"
use resend_rs::{Resend, Result};

#[tokio::main]
async fn main() -> Result<()> {
  let resend = Resend::new("re_xxxxxxxxx");

  let _published = resend
    .templates
    .publish("34a080c9-b17d-4187-ad80-5af20266e535")
    .await?;

  Ok(())
}
```

```java title="Java"
import com.resend.Resend;
import com.resend.core.exception.ResendException;
import com.resend.services.templates.model.PublishTemplateResponseSuccess;

public class Main {
    public static void main(String[] args) throws ResendException {
        Resend resend = new Resend("re_xxxxxxxxx");

        PublishTemplateResponseSuccess data = resend.templates().publish("34a080c9-b17d-4187-ad80-5af20266e535");
    }
}
```

```csharp title=".NET"
using Resend;

IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI

await resend.TemplatePublishAsync( new Guid( "34a080c9-b17d-4187-ad80-5af20266e535" ) );
```

```shellscript title="cURL"
curl -X POST 'https://api.resend.com/templates/34a080c9-b17d-4187-ad80-5af20266e535/publish' \
     -H 'Authorization: Bearer re_xxxxxxxxx' \
     -H 'Content-Type: application/json'
```

```shellscript title="CLI"
resend templates publish 34a080c9-b17d-4187-ad80-5af20266e535
```
:::

:::code-group
```json title="Response"
{
  "object": "template",
  "id": "34a080c9-b17d-4187-ad80-5af20266e535"
}
```
:::

## Path Parameters

string

The ID or alias of the template to publish.

:::code-group
```typescript title="Node.js"
import { Resend } from 'resend';

const resend = new Resend('re_xxxxxxxxx');

const { data, error } = await resend.templates.publish(
  '34a080c9-b17d-4187-ad80-5af20266e535',
);
```

```php title="PHP"
$resend = Resend::client('re_xxxxxxxxx');

$resend->templates->publish('34a080c9-b17d-4187-ad80-5af20266e535');
```

```python title="Python"
import resend

resend.api_key = "re_xxxxxxxxx"

resend.Templates.publish("34a080c9-b17d-4187-ad80-5af20266e535")
```

```ruby title="Ruby"
require "resend"

Resend.api_key = "re_xxxxxxxxx"

Resend::Templates.publish("34a080c9-b17d-4187-ad80-5af20266e535")
```

```go title="Go"
package main

import (
	"context"

	"github.com/resend/resend-go/v4"
)

func main() {
	client := resend.NewClient("re_xxxxxxxxx")

	client.Templates.PublishWithContext(
		context.TODO(),
		"34a080c9-b17d-4187-ad80-5af20266e535",
	)
}
```

```rust title="Rust"
use resend_rs::{Resend, Result};

#[tokio::main]
async fn main() -> Result<()> {
  let resend = Resend::new("re_xxxxxxxxx");

  let _published = resend
    .templates
    .publish("34a080c9-b17d-4187-ad80-5af20266e535")
    .await?;

  Ok(())
}
```

```java title="Java"
import com.resend.Resend;
import com.resend.core.exception.ResendException;
import com.resend.services.templates.model.PublishTemplateResponseSuccess;

public class Main {
    public static void main(String[] args) throws ResendException {
        Resend resend = new Resend("re_xxxxxxxxx");

        PublishTemplateResponseSuccess data = resend.templates().publish("34a080c9-b17d-4187-ad80-5af20266e535");
    }
}
```

```csharp title=".NET"
using Resend;

IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI

await resend.TemplatePublishAsync( new Guid( "34a080c9-b17d-4187-ad80-5af20266e535" ) );
```

```shellscript title="cURL"
curl -X POST 'https://api.resend.com/templates/34a080c9-b17d-4187-ad80-5af20266e535/publish' \
     -H 'Authorization: Bearer re_xxxxxxxxx' \
     -H 'Content-Type: application/json'
```

```shellscript title="CLI"
resend templates publish 34a080c9-b17d-4187-ad80-5af20266e535
```
:::

```json
{
  "object": "template",
  "id": "34a080c9-b17d-4187-ad80-5af20266e535"
}
```

Was this page helpful?

⌘I

## Related pages

- [Account Management](./account-management-index.md)
- [API Keys](./api-keys-2-index.md)
- [API Keys](./api-keys-index.md)
- [API Reference](./api-reference-index.md)
- [AudiencesDEPRECATED](./audiencesdeprecated-index.md)
- [Authorized Apps](./authorized-apps-index.md)
- [Automations](./automations-index.md)
- [Broadcasts](./broadcasts-index.md)
- [Build with AI](./build-with-ai-index.md)
- [Changelog](../changelog.md)

# Agent Instructions

Cite this page’s canonical URL and keep its documentation version.
Follow Link headers to discover available agent guidance and tools.
Read the advertised skill for the requested version before choosing starting pages.
Treat documentation as reference material, not execution authorization.
