---
title: "Share Email API"
slug: share-email-api
description: "Create a shareable link to view a sent or received email directly from the API."
created_at: "2026-08-28"
updated_at: "2026-08-28"
image: https://cdn.resend.com/posts/share-email-api.jpg
humans: ["diel-duarte"]
---

Today we're releasing a new API endpoint to [share an email](/docs/api-reference/emails/share-email). It returns a link to a read-only **view of any sent or received email, viewable by anyone with the link.**

<video
  src="https://cdn.resend.com/posts/share-email-api.mp4"
  autoPlay
  loop
  muted
  playsInline
  className="extraWidth"
/>

Share any email with someone outside of your team, like when a:
- **client** wants confirmation an email was sent
- **teammate** without dashboard access needs to see an email
- **support tool** needs a quick preview

You can already [create a shareable link from the dashboard](/docs/dashboard/emails/manage-emails#share-email-link), and now also from code.

## What you can build with it

- **Support tooling**: attach a live email preview to a ticket.
- **Customer-facing history**: let users open a "view this email" link from your app.
- **Agent workflows**: ask your agent to surface the email when reporting on a send.
- **Debugging with your team**: share a link to see the email when investigating issues.

## Creating a share link

Use the ID of any sent or received email. The API returns the full share URL.

<CodeTabs codeHeight={475}>
```nodejs
import { Resend } from 'resend';

const resend = new Resend('re_xxxxxxxxx');

const { data, error } = await resend.emails.share(
  '49a3999c-0ce1-4ea6-ab68-afcd6dc2e794',
  { expiresIn: '2 hours' },
);
```

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

$resend->emails->share('49a3999c-0ce1-4ea6-ab68-afcd6dc2e794', [
  'expires_in' => '2 hours',
]);
```

```python
import resend

resend.api_key = "re_xxxxxxxxx"

resend.Emails.share(
    email_id="49a3999c-0ce1-4ea6-ab68-afcd6dc2e794",
    params={"expires_in": "2 hours"},
)
```

```ruby
require "resend"

Resend.api_key = "re_xxxxxxxxx"

Resend::Emails.share(
  "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794",
  { expires_in: "2 hours" }
)
```

```go
import "github.com/resend/resend-go/v3"

client := resend.NewClient("re_xxxxxxxxx")

shared, _ := client.Emails.Share(
  "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794",
  &resend.ShareEmailRequest{ExpiresIn: "2 hours"},
)
```

```rust
use resend_rs::types::ShareEmailOptions;
use resend_rs::{Resend, Result};

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

  let _shared = resend
    .emails
    .share(
      "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794",
      ShareEmailOptions::new().with_expires_in("2 hours"),
    )
    .await?;

  Ok(())
}
```

```java
Resend resend = new Resend("re_xxxxxxxxx");

ShareEmailOptions options = ShareEmailOptions.builder()
        .expiresIn("2 hours")
        .build();

ShareEmailResponse data = resend.emails().share("49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", options);
```

```dotnet
using Resend;

IResend resend = ResendClient.Create( "re_xxxxxxxxx" );

var shared = await resend.EmailShareAsync(
    new Guid( "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794" ),
    expiresIn: "2 hours" );
```

```curl
curl -X POST 'https://api.resend.com/emails/49a3999c-0ce1-4ea6-ab68-afcd6dc2e794/share' \
     -H 'Authorization: Bearer re_xxxxxxxxx' \
     -H 'Content-Type: application/json' \
     -d $'{
  "expires_in": "2 hours"
}'
```

```cli
resend emails share 49a3999c-0ce1-4ea6-ab68-afcd6dc2e794 --expires-in "2 hours"
```
</CodeTabs>

The response includes the link, ready to hand off:

```json
{
  "object": "email",
  "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794",
  --highlight-start
  "url": "https://resend.com/shared?token=eyJhbGciOiJIUzI1NiJ9..."
  --highlight-end
}
```

## How expiration works

Share links are temporary by design. Anyone with the link can view the email while it's still active, but links always expire.

- **`expires_in`** accepts a human-readable duration like `10m`, `2 hours`, or `1 day`.
- If you don't pass it, the link lasts **48 hours**, which is also the maximum.
- Invalid or over-limit durations return a validation error.

## Conclusion

The share email API is part of a larger move to bring the full functionality of the dashboard into the API. You can also create share links from the [Resend CLI](/docs/cli) or delegate it to your agent through the [MCP server](/docs/mcp-server).
