- List contacts GET
- Create or update a contact POST
- Resend a contact's confirmation email POST
- Create a contact's preference links POST
- Import contacts in bulk POST
- Export contacts as CSV GET
- Retrieve a contact GET
- Update a contact PATCH
- Delete a contact DELETE
- Retrieve a contact's topics GET
- Update a contact's topics PATCH
- List contact properties GET
- Create a contact property POST
- Retrieve a contact property GET
- Update a contact property's fallback PATCH
- Delete a contact property DELETE
Create or update a contact
Creates the contact with this address in the API key's environment, or updates the existing one: names are replaced when given, properties are merged (null removes one), audience_ids are added and topics choices recorded. status only changes when passed.
bearerAuthAuthorizationBearer <token>A secret API key from the dashboard: coss_live_… for production environments, coss_test_… for sandbox environments.
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.
"2026-10-10"application/json- body
- body
- …
email*stringThe contact's address. Display names are ignored; matching is case-insensitive.
first_name?|Their first name. null removes it.
1 <= length <= 256last_name?|Their last name. null removes it.
1 <= length <= 256properties?Custom properties by key (define them first, see contact properties). Merged into the contact's existing properties; null removes one.
status?stringSets the contact's consent. Omitted, a new contact is subscribed and an existing one keeps its status.
"subscribed""unsubscribed"audience_ids?array<string>Audiences to add the contact to (it stays in the others).
items <= 20topics?array<>Choices per topic; topics left out keep the contact's choice.
items <= 100double_opt_in?booleanAsk the contact to confirm first (default: the marketing settings' double_opt_in_default): a new or unsubscribed contact becomes pending and gets a confirmation email; it is subscribed once they click its link. Can't be combined with status: "subscribed", nor can the default (pass false to subscribe directly).
The existing contact, updated.
application/json- response
- response
- …
object*"contact""contact"id*stringemail*stringThe contact's address. Unique in the environment, case-insensitively.
first_name*|Their first name. null: not set.
last_name*|Their last name. null: not set.
status*stringConsent to marketing email: subscribed, unsubscribed (never receives marketing email; transactional email is unaffected) or pending (waiting for a double opt-in confirmation).
"subscribed""unsubscribed""pending"properties*Custom properties by key.
source*stringHow the contact was created.
"api""dashboard""import""preference_center""form"subscribed_at*|When it last became subscribed. null: it hasn't.
date-timeunsubscribed_at*|When it became unsubscribed. null unless it is.
date-timeconfirmed_at*|When the contact confirmed a double opt-in.
date-timecreated_at*stringdate-timeupdated_at*stringdate-timeimport { 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.upsert({ email: "ada@example.com", first_name: "Ada", properties: { plan: "pro", }, topics: [ { topic: "newsletter", status: "opted_in", }, ],});{ "object": "contact", "id": "contact_01k7c8m4q2f3e9v6t5r1n0p8yz", "email": "ada@example.com", "first_name": "Ada", "last_name": "Lovelace", "status": "subscribed", "properties": { "plan": "pro", "seats": 5 }, "source": "api", "subscribed_at": "2026-10-10T12:00:00.000Z", "unsubscribed_at": null, "confirmed_at": null, "created_at": "2026-10-10T12:00:00.000Z", "updated_at": "2026-10-10T12:00:00.000Z"}