Skip to content

Subscribe someone from a site

POST
/api/v1/newsletter/subscribe
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.

Idempotency-Key
string
>= 1 characters <= 255 characters

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-1f2d3c4b5a69
Media typeapplication/json
object
email
required
string
>= 3 characters <= 254 characters
name
string
<= 160 characters
fields

CRM custom fields by key: those the form asks for, or without a form, those shown on forms.

object
key
additional properties
string
<= 2000 characters
formId

The signup form, nlf_…: its tags, double opt-in and words.

string
<= 64 characters
ref

The referral code from ?ref= on the page they arrived at.

string
<= 32 characters
utm
object
source
string
<= 100 characters
medium
string
<= 100 characters
campaign
string
<= 100 characters
term
string
<= 100 characters
content
string
<= 100 characters
pageUrl

The page they signed up on.

string
<= 2000 characters
turnstileToken

Turnstile’s token, which a page must send where a widget covers its hostname.

string
<= 4096 characters
visitorIp

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.

string
<= 64 characters
honeypot

A field people never see: anything in it answers as a signup and keeps nothing.

string
<= 200 characters

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"
}

Done

Media typeapplication/json
object
status
required

pending while they still have to confirm by email; subscribed once they’re on the list.

string
Allowed values: pending subscribed
message
required

What to tell them: the form’s words.

string
redirectUrl
required

Where the form sends them instead, when it says.

string | null

Example

{
"status": "pending"
}

What was sent isn’t valid (invalid).

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

No key, or one that’s unknown, off or expired.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

The key doesn’t have the permission this needs.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

Nothing has that id (not_found).

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

A request with the same Idempotency-Key is still running (conflict).

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

The Idempotency-Key was used with a different request.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

Over the rate limit; see retry-after.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}