Skip to main content
Resend Docs

Search documentation

Type to search this documentation.

Configure a custom Return Path

By default, Resend uses the send subdomain for the Return-Path address.

You can provide a custom Return-Path address when you add a new domain in the Dashboard under Advanced options, or by setting the optional custom_return_path parameter when creating a domain via the API or with the domains create CLI command.

Custom Return Path

For the API, optionally pass the custom return path parameter.

Node.js
import { Resend } from 'resend';

const resend = new Resend('re_xxxxxxxxx');

resend.domains.create({ name: 'example.com', customReturnPath: 'outbound' });
PHP
$resend = Resend::client('re_xxxxxxxxx');

$resend->domains->create([
  'name' => 'example.com',
  'custom_return_path' => 'outbound'
]);
Python
import resend

resend.api_key = "re_xxxxxxxxx"

params: resend.Domains.CreateParams = {
  "name": "example.com",
  "custom_return_path": "outbound"
}

resend.Domains.create(params)
Ruby
require "resend"

Resend.api_key = "re_xxxxxxxxx"

params = {
  name: "example.com",
  custom_return_path: "outbound"
}
domain = Resend::Domains.create(params)
puts domain
Go
package main

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

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

	params := &resend.CreateDomainRequest{
		Name:             "example.com",
		CustomReturnPath: "outbound",
	}

	client.Domains.Create(params)
}
Rust
use resend_rs::{types::CreateDomainOptions, Resend, Result};

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

  let _domain = resend
    .domains
    .create(CreateDomainOptions::new("example.com").with_custom_return_path("outbound"))
    .await?;

  Ok(())
}
Java
import com.resend.*;
import com.resend.core.exception.ResendException;
import com.resend.services.domains.model.CreateDomainOptions;
import com.resend.services.domains.model.CreateDomainResponse;

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

        CreateDomainOptions params = CreateDomainOptions
                .builder()
                .name("example.com")
                .customReturnPath("outbound")
                .build();

        CreateDomainResponse domain = resend.domains().create(params);
    }
}
.NET
using Resend;

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

var resp = await resend.DomainAddAsync( new DomainAddData {
   DomainName = "example.com",
   CustomReturnPath = "outbound"
} );
Console.WriteLine( "Domain Id={0}", resp.Content.Id );
cURL
curl -X POST 'https://api.resend.com/domains' \
     -H 'Authorization: Bearer re_xxxxxxxxx' \
     -H 'Content-Type: application/json' \
     -d $'{
  "name": "example.com",
  "custom_return_path": "outbound"
}'

Custom return paths must adhere to the following rules:

  • Must be 63 characters or less.
  • Must start with a letter, and end with a letter or number.
  • Must contain only letters, numbers, and hyphens.

Avoid setting values that could undermine credibility (e.g. testing), as they may be exposed to recipients in some email clients.

Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu