Subscribe someone from a site
const url = 'https://digize.com/api/v1/newsletter/subscribe';const options = { method: 'POST', headers: { 'Idempotency-Key': '5f1c2a8e-3b7d-4c55-9a0e-1f2d3c4b5a69', 'x-api-key': '<x-api-key>', 'Content-Type': 'application/json' }, body: '{"email":"example","name":"example","fields":{"additionalProperty":"example"},"formId":"example","ref":"example","utm":{"source":"example","medium":"example","campaign":"example","term":"example","content":"example"},"pageUrl":"example","turnstileToken":"example","visitorIp":"example","honeypot":"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://digize.com/api/v1/newsletter/subscribe \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: 5f1c2a8e-3b7d-4c55-9a0e-1f2d3c4b5a69' \ --header 'x-api-key: <x-api-key>' \ --data '{ "email": "example", "name": "example", "fields": { "additionalProperty": "example" }, "formId": "example", "ref": "example", "utm": { "source": "example", "medium": "example", "campaign": "example", "term": "example", "content": "example" }, "pageUrl": "example", "turnstileToken": "example", "visitorIp": "example", "honeypot": "example" }'A visitor signing up on the workspace’s site: their email, name and CRM fields, the signup form it came from, the ref code from the share link they arrived by, the UTM tags and page. Call it from a page with the publishable key and Turnstile’s token, or from the site’s server with an API key. Double opt-in goes as Newsletter › Settings or the form says, and always for a referral. The answer is the same whether or not they were subscribed already.
Needs the newsletter:write permission.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Makes the request safe to send again: for 24 hours the same key and request answer the first response without repeating the change.
Example
5f1c2a8e-3b7d-4c55-9a0e-1f2d3c4b5a69Request Bodyrequired
Section titled “Request Bodyrequired”object
CRM custom fields by key: those the form asks for, or without a form, those shown on forms.
object
The signup form, nlf_…: its tags, double opt-in and words.
The referral code from ?ref= on the page they arrived at.
object
The page they signed up on.
Turnstile’s token, which a page must send where a widget covers its hostname.
With an API key from the site’s server: the visitor’s IP address, for the per-visitor limit and the referral checks. Ignored with a publishable key.
A field people never see: anything in it answers as a signup and keeps nothing.
Example generated
{ "email": "example", "name": "example", "fields": { "additionalProperty": "example" }, "formId": "example", "ref": "example", "utm": { "source": "example", "medium": "example", "campaign": "example", "term": "example", "content": "example" }, "pageUrl": "example", "turnstileToken": "example", "visitorIp": "example", "honeypot": "example"}Responses
Section titled “Responses”Done
object
pending while they still have to confirm by email; subscribed once they’re on the list.
What to tell them: the form’s words.
Where the form sends them instead, when it says.
Example
{ "status": "pending"}What was sent isn’t valid (invalid).
object
object
object
Example
{ "error": { "code": "invalid" }}No key, or one that’s unknown, off or expired.
object
object
object
Example
{ "error": { "code": "invalid" }}The key doesn’t have the permission this needs.
object
object
object
Example
{ "error": { "code": "invalid" }}Nothing has that id (not_found).
object
object
object
Example
{ "error": { "code": "invalid" }}A request with the same Idempotency-Key is still running (conflict).
object
object
object
Example
{ "error": { "code": "invalid" }}The Idempotency-Key was used with a different request.
object
object
object
Example
{ "error": { "code": "invalid" }}Over the rate limit; see retry-after.
object
object
object
Example
{ "error": { "code": "invalid" }}