Create a contact's preference links

POST
/v1/contacts/{id}/preference_links

The contact's preference center and unsubscribe links, for emails you build yourself. They never expire. Marketing email sent through coss.com gets them (and one-click unsubscribe headers) automatically. Needs contact:update: whoever has the links can change the contact's consent.

Authorization

bearerAuth
headerAuthorizationBearer <token>

A secret API key from the dashboard: coss_live_… for production environments, coss_test_… for sandbox environments.

Path Parameters

id*string

The contact's id, or its address (URL-encoded).

Header Parameters

Coss-Version?"2026-10-10"

The API version (a date) to use for this request. Defaults to your organization's version, pinned to the latest one when it first used the API and upgraded from the dashboard. The SDK always sends the version it was built for.

Value in"2026-10-10"

Request Body

application/json
  1. body
topic?string

The topic your email is about: its unsubscribe link leaves just that topic.

Match^[A-Za-z0-9_-]{1,256}$

Response Body

The links.

application/json
  1. response
object*"preference_links"
Value in"preference_links"
contact_id*string
preferences_url*string

The contact's preference center.

unsubscribe_url*string

A one-button unsubscribe page.

import { Coss } from "coss";const coss = new Coss({  apiKey: process.env.COSS_API_KEY,  baseUrl: "https://api.coss.com",});const { data, error } = await coss.email.contacts.createPreferenceLinks("contact_01k7c8m4q2f3e9v6t5r1n0p8yz", {  topic: "newsletter",});
{  "object": "preference_links",  "contact_id": "contact_01k7c8m4q2f3e9v6t5r1n0p8yz",  "preferences_url": "https://track.cosslinks.com/t/u/aXyZ…",  "unsubscribe_url": "https://track.cosslinks.com/t/u/aXyZ…/unsubscribe"}