Create a new contact
const url = 'https://app.surveyrock.com/api/v1/contacts';const options = { method: 'POST', headers: { 'Idempotency-Key': 'example', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"email":"hello@example.com","first_name":"example","last_name":"example","customFields":{}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://app.surveyrock.com/api/v1/contacts \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: example' \ --data '{ "email": "hello@example.com", "first_name": "example", "last_name": "example", "customFields": {} }'Create a new contact. The response carries the new resource’s ETag, as the ETag header and as meta.etag.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”1 to 128 characters, chosen by the caller. A retry with the same key and body replays the first response instead of applying the write twice; the same key with a different body is a 409
Request Bodyrequired
Section titled “Request Bodyrequired”object
Values keyed by the id of one of the workspace’s custom fields; an id that is not one is a 422
object
Examplegenerated
{ "email": "hello@example.com", "first_name": "example", "last_name": "example", "customFields": {}}Responses
Section titled “Responses”Contact created. When the email belongs to a deleted contact, that contact is restored (same id) with the new name and fields and no list memberships; it keeps an Unsubscribed, Hard Bounced or Complained status, so check status.
Headers
Section titled “Headers”Example
"element:abc123:1790690123456789"The resource’s current version, as a strong validator. Opaque: send it back unchanged as If-Match. Also returned as meta.etag in the body, for a client that only sees the body.
Duplicate email
The request is malformed, or a customFields key is not a custom field of this workspace: each error names the field