Upsert a contact
Create the contact if it does not exist, or update it if it does.
https://app.usenotix.dev/api/v1/contactBooks/{contactBookId}/contacts/{contactId}Needs a full access key. Sending access keys cannot call this. Key permissions lists the extra rules some calls have.
Create the contact if it does not exist, or update it if it does.
Path parameters
The contact this request is about. With an email in the body it must be the id of the contact that email already belongs to, or the email must be new to the book. Without an email in the body the contact must already exist.
Body parameters
The contact's email address, stored trimmed and lower-cased. Optional: leave it out to update the contact the path id names, by id alone.
At most 256 characters.
At most 256 characters.
Headers
Bearer followed by your API key.
Set to true to preview the request instead of running it. The answer is 200 with dryRun: true: who it would reach, what they would see, what it would cost, whether policy allows it and the limits it counts against. Nothing is sent, charged, reserved or written. A write route that cannot preview answers 400.
Errors
The key's approval policy does not allow the journey enrolments or confirmation email this contact sets off
The key's daily journey enrolment limit or email cap is reached
The per-key limits cannot be checked just now; nothing was written
Every error has the same shape. See all error codes.
curl -X PUT "https://app.usenotix.dev/api/v1/contactBooks/<contactBookId>/contacts/<contactId>" \
-H "Authorization: Bearer $NOTIX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"email": "customer@example.com",
"firstName": "Acme",
"lastName": "Acme",
"properties": {},
"subscribed": true
}'
import { Notix } from "notix-js";
const notix = new Notix(process.env.NOTIX_API_KEY);
const { data, error } = await notix.contacts.upsert("cb_123", "cnt_456", {
email: "ada@example.com",
firstName: "Ada",
});
from notix import Notix
notix = Notix() # reads NOTIX_API_KEY
contact, _ = notix.contacts.upsert("cb_123", "cnt_456", {"email": "ada@example.com", "firstName": "Ada"})
use Notix\Notix;
$notix = new Notix(getenv('NOTIX_API_KEY'));
$contact = $notix->contacts->upsert('cb_123', 'cnt_456', ['email' => 'ada@example.com', 'firstName' => 'Ada']);
{
"contactId": "cm1x8f3k20001qz7v5b9d2e4a"
}