Skip to content

Check a post before sending

POST
/api/v1/newsletter/posts/{id}/checks
curl --request POST \
--url https://digize.com/api/v1/newsletter/posts/example/checks \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: 5f1c2a8e-3b7d-4c55-9a0e-1f2d3c4b5a69' \
--header 'x-api-key: <x-api-key>' \
--data '{ "audience": { "tags": [], "excludeTags": [], "stages": [], "lists": [ "example" ], "excludeLists": [ "example" ], "tier": "example" }, "abTest": { "metric": "opens", "share": 1, "waitHours": 1, "variants": [ { "subject": "example", "preview": "" } ] }, "at": null }'

Every check before a post goes, at once: errors stop it (no subject, no content, no service or sending domain ready, no postal address, nobody in the audience, a link that isn’t http(s), mailto:, tel: or a merge tag, a resend too soon), warnings are to judge (images without alt text, a paywall going only to free readers, an email over Gmail’s 102 KB clip, an A/B test too small to pick a winner). With audience, abTest and at, it checks those in place of the saved post’s, as the send dialog does. Also how many it would go to now.

Needs the newsletter:read permission.

id
required
string
>= 1 characters <= 64 characters
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
audience
object
tags

Any of these tags; empty for everyone subscribed.

Array<string>
default: <= 50 items
excludeTags

Leaves out contacts with any of these tags.

Array<string>
default: <= 50 items
stages

Leads (no orders), customers (1–2) or repeat customers (3 or more); empty for all.

Array<string>
default:
Allowed values: lead customer repeat
lists

In any of these CRM lists (crm.lists.list), smart or static; empty for no list.

Array<string>
<= 20 items
excludeLists

Leaves out anyone in any of these segments (CRM lists, newsletter.segments.list); empty to leave nobody out.

Array<string>
<= 20 items
tier

Readers by tier: all (or left out), free readers only, paid readers of any tier, or one tier’s id (newsletter.tiers.list). A paid-only post goes to paid readers whatever this says.

string
/^(all|free|paid|nlt_[0-9A-Z]{26})$/
abTest
Any of:
object
metric
required

What picks the winner: the share of people who opened it (a person’s open, never a mail app’s own fetch) or who clicked a link.

string
Allowed values: opens clicks
share
required

The share of the audience the test goes to, 0.1 to 0.5, split evenly between the variants.

number
>= 0.1 <= 0.5
waitHours
required

Hours after the test’s last batch went before the winner is picked and goes to the rest.

integer
>= 1 <= 24
variants
required

The other subjects (B, C, D). Variant A is the post’s own subject and preview text.

Array<object>
>= 1 items <= 3 items
object
subject
required
string
>= 1 characters <= 200 characters
preview

Its preview text; empty for the post’s own.

string
"" <= 200 characters
at
Any of:
string format: date-time

Done

Media typeapplication/json
object
checks
required
Array<object>
object
code
required
string
Allowed values: subject web_only content provider from domain postal_address audience ab_test resend links alt_text paywall size
level
required
string
Allowed values: error warning
message
required
string
recipients
required
number

Example

{
"checks": [
{
"code": "subject",
"level": "error"
}
]
}

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