Skip to main content
Resend Docs

Search documentation

Type to search this documentation.

On this pageOverview

Retrieve Contact Topics

GET

/

contacts

/

:contact_id

/

topics

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

const resend = new Resend('re_xxxxxxxxx');

const { data, error } = await resend.contacts.topics.list({
  id: 'e169aa45-1ecf-4183-9955-b1499d5701d3',
  // or: email: 'steve.wozniak@gmail.com',
});
PHP
$resend = Resend::client('re_xxxxxxxxx');

// Get by contact id
$resend->contacts->topics->get('e169aa45-1ecf-4183-9955-b1499d5701d3');

// Get by contact email
$resend->contacts->topics->get('steve.wozniak@gmail.com');
Python
import resend

resend.api_key = 're_xxxxxxxxx'

# Get by contact id
topics = resend.Contacts.Topics.list(contact_id='e169aa45-1ecf-4183-9955-b1499d5701d3')

# Get by contact email
topics = resend.Contacts.Topics.list(email='steve.wozniak@gmail.com')
Ruby
require "resend"

Resend.api_key = "re_xxxxxxxxx"

# Get by contact id
contact_topics = Resend::Contacts::Topics.list(id: "e169aa45-1ecf-4183-9955-b1499d5701d3")

# Get by contact email
contact_topics = Resend::Contacts::Topics.list(email: "steve.wozniak@gmail.com")
Go
package main

import (
	"context"
	"fmt"

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

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

	// Get by contact id
	topics, err := client.Contacts.Topics.ListWithContext(ctx, "e169aa45-1ecf-4183-9955-b1499d5701d3")
	if err != nil {
		panic(err)
	}
	fmt.Println(topics)

	// Get by contact email
	topics, err = client.Contacts.Topics.ListWithContext(ctx, "steve.wozniak@gmail.com")
	if err != nil {
		panic(err)
	}
	fmt.Println(topics)
}
Rust
use resend_rs::{list_opts::ListOptions, Resend, Result};

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

  let _topics = resend
    .contacts
    .get_contact_topics(
      "e169aa45-1ecf-4183-9955-b1499d5701d3",
      ListOptions::default(),
    )
    .await?;

  Ok(())
}
Java
import com.resend.Resend;
import com.resend.core.exception.ResendException;

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

    // Get by contact id
    resend.contacts().topics().list("e169aa45-1ecf-4183-9955-b1499d5701d3");

    // Get by contact email
    resend.contacts().topics().list("steve.wozniak@gmail.com");
  }
}
.NET
using Resend;

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

var resp = await resend.ContactListTopicsAsync( new Guid( "e169aa45-1ecf-4183-9955-b1499d5701d3" ));
Console.WriteLine( "Nr Topics={0}", resp.Content.Data.Count );
cURL
// Get by contact id
curl -X GET 'https://api.resend.com/contacts/e169aa45-1ecf-4183-9955-b1499d5701d3/topics' \
     -H 'Authorization: Bearer re_xxxxxxxxx'

// Get by contact email
curl -X GET 'https://api.resend.com/contacts/steve.wozniak@gmail.com/topics' \
     -H 'Authorization: Bearer re_xxxxxxxxx'
CLI
# Get by contact id
resend contacts topics e169aa45-1ecf-4183-9955-b1499d5701d3

# Get by contact email
resend contacts topics steve.wozniak@gmail.com
Response
{
  "object": "list",
  "has_more": false,
  "data": [
    {
      "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e",
      "name": "Product Updates",
      "description": "New features, and latest announcements.",
      "subscription": "opt_in"
    }
  ]
}

Either id or email must be provided.

string

The Contact ID.

string

The Contact Email.

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

const resend = new Resend('re_xxxxxxxxx');

const { data, error } = await resend.contacts.topics.list({
  id: 'e169aa45-1ecf-4183-9955-b1499d5701d3',
  // or: email: 'steve.wozniak@gmail.com',
});
PHP
$resend = Resend::client('re_xxxxxxxxx');

// Get by contact id
$resend->contacts->topics->get('e169aa45-1ecf-4183-9955-b1499d5701d3');

// Get by contact email
$resend->contacts->topics->get('steve.wozniak@gmail.com');
Python
import resend

resend.api_key = 're_xxxxxxxxx'

# Get by contact id
topics = resend.Contacts.Topics.list(contact_id='e169aa45-1ecf-4183-9955-b1499d5701d3')

# Get by contact email
topics = resend.Contacts.Topics.list(email='steve.wozniak@gmail.com')
Ruby
require "resend"

Resend.api_key = "re_xxxxxxxxx"

# Get by contact id
contact_topics = Resend::Contacts::Topics.list(id: "e169aa45-1ecf-4183-9955-b1499d5701d3")

# Get by contact email
contact_topics = Resend::Contacts::Topics.list(email: "steve.wozniak@gmail.com")
Go
package main

import (
	"context"
	"fmt"

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

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

	// Get by contact id
	topics, err := client.Contacts.Topics.ListWithContext(ctx, "e169aa45-1ecf-4183-9955-b1499d5701d3")
	if err != nil {
		panic(err)
	}
	fmt.Println(topics)

	// Get by contact email
	topics, err = client.Contacts.Topics.ListWithContext(ctx, "steve.wozniak@gmail.com")
	if err != nil {
		panic(err)
	}
	fmt.Println(topics)
}
Rust
use resend_rs::{list_opts::ListOptions, Resend, Result};

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

  let _topics = resend
    .contacts
    .get_contact_topics(
      "e169aa45-1ecf-4183-9955-b1499d5701d3",
      ListOptions::default(),
    )
    .await?;

  Ok(())
}
Java
import com.resend.Resend;
import com.resend.core.exception.ResendException;

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

    // Get by contact id
    resend.contacts().topics().list("e169aa45-1ecf-4183-9955-b1499d5701d3");

    // Get by contact email
    resend.contacts().topics().list("steve.wozniak@gmail.com");
  }
}
.NET
using Resend;

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

var resp = await resend.ContactListTopicsAsync( new Guid( "e169aa45-1ecf-4183-9955-b1499d5701d3" ));
Console.WriteLine( "Nr Topics={0}", resp.Content.Data.Count );
cURL
// Get by contact id
curl -X GET 'https://api.resend.com/contacts/e169aa45-1ecf-4183-9955-b1499d5701d3/topics' \
     -H 'Authorization: Bearer re_xxxxxxxxx'

// Get by contact email
curl -X GET 'https://api.resend.com/contacts/steve.wozniak@gmail.com/topics' \
     -H 'Authorization: Bearer re_xxxxxxxxx'
CLI
# Get by contact id
resend contacts topics e169aa45-1ecf-4183-9955-b1499d5701d3

# Get by contact email
resend contacts topics steve.wozniak@gmail.com
JSON
{
  "object": "list",
  "has_more": false,
  "data": [
    {
      "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e",
      "name": "Product Updates",
      "description": "New features, and latest announcements.",
      "subscription": "opt_in"
    }
  ]
}

Was this page helpful?

⌘I

Suggest an edit

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

Export
Documentation menu