Send a campaign's invitation to one person
const url = 'https://app.surveyrock.com/api/v1/distribution/example/invitations?dry_run=1';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"}'};
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/distribution/example/invitations?dry_run=1' \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: example' \ --data '{ "email": "hello@example.com", "first_name": "example", "last_name": "example" }'Send a launched email campaign’s invitation to one address. The campaign must have been allowed to send this way by a person in SurveyRock; nothing here can do that or raise its limits. Nothing you send reaches the email except a first and last name, through the merge tags the campaign uses. An address with no contact gets one. status is queued (accepted, not delivered) or skipped, with reason opted_out, undeliverable, recently_invited or already_responded: a person who may not be emailed is an answer, not an error, and costs no send. With dry_run=1 every check runs, nothing is written and the answer says what would have happened. The personal survey link is never returned. Needs the distribution:send scope, which only an issued client can hold, on a person’s tick.
Authorizations
Section titled “Authorizations”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path 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
Query Parameters
Section titled “Query Parameters”1 to run every check and write nothing
Request Bodyrequired
Section titled “Request Bodyrequired”object
Examplegenerated
{ "email": "hello@example.com", "first_name": "example", "last_name": "example"}Responses
Section titled “ Responses ”Skipped, or a dry run
Queued
The connection lacks distribution:send (send_permission_required), the role cannot send, or the plan does not include it (feature_locked)
No mail went: the campaign is not armed or was switched off, a budget or the month’s allowance is used up, or the account or survey cannot send. The message says what to do
email is missing or is not an address
Too many requests a minute; pacing only