Documentation
API reference
Connect your website, shop, or app to Papelillo. Every request is shown with an example you can copy.
On this page
Introduction
The API is a plain HTTP API. You send JSON and you get JSON back. It works with every programming language and with tools such as curl.
With the API you can:
- add, read, change, and remove subscribers,
- group subscribers in lists,
- create and change templates,
- create, send, schedule, and cancel campaigns,
- fire events that start your automations,
- send one mail to one address, such as an order confirmation.
https://www.papelillo.io/api/v1The API is part of the Pro and Enterprise plans. For what the parts mean, read the guide first.
Quickstart
1. Create an API key. In the app, open Settings, then API, and create a key. Copy it right away, it is shown only once.
2. Keep the key in a variable. The examples on this page read the key from $API_KEY.
export API_KEY="pap_your_key"3. Send your first request. This adds a subscriber to your team:
curl -X POST "https://www.papelillo.io/api/v1/subscribers" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"email": "ada@example.com", "firstName": "Ada", "origin": "newsletter"}'The same request in JavaScript:
const response = await fetch("https://www.papelillo.io/api/v1/subscribers", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
email: "ada@example.com",
firstName: "Ada",
origin: "newsletter",
}),
});
const result = await response.json();
if (!response.ok) {
throw new Error(result.error.message);
}
console.log(result.data.subscriber.id);Authentication
Every request needs an API key. Send it in the Authorization header as a bearer token. Keys start with pap_.
Authorization: Bearer pap_your_keyA key belongs to one team and only sees the data of that team. It can do what a manager of the team can do. A team can have up to 10 keys, so each of your systems can have its own.
Keep your key secret
A missing, wrong, or revoked key is answered with 401. A key of a team whose plan does not include the API is answered with 403.
Requests and answers
Send the body as a JSON object with the header Content-Type: application/json. A body can have up to 512 KB.
A successful answer always has a data field. A failed answer always has an error field with a message. So you only need to check one thing.
{
"data": { "...": "..." }
}{
"error": {
"message": "Enter a valid email address."
}
}- IDs are UUIDs, for example
5f0c2b1e-7a34-4d0b-9c59-2f1f7e0a9b11. - Dates and times are ISO 8601 texts in UTC, for example
2026-06-15T09:00:00.000Z. - A value that is not set is
null.
Pagination
List requests return one page at a time. Choose the page with page (starting at 1) and its size with limit (1 to 100, default 25).
{
"data": {
"items": [],
"page": 2,
"limit": 25,
"total": 61
}
}total is the number of all matching items. There are more pages as long as page × limit is smaller than total.
Errors
The HTTP status tells you what kind of problem it is. The message tells you what to do. Messages are written for people, so you can show them or log them.
| Status | Meaning | What to do |
|---|---|---|
400 | The request is not valid: a field is missing or has a wrong value, or the body is not JSON. | Fix the request. The message names the problem. |
401 | The API key is missing, wrong, or revoked. | Check the Authorization header. |
403 | The plan of the team does not include the API. | Upgrade the plan. |
404 | The team has nothing with this ID. | Check the ID. |
409 | The request is valid, but not possible right now: a limit of the plan is reached, the campaign is not a draft, or the person unsubscribed. | Read the message. Do not just try again. |
413 | The body is too large. | Stay under 512 KB. Use image URLs instead of embedded images. |
429 | Too many requests. | Wait and try again, see rate limits. |
500 | Something went wrong on our side. | Try again later. |
Rate limits
Each key can make 120 requests per minute. This keeps the API fast for everyone. Every answer tells you where you stand:
| Header | Meaning |
|---|---|
X-RateLimit-Limit | Requests allowed per minute. |
X-RateLimit-Remaining | Requests left in the current minute. |
X-RateLimit-Reset | Seconds until the current minute ends. |
Over the limit, the answer is 429 with a Retry-After header. It holds the number of seconds to wait before the next request.
Subscribers
A subscriber is a person who receives the newsletters of your team. An email address exists only once per team.
| Field | Type | Description |
|---|---|---|
id | string | The ID of the subscriber. |
email | string | The email address, always lower-case. |
firstName | string or null | The first name. |
lastName | string or null | The last name. |
origin | string | Where the subscriber came from. Set once, never changed. |
status | string | One of PENDING, ACTIVE, UNSUBSCRIBED, BOUNCED. Only active subscribers receive mails. |
customFields | object | Your own text values. Usable as variables in templates. |
consentAt | string | When the person signed up. |
confirmedAt | string or null | When the person confirmed the address (double opt-in). |
unsubscribedAt | string or null | When the person opted out. |
bouncedAt | string or null | When the address was rejected for good. |
bounceReason | string or null | The answer of the mail server that rejected the address. |
createdAt | string | When the subscriber was created. |
List subscribers
GET/api/v1/subscribers
Returns the subscribers of your team, newest first. Use the filters to narrow the list.
Query parameters
- pageinteger
- The page to return, starting at 1. Default: 1.
- limitinteger
- Subscribers per page, from 1 to 100. Default: 25.
- searchstring
- Matches the email, the first name, or the last name. Upper and lower case do not matter.
- statusstring
- Only subscribers with this status:
pending,active,unsubscribed, orbounced. - originstring
- Only subscribers with this origin.
- liststring
- Only subscribers in the list with this ID, by origin or by hand.
- emailstring
- Looks up one exact address. The other parameters are ignored. The list has one item, or none when the address is unknown.
curl "https://www.papelillo.io/api/v1/subscribers?status=active&origin=newsletter&limit=2" \
-H "Authorization: Bearer $API_KEY"{
"data": {
"items": [
{
"id": "5f0c2b1e-7a34-4d0b-9c59-2f1f7e0a9b11",
"teamId": "9b2d4f6a-1c3e-4a5b-8d7f-0e1a2b3c4d5e",
"email": "ada@example.com",
"firstName": "Ada",
"lastName": "Lovelace",
"origin": "newsletter",
"status": "ACTIVE",
"customFields": { "company": "Analytical Engines" },
"consentAt": "2026-06-01T08:30:00.000Z",
"confirmedAt": null,
"unsubscribedAt": null,
"bouncedAt": null,
"bounceReason": null,
"createdAt": "2026-06-01T08:30:00.000Z"
}
],
"page": 1,
"limit": 2,
"total": 1
}
}Add a subscriber
POST/api/v1/subscribers
Adds a subscriber. If the address already exists in your team, the subscriber is updated instead: names and custom fields you send are merged in, and the origin stays as it was. So you can call this endpoint on every signup without checking first.
A new active subscriber starts the automations that wait for "a subscriber joins". When double opt-in is on, the subscriber starts as PENDING and gets a confirmation mail first.
Body
- emailstringrequired
- The email address. At most 125 characters.
- firstNamestring
- The first name. At most 100 characters.
- lastNamestring
- The last name. At most 100 characters.
- originstring
- Where the subscriber came from. Letters, digits, spaces, dashes, and underscores, at most 60 characters. Default:
api. - customFieldsobject
- Up to 20 text values of at most 500 characters. A field name starts with a letter and has lower-case letters, digits, and underscores.
- confirmedboolean
- Send true when the person already confirmed the address on your side. This skips double opt-in.
- allowResubscribeboolean
- Send true to bring back a person who unsubscribed, bounced, or was deleted. Only do this when the person asked for it.
- ipstring
- The IP address the signup came from (IPv4 or IPv6). It is kept as proof of consent.
Returns
- subscriberobject
- The subscriber as it is now.
- createdboolean
- True for a new subscriber, false when an existing one was updated or brought back.
- confirmationSentboolean
- True when a confirmation mail was sent.
People who left stay out
allowResubscribe, an address that unsubscribed, bounced, or was deleted is answered with 409. This protects you from writing to people who said no.curl -X POST "https://www.papelillo.io/api/v1/subscribers" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"email": "ada@example.com",
"firstName": "Ada",
"lastName": "Lovelace",
"origin": "newsletter",
"customFields": { "company": "Analytical Engines" },
"ip": "203.0.113.7"
}'{
"data": {
"subscriber": {
"id": "5f0c2b1e-7a34-4d0b-9c59-2f1f7e0a9b11",
"teamId": "9b2d4f6a-1c3e-4a5b-8d7f-0e1a2b3c4d5e",
"email": "ada@example.com",
"firstName": "Ada",
"lastName": "Lovelace",
"origin": "newsletter",
"status": "ACTIVE",
"customFields": { "company": "Analytical Engines" },
"consentAt": "2026-06-01T08:30:00.000Z",
"confirmedAt": null,
"unsubscribedAt": null,
"bouncedAt": null,
"bounceReason": null,
"createdAt": "2026-06-01T08:30:00.000Z"
},
"created": true,
"confirmationSent": false
}
}Get a subscriber
GET/api/v1/subscribers/{id}
Returns one subscriber. Answers with 404 when your team has no subscriber with this ID.
curl "https://www.papelillo.io/api/v1/subscribers/5f0c2b1e-7a34-4d0b-9c59-2f1f7e0a9b11" \
-H "Authorization: Bearer $API_KEY"{
"data": {
"id": "5f0c2b1e-7a34-4d0b-9c59-2f1f7e0a9b11",
"teamId": "9b2d4f6a-1c3e-4a5b-8d7f-0e1a2b3c4d5e",
"email": "ada@example.com",
"firstName": "Ada",
"lastName": "Lovelace",
"origin": "newsletter",
"status": "ACTIVE",
"customFields": { "company": "Analytical Engines" },
"consentAt": "2026-06-01T08:30:00.000Z",
"confirmedAt": null,
"unsubscribedAt": null,
"bouncedAt": null,
"bounceReason": null,
"createdAt": "2026-06-01T08:30:00.000Z"
}
}Update a subscriber
PATCH/api/v1/subscribers/{id}
Changes the names or the custom fields. Fields you leave out stay as they are. The email and the origin cannot be changed.
Body
- firstNamestring or null
- The new first name. Send null to remove it.
- lastNamestring or null
- The new last name. Send null to remove it.
- customFieldsobject
- Replaces all custom fields. Send the full set you want to keep.
curl -X PATCH "https://www.papelillo.io/api/v1/subscribers/5f0c2b1e-7a34-4d0b-9c59-2f1f7e0a9b11" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"firstName": "Augusta",
"customFields": { "company": "Analytical Engines", "city": "London" }
}'{
"data": {
"id": "5f0c2b1e-7a34-4d0b-9c59-2f1f7e0a9b11",
"email": "ada@example.com",
"firstName": "Augusta",
"lastName": "Lovelace",
"customFields": { "company": "Analytical Engines", "city": "London" },
"status": "ACTIVE",
"...": "the other subscriber fields"
}
}Unsubscribe a subscriber
POST/api/v1/subscribers/{id}/unsubscribe
Opts a subscriber out, for example when the person asked for it in your own app. The subscriber stays in your list with the status UNSUBSCRIBED and receives no more newsletters.
No body is needed.
curl -X POST "https://www.papelillo.io/api/v1/subscribers/5f0c2b1e-7a34-4d0b-9c59-2f1f7e0a9b11/unsubscribe" \
-H "Authorization: Bearer $API_KEY"{
"data": {
"id": "5f0c2b1e-7a34-4d0b-9c59-2f1f7e0a9b11",
"email": "ada@example.com",
"status": "UNSUBSCRIBED",
"unsubscribedAt": "2026-06-20T14:05:00.000Z",
"...": "the other subscriber fields"
}
}Delete a subscriber
DELETE/api/v1/subscribers/{id}
Deletes a subscriber and the personal data. An unreadable hash of the address is kept, so the person is not added again by mistake. To add the person again on request, send allowResubscribe when you add them.
curl -X DELETE "https://www.papelillo.io/api/v1/subscribers/5f0c2b1e-7a34-4d0b-9c59-2f1f7e0a9b11" \
-H "Authorization: Bearer $API_KEY"{
"data": { "deleted": true }
}Lists
A list groups subscribers, so a campaign can go to some of them. A subscriber gets into a list in two ways: by origin, or by hand.
- By origin: everyone with one of the origins of the list is in it, also people who subscribe later.
- By hand: you put single subscribers in, whatever their origin.
| Field | Type | Description |
|---|---|---|
id | string | The ID of the list. |
name | string | The name, up to 100 characters. A name exists only once per team. |
origins | array of strings | The origins whose subscribers are in the list by themselves. May be empty. |
memberCount | integer | Subscribers that were put in by hand, whatever their status. |
activeCount | integer | Active subscribers in the list, by origin or by hand. Each one is counted once. These get a campaign that goes to the list. |
createdAt | string | When the list was created. |
To send to lists, use the audience { "type": "lists", "listIds": ["..."] } of a campaign. A team can have up to 100 lists.
List the lists
GET/api/v1/lists
Returns every list of your team, ordered by name. There are no pages.
curl "https://www.papelillo.io/api/v1/lists" \
-H "Authorization: Bearer $API_KEY"{
"data": {
"items": [
{
"id": "3c1d9a70-52be-4c0e-a1f6-7d8e9f0a1b2c",
"teamId": "9b2d4f6a-1c3e-4a5b-8d7f-0e1a2b3c4d5e",
"name": "Webinar guests",
"origins": ["webinar"],
"memberCount": 2,
"activeCount": 48,
"createdAt": "2026-06-01T08:30:00.000Z"
}
],
"total": 1
}
}Create a list
POST/api/v1/lists
Creates a list. Leave out the origins for a list that only holds hand-picked subscribers.
Body
- namestringrequired
- The name of the list. A name that is taken answers with 409.
- originsarray of strings
- Up to 50 origins. Default: none.
curl -X POST "https://www.papelillo.io/api/v1/lists" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Webinar guests",
"origins": ["webinar"]
}'{
"data": {
"id": "3c1d9a70-52be-4c0e-a1f6-7d8e9f0a1b2c",
"teamId": "9b2d4f6a-1c3e-4a5b-8d7f-0e1a2b3c4d5e",
"name": "Webinar guests",
"origins": ["webinar"],
"memberCount": 2,
"activeCount": 48,
"createdAt": "2026-06-01T08:30:00.000Z"
}
}Get a list
GET/api/v1/lists/{listId}
Returns one list with its counts.
curl "https://www.papelillo.io/api/v1/lists/3c1d9a70-52be-4c0e-a1f6-7d8e9f0a1b2c" \
-H "Authorization: Bearer $API_KEY"{
"data": {
"id": "3c1d9a70-52be-4c0e-a1f6-7d8e9f0a1b2c",
"teamId": "9b2d4f6a-1c3e-4a5b-8d7f-0e1a2b3c4d5e",
"name": "Webinar guests",
"origins": ["webinar"],
"memberCount": 2,
"activeCount": 48,
"createdAt": "2026-06-01T08:30:00.000Z"
}
}Update a list
PATCH/api/v1/lists/{listId}
Changes the name or the origins. Fields you leave out stay as they are.
Body
- namestring
- The new name.
- originsarray of strings
- The new origins. They replace the old ones.
curl -X PATCH "https://www.papelillo.io/api/v1/lists/3c1d9a70-52be-4c0e-a1f6-7d8e9f0a1b2c" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{ "origins": ["webinar", "workshop"] }'{
"data": {
"id": "3c1d9a70-52be-4c0e-a1f6-7d8e9f0a1b2c",
"teamId": "9b2d4f6a-1c3e-4a5b-8d7f-0e1a2b3c4d5e",
"name": "Webinar guests",
"origins": ["webinar", "workshop"],
"memberCount": 2,
"activeCount": 48,
"createdAt": "2026-06-01T08:30:00.000Z"
}
}Delete a list
DELETE/api/v1/lists/{listId}
Deletes the list. Its subscribers stay. A draft campaign that goes to the list loses it as a recipient.
curl -X DELETE "https://www.papelillo.io/api/v1/lists/3c1d9a70-52be-4c0e-a1f6-7d8e9f0a1b2c" \
-H "Authorization: Bearer $API_KEY"{
"data": { "deleted": true }
}List the subscribers of a list
GET/api/v1/lists/{listId}/subscribers
Returns the subscribers in the list, by origin or by hand, in every status. The items have the fields of a subscriber. The same list comes from GET /subscribers?list={listId}, where you can add the other filters.
Query parameters
- pageinteger
- The page to return, starting at 1. Default: 1.
- limitinteger
- Subscribers per page, from 1 to 100. Default: 25.
curl "https://www.papelillo.io/api/v1/lists/3c1d9a70-52be-4c0e-a1f6-7d8e9f0a1b2c/subscribers?limit=25" \
-H "Authorization: Bearer $API_KEY"{
"data": {
"items": [ { "id": "5f0c2b1e-7a34-4d0b-9c59-2f1f7e0a9b11", "email": "ada@example.com", "...": "..." } ],
"page": 1,
"limit": 25,
"total": 50
}
}Add subscribers to a list
POST/api/v1/lists/{listId}/subscribers
Puts existing subscribers in the list by hand. Name them by address, by ID, or both. Someone who is in the list already stays as they are. This does not create subscribers: add them first.
Body
- emailsarray of strings
- Up to 1,000 addresses of subscribers.
- subscriberIdsarray of strings
- Up to 1,000 IDs of subscribers.
Answer
- changedinteger
- How many subscribers were put in. Those already in it do not count.
- unknownarray of strings
- The addresses and IDs your team has no subscriber for.
curl -X POST "https://www.papelillo.io/api/v1/lists/3c1d9a70-52be-4c0e-a1f6-7d8e9f0a1b2c/subscribers" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"emails": ["ada@example.com", "nobody@example.com"],
"subscriberIds": ["5f0c2b1e-7a34-4d0b-9c59-2f1f7e0a9b11"]
}'{
"data": {
"changed": 2,
"unknown": ["nobody@example.com"]
}
}Remove subscribers from a list
POST/api/v1/lists/{listId}/subscribers/remove
Takes subscribers out of the list. The body and the answer are the same as for adding. The subscribers themselves stay.
Only hand-picked subscribers can be removed
curl -X POST "https://www.papelillo.io/api/v1/lists/3c1d9a70-52be-4c0e-a1f6-7d8e9f0a1b2c/subscribers/remove" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{ "emails": ["ada@example.com"] }'{
"data": {
"changed": 1,
"unknown": []
}
}Templates
A template is the design of a mail: a name, a subject, a preview text, and a document. Campaigns copy a template. Automations and single mails use it live.
The template document
The content of a template is a JSON document. It has a format version (always 1), a theme for the look, and a list of blocks from top to bottom. There is no HTML: we build the HTML and the plain-text version of the mail from the blocks.
{
"version": 1,
"theme": {
"width": 600,
"font": "system",
"fontSize": 16,
"backgroundColor": "#f3f4f6",
"contentColor": "#ffffff",
"textColor": "#0f172a",
"linkColor": "#ea5b27",
"mutedColor": "#6b7280"
},
"blocks": [
{ "id": "title", "type": "heading", "text": "Welcome to {{team_name}}!", "level": 1, "align": "center" },
{ "id": "hello", "type": "paragraph", "text": "Hello {{first_name|friend}},\nthank you for **subscribing**.", "align": "left" },
{ "id": "cta", "type": "button", "label": "Read the first issue", "href": "https://example.com/issue-1", "align": "center", "color": null },
{ "id": "foot", "type": "footer", "text": "You receive this mail because you subscribed to our newsletter." }
]
}Theme
All eight fields are required.
| Field | Type | Description |
|---|---|---|
width | integer | Width of the content in pixels, from 320 to 800. |
font | string | system (sans-serif), serif, or mono. |
fontSize | integer | Size of the body text in pixels, from 12 to 22. |
backgroundColor | string | Colour of the page around the content. |
contentColor | string | Colour of the content area. |
textColor | string | Colour of the body text. |
linkColor | string | Colour of links, and of buttons without their own colour. |
mutedColor | string | Colour of the footer text and of dividers. |
Colours are written as six hex digits, for example #ea5b27.
Blocks
Every block has an id and a type. The ID is your choice (letters, digits, dashes, underscores, at most 40 characters) and must be used only once in a document. All fields of a block are required; where a value can be left empty, send null.
| Type | Fields |
|---|---|
heading | text, level (1, 2, or 3), align |
paragraph | text (line breaks are kept), align |
list | ordered (true for numbers, false for bullets), items (1 to 50 texts) |
image | src, alt, width (pixels or null), align, href (link or null), rounded (true for a circle) |
button | label, href, align, color (hex colour or null) |
divider | image: null for a plain line, or an object with src, alt, size (16 to 160), rounded |
spacer | height in pixels, from 4 to 200 |
table | header (true when the first row is a header), bordered, rows (up to 50 rows of up to 8 texts, all rows the same length) |
columns | verticalAlign (top or middle), gap (0 to 64), columns: 2 or 3 objects with id, width (pixels or null), blocks |
footer | text. The unsubscribe link is always added after it. Only one footer per document. |
align is left, center, or right. A column can hold every block except columns and footer.
Text formatting and variables
Texts of headings, paragraphs, list items, table cells, and the footer understand a small syntax:
| Syntax | Result |
|---|---|
**bold** | Bold text |
*italic* | Italic text |
[label](https://example.com) | A link |
{{first_name}} | A variable |
{{first_name|friend}} | A variable with a fallback for when it has no value |
Every mail knows these variables: first_name, last_name, full_name, email, origin, team_name, and unsubscribe_url. The custom fields of the subscriber, the data of an event, and the variables of a single mail are available by their name. Variables also work in the subject, the preview text, and in links.
Limits
- Up to 100 blocks per document and 20 blocks per column.
- A text has at most 5,000 characters, a link at most 2,000.
- Links start with
https://,http://, ormailto:. - An image is an
https://URL, or a base64 data URL of a PNG, JPEG, or GIF with at most 50 KB. All embedded images of a document together have at most 100 KB. - A request body has at most 512 KB.
List templates
GET/api/v1/templates
Returns the templates of your team without their content. Get one template to read its document.
Query parameters
- pageinteger
- The page to return, starting at 1. Default: 1.
- limitinteger
- Templates per page, from 1 to 100. Default: 25.
- searchstring
- Only templates that match this text.
curl "https://www.papelillo.io/api/v1/templates?search=welcome" \
-H "Authorization: Bearer $API_KEY"{
"data": {
"items": [
{
"id": "c1a7e2d4-3b5f-4e6a-8b9c-0d1e2f3a4b5c",
"name": "Welcome mail",
"subject": "Welcome, {{first_name|friend}}!",
"updatedAt": "2026-06-01T08:00:00.000Z"
}
],
"page": 1,
"limit": 25,
"total": 1
}
}Create a template
POST/api/v1/templates
Creates a template from a JSON document. The document is checked completely before it is saved.
Body
- namestringrequired
- The name shown in the app. At most 100 characters.
- subjectstringrequired
- The subject line. At most 200 characters, one line. May contain variables.
- previewTextstring
- The text shown next to the subject in the inbox. At most 200 characters.
- documentobjectrequired
- The content, see the template document.
curl -X POST "https://www.papelillo.io/api/v1/templates" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Welcome mail",
"subject": "Welcome, {{first_name|friend}}!",
"previewText": "Nice to have you here.",
"document": {
"version": 1,
"theme": {
"width": 600, "font": "system", "fontSize": 16,
"backgroundColor": "#f3f4f6", "contentColor": "#ffffff",
"textColor": "#0f172a", "linkColor": "#ea5b27", "mutedColor": "#6b7280"
},
"blocks": [
{ "id": "hello", "type": "paragraph", "text": "Hello {{first_name|friend}},", "align": "left" },
{ "id": "foot", "type": "footer", "text": "You subscribed to our newsletter." }
]
}
}'{
"data": {
"id": "c1a7e2d4-3b5f-4e6a-8b9c-0d1e2f3a4b5c",
"teamId": "9b2d4f6a-1c3e-4a5b-8d7f-0e1a2b3c4d5e",
"name": "Welcome mail",
"subject": "Welcome, {{first_name|friend}}!",
"previewText": "Nice to have you here.",
"document": { "version": 1, "theme": { "...": "..." }, "blocks": [ "..." ] },
"createdAt": "2026-06-01T08:00:00.000Z",
"updatedAt": "2026-06-01T08:00:00.000Z"
}
}Get a template
GET/api/v1/templates/{id}
Returns one template with its full document. Answers with 404 when your team has no template with this ID.
curl "https://www.papelillo.io/api/v1/templates/c1a7e2d4-3b5f-4e6a-8b9c-0d1e2f3a4b5c" \
-H "Authorization: Bearer $API_KEY"{
"data": {
"id": "c1a7e2d4-3b5f-4e6a-8b9c-0d1e2f3a4b5c",
"teamId": "9b2d4f6a-1c3e-4a5b-8d7f-0e1a2b3c4d5e",
"name": "Welcome mail",
"subject": "Welcome, {{first_name|friend}}!",
"previewText": "Nice to have you here.",
"document": { "version": 1, "theme": { "...": "..." }, "blocks": [ "..." ] },
"createdAt": "2026-06-01T08:00:00.000Z",
"updatedAt": "2026-06-01T08:00:00.000Z"
}
}Update a template
PATCH/api/v1/templates/{id}
Changes a template. Send only the fields you want to change. A document is always replaced as a whole.
Campaigns that were already created keep their own copy and do not change. Automations use the new version from the next mail on.
Body
- namestring
- The new name.
- subjectstring
- The new subject line.
- previewTextstring
- The new preview text.
- documentobject
- The new content, as a complete document.
curl -X PATCH "https://www.papelillo.io/api/v1/templates/c1a7e2d4-3b5f-4e6a-8b9c-0d1e2f3a4b5c" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{ "subject": "A warm welcome, {{first_name|friend}}!" }'{
"data": {
"id": "c1a7e2d4-3b5f-4e6a-8b9c-0d1e2f3a4b5c",
"name": "Welcome mail",
"subject": "A warm welcome, {{first_name|friend}}!",
"updatedAt": "2026-06-20T14:05:00.000Z",
"...": "the other template fields"
}
}Delete a template
DELETE/api/v1/templates/{id}
Deletes a template. Campaigns keep their copy. Automations that use the template stop sending until they get a new one.
curl -X DELETE "https://www.papelillo.io/api/v1/templates/c1a7e2d4-3b5f-4e6a-8b9c-0d1e2f3a4b5c" \
-H "Authorization: Bearer $API_KEY"{
"data": { "deleted": true }
}Campaigns
A campaign sends one mail to many subscribers. It is created as a draft from a template and gets its own copy of the content. Nothing is sent until you call the send endpoint.
Status
| Status | Meaning | Allowed |
|---|---|---|
DRAFT | Being written. Nothing is queued. | Update, send, delete |
SCHEDULED | Starts at its planned time. | Cancel |
SENDING | The mails are going out in batches. | Cancel |
PAUSED | Sending stopped and can be resumed in the app. | Cancel |
SENT | Every recipient was handled. | Delete |
CANCELLED | Stopped for good. | Delete |
Audience
The audience says who gets the campaign. Only active subscribers receive it. It has one of four shapes:
| Shape | Who gets the mail |
|---|---|
{ "type": "all" } | Every active subscriber. This is the default. |
{ "type": "origins", "origins": ["newsletter"] } | Active subscribers with one of up to 50 origins. |
{ "type": "lists", "listIds": ["..."] } | Active subscribers of one or more lists. Someone who is in several of them gets the mail once. |
{ "type": "subscribers", "subscriberIds": ["..."] } | Up to 1,000 subscribers, chosen by ID. |
List campaigns
GET/api/v1/campaigns
Returns the campaigns of your team without their content, newest first.
Query parameters
- pageinteger
- The page to return, starting at 1. Default: 1.
- limitinteger
- Campaigns per page, from 1 to 100. Default: 25.
- searchstring
- Matches the name or the subject. Upper and lower case do not matter.
- statusstring
- Only campaigns with this status, for example
draftorsent.
curl "https://www.papelillo.io/api/v1/campaigns?status=draft" \
-H "Authorization: Bearer $API_KEY"{
"data": {
"items": [
{
"id": "e4b8a1c2-6d7f-4a3b-9c0d-1e2f3a4b5c6d",
"name": "June news",
"subject": "What is new in June",
"status": "DRAFT",
"scheduledAt": null,
"startedAt": null,
"completedAt": null,
"recipientCount": 0,
"createdAt": "2026-06-10T09:00:00.000Z"
}
],
"page": 1,
"limit": 25,
"total": 1
}
}Create a campaign
POST/api/v1/campaigns
Creates a draft from a template. The subject, the preview text, and the document are copied from the template. You can set other values for this campaign in the same request.
Body
- namestringrequired
- The name shown in the app. At most 100 characters.
- templateIdstringrequired
- The template to copy the content from.
- subjectstring
- A subject line for this campaign.
- previewTextstring
- A preview text for this campaign.
- documentobject
- Content for this campaign, as a complete template document.
- mailConnectionIdstring or null
- The mail connection to send through. Null, or left out, uses the default connection of the team.
- audienceobject
- Who gets the campaign. Default: every active subscriber.
curl -X POST "https://www.papelillo.io/api/v1/campaigns" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "June news",
"templateId": "c1a7e2d4-3b5f-4e6a-8b9c-0d1e2f3a4b5c",
"subject": "What is new in June",
"previewText": "Three short updates.",
"audience": { "type": "origins", "origins": ["newsletter"] }
}'{
"data": {
"id": "e4b8a1c2-6d7f-4a3b-9c0d-1e2f3a4b5c6d",
"teamId": "9b2d4f6a-1c3e-4a5b-8d7f-0e1a2b3c4d5e",
"name": "June news",
"subject": "What is new in June",
"previewText": "Three short updates.",
"document": { "version": 1, "theme": { "...": "..." }, "blocks": [ "..." ] },
"mailConnectionId": null,
"audience": { "type": "origins", "origins": ["newsletter"] },
"status": "DRAFT",
"scheduledAt": null,
"startedAt": null,
"completedAt": null,
"pausedReason": null,
"recipientCount": 0,
"createdAt": "2026-06-10T09:00:00.000Z",
"updatedAt": "2026-06-10T09:00:00.000Z"
}
}Get a campaign
GET/api/v1/campaigns/{id}
Returns one campaign with its content and its report. Use it to follow a campaign while it is sending.
The report
- counts.totalinteger
- All mails of the campaign.
- counts.queuedinteger
- Mails that are still waiting.
- counts.sentinteger
- Mails the mail provider accepted.
- counts.failedinteger
- Mails that could not be sent.
- counts.skippedinteger
- Mails that were left out on purpose, for example because the person unsubscribed in the meantime.
- unsubscribedinteger
- Recipients who unsubscribed since the campaign started.
curl "https://www.papelillo.io/api/v1/campaigns/e4b8a1c2-6d7f-4a3b-9c0d-1e2f3a4b5c6d" \
-H "Authorization: Bearer $API_KEY"{
"data": {
"id": "e4b8a1c2-6d7f-4a3b-9c0d-1e2f3a4b5c6d",
"teamId": "9b2d4f6a-1c3e-4a5b-8d7f-0e1a2b3c4d5e",
"name": "June news",
"subject": "What is new in June",
"previewText": "Three short updates.",
"document": { "version": 1, "theme": { "...": "..." }, "blocks": [ "..." ] },
"mailConnectionId": null,
"audience": { "type": "origins", "origins": ["newsletter"] },
"status": "SENT",
"scheduledAt": null,
"startedAt": "2026-06-15T09:00:00.000Z",
"completedAt": "2026-06-15T09:42:00.000Z",
"pausedReason": null,
"recipientCount": 1200,
"report": {
"counts": { "total": 1200, "queued": 0, "sent": 1193, "failed": 4, "skipped": 3 },
"unsubscribed": 6
},
"createdAt": "2026-06-10T09:00:00.000Z",
"updatedAt": "2026-06-10T09:00:00.000Z"
}
}Update a campaign
PATCH/api/v1/campaigns/{id}
Changes a draft. Send only the fields you want to change. A campaign that is not a draft any more answers with 409.
Body
- namestring
- The new name.
- subjectstring
- The new subject line.
- previewTextstring
- The new preview text.
- documentobject
- The new content, as a complete template document.
- mailConnectionIdstring or null
- The mail connection to send through. Null uses the default connection.
- audienceobject
- Who gets the campaign.
curl -X PATCH "https://www.papelillo.io/api/v1/campaigns/e4b8a1c2-6d7f-4a3b-9c0d-1e2f3a4b5c6d" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"subject": "Your June update",
"audience": { "type": "all" }
}'{
"data": {
"id": "e4b8a1c2-6d7f-4a3b-9c0d-1e2f3a4b5c6d",
"name": "June news",
"subject": "Your June update",
"audience": { "type": "all" },
"status": "DRAFT",
"...": "the other campaign fields"
}
}Send or schedule a campaign
POST/api/v1/campaigns/{id}/send
Sends a draft. Without a body, sending starts right away and the status becomes SENDING. With scheduledAt, the status becomes SCHEDULED and sending starts at that time.
The mails go out in batches, so a big campaign takes a while. Read the campaign to see how far it is.
Body
- scheduledAtstring
- When to start, as an ISO 8601 date and time in the future, at most 365 days ahead. The start can be up to 15 minutes late.
When sending is refused
409 when the campaign is not a draft, the team has no mail connection, the audience has no active subscriber, or the plan has not enough mails left this month.# Send now
curl -X POST "https://www.papelillo.io/api/v1/campaigns/e4b8a1c2-6d7f-4a3b-9c0d-1e2f3a4b5c6d/send" \
-H "Authorization: Bearer $API_KEY"
# Or send later
curl -X POST "https://www.papelillo.io/api/v1/campaigns/e4b8a1c2-6d7f-4a3b-9c0d-1e2f3a4b5c6d/send" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{ "scheduledAt": "2026-06-15T09:00:00Z" }'{
"data": {
"id": "e4b8a1c2-6d7f-4a3b-9c0d-1e2f3a4b5c6d",
"name": "June news",
"status": "SCHEDULED",
"scheduledAt": "2026-06-15T09:00:00.000Z",
"recipientCount": 0,
"...": "the other campaign fields"
}
}Cancel a campaign
POST/api/v1/campaigns/{id}/cancel
Stops a scheduled, sending, or paused campaign for good. Recipients who are still waiting get nothing. Mails that already went out cannot be taken back.
No body is needed.
curl -X POST "https://www.papelillo.io/api/v1/campaigns/e4b8a1c2-6d7f-4a3b-9c0d-1e2f3a4b5c6d/cancel" \
-H "Authorization: Bearer $API_KEY"{
"data": {
"id": "e4b8a1c2-6d7f-4a3b-9c0d-1e2f3a4b5c6d",
"name": "June news",
"status": "CANCELLED",
"...": "the other campaign fields"
}
}Delete a campaign
DELETE/api/v1/campaigns/{id}
Deletes a draft, a sent campaign, or a cancelled campaign. A campaign that is scheduled, sending, or paused must be cancelled first.
curl -X DELETE "https://www.papelillo.io/api/v1/campaigns/e4b8a1c2-6d7f-4a3b-9c0d-1e2f3a4b5c6d" \
-H "Authorization: Bearer $API_KEY"{
"data": { "deleted": true }
}Events
An event tells us that something happened to a subscriber in your own system, for example a purchase. Automations with the trigger "custom event" wait for an event name and send their template when it arrives.
You set up the automation once in the app. After that, your system only has to report the event.
Fire an event
POST/api/v1/events
Fires an event for one subscriber. Every active automation that waits for this event queues its mail, right away or after its delay.
Body
- eventstringrequired
- The name of the event. Starts with a letter and has letters, digits, dots, dashes, and underscores, at most 60 characters. Upper and lower case do not matter.
- emailstringrequired
- The address of the subscriber the event is about. The subscriber must be active.
- dataobject
- Up to 20 text values of at most 500 characters. The template can use them as variables, for example
{{order_number}}.
Returns
- queuedinteger
- How many automations queued a mail. Zero means no active automation waits for this event.
The subscriber must exist
404, a subscriber who is not active with 409. Add the subscriber first when you are not sure.curl -X POST "https://www.papelillo.io/api/v1/events" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"event": "order.completed",
"email": "ada@example.com",
"data": {
"order_number": "A-1042",
"product": "Starter kit"
}
}'{
"data": { "queued": 1 }
}Single mails
Some mails are not newsletters: an order confirmation, a download link, a password hint. For these, you can send one template to one address.
The address does not have to be a subscriber. Because of that, the mail has no unsubscribe link. Use this endpoint only for mails a person expects, never for advertising.
Send one mail
POST/api/v1/send
Sends one template to one address. We try to send the mail at once. If that does not work, the mail waits in the queue and is tried again.
The mail counts toward the monthly mails of your plan.
Body
- templateIdstringrequired
- The template to send.
- tostringrequired
- The address the mail goes to.
- variablesobject
- Up to 30 text values of at most 500 characters for the variables of the template. A name starts with a letter and has lower-case letters, digits, and underscores.
- mailConnectionIdstring or null
- The mail connection to send through. Null, or left out, uses the default connection of the team.
Use your own variable names
first_name, last_name, full_name, origin, email, team_name, unsubscribe_url) are filled by us and cannot be set here. For an address that is no subscriber, the name variables are empty. Pick names of your own, such as customer_name.Returns
- deliveryIdstring
- The ID of the mail in the send queue.
- sentboolean
- True when the mail provider already accepted the mail. False when it waits in the queue for another try.
curl -X POST "https://www.papelillo.io/api/v1/send" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"templateId": "c1a7e2d4-3b5f-4e6a-8b9c-0d1e2f3a4b5c",
"to": "grace@example.com",
"variables": {
"customer_name": "Grace",
"order_number": "A-1042"
}
}'{
"data": {
"deliveryId": "7d6c5b4a-3f2e-4d1c-8b0a-9f8e7d6c5b4a",
"sent": true
}
}