Set status to opt-out during contact creation in v1 of API
Hello, I am hoping to set the status value of contacts during creation with the v1 API. There is an opt-in / opt-out checkbox on the form we are using to trigger contact creation, but it seems that setting the Status value of the contact to OPTOUT, rather than ACTIVE during creation still places the created user in under Active contacts. Can this be done without a separate call to the opt-out API endpoint after user creation, or is this something I perhaps need to upgrade to the v2/v3 API to achieve in a single creation call.
Re: Set status to opt-out during contact creation in v1 of API
Thanks for reaching out to Constant Contact's API Support team.
You should definitely consider upgrading to using our v2 or v3 API (which one depends on whether you are needing to use more than just contacts features). In our v1 and v2 APIs we don't have a single call to create an individual contact and unsubscribe them at the same time. The process you would follow for our v2 API would be as follows:
- GET the contact by email address to see if they exist. - If they do, you can make a DELETE call to the returned contact ID to unsubscribe the existing contact. - If they do not exist, you would POST the contact to create them first. The response will include the newly created contact ID which you would then DELETE to unsubscribe them.
When using our v3 API you can set a contact's "permission_to_send" status to "unsubscribed" while you are creating them to immediately opt them out.
Please let us know if you have any other questions!
You can post a new message in the Community or find us on Twitter Mon-Fri 8am-8pm ET, Sat 10am-8pm ET, & Sun 10am-6pm ET. We've got real people waiting to help you out. Click below to start a conversation!