FlaresendDocs
Contacts

Create a contact

Add a contact to the project, or update it if a contact with that email already exists.

POST/v1/contactsAPI key

This call is an upsert keyed on email. When the project has no contact with that address, a new one is created. When it has one, the fields you send are written over it and the fields you leave out are kept. Either way the response is the contact as it is now, with status 201.

Contacts are the people you send broadcasts to. See Contacts.

Body parameters

emailstringrequired

The contact's address. Stored lowercased and trimmed. Each address appears once per project.

firstNamestring | null

Up to 200 characters. Available in broadcasts as {{first_name}}. On an existing contact, leaving it out or sending null keeps the stored value.

lastNamestring | null

Up to 200 characters. Available in broadcasts as {{last_name}}. On an existing contact, leaving it out or sending null keeps the stored value.

unsubscribedbooleandefault: false

true means broadcasts skip this contact. On an existing contact, leaving it out keeps the stored value, so an upsert never re-subscribes someone by accident.

dataobject | null

Any extra values you want in broadcast templates, for example { "plan": "pro" } for {{plan}}. On an existing contact, sending an object replaces the stored one; leaving it out or sending null keeps it.

To clear firstName, lastName or data, use Update a contact, where null does clear the field.

Response

Status 201 with the contact.

idstring

The contact ID, for example ct_01K6C1M3R8T2V9X4Z6B7N5P0QA.

projectIdstring

The project the contact belongs to.

emailstring

The lowercased address.

firstNamestring | null
lastNamestring | null

Whether broadcasts skip this contact.

dataobject | null

Your extra values.

createdAtstring

ISO 8601 time the contact was first created.

updatedAtstring

ISO 8601 time of the last change.

Errors

StatusCodeWhen
400missing_bodyThe request has no body.
400invalid_bodyThe body is not JSON, email is not a valid address, or a name is over 200 characters. param names the field.

See Errors for the full list.