# Authentication
Source: https://docs.zaymo.com/api-reference/authentication
How to authenticate requests from Zaymo
## Authentication
All API endpoints should be secured using API key authentication. You will provide Zaymo with an API key, and Zaymo will attach it to all requests to your API using the following header:
### API Key Header
Your API should validate that all requests from Zaymo include the API key in the `X-Zaymo-API-Key` header. If the header is missing or invalid, your API should return a `401 Unauthorized` response.
```bash theme={null}
X-Zaymo-API-Key: YOUR_PROVIDED_API_KEY
```
### API Key Security Requirements
Keep your API key secure and implement proper validation. Reject any requests that don't include a valid API key in the `X-Zaymo-API-Key` header.
Your implementation should:
* Validate that the `X-Zaymo-API-Key` header is present in every request
* Verify that the provided API key matches the one you've given to Zaymo
* Return a `401 Unauthorized` response for requests with missing or invalid API keys
### Example Request with Authentication
When Zaymo makes a request to your API, it will look something like this:
```bash theme={null}
curl -X POST https://api.yourdomain.com/zaymo/upsells/add-product \
-H "X-Zaymo-API-Key: YOUR_PROVIDED_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"email": "customer@example.com",
"product_id": "prod_67890"
}'
```
# Execute Custom Action
Source: https://docs.zaymo.com/api-reference/custom-actions/execute-custom-action
/openapi.json post /zaymo/custom-action
Execute a custom action when a customer clicks a custom button in email. Receives the customer's email and the action ID to process any custom business logic.
# Delay Subscription
Source: https://docs.zaymo.com/api-reference/customer-portal/delay-subscription
/openapi.json post /zaymo/customer-portal/delay
Postpone the customer's next subscription billing and shipment to a new date. This endpoint is required for the 'Delay Subscription' button to be shown in the customer portal.
# Get Current Subscription
Source: https://docs.zaymo.com/api-reference/customer-portal/get-current-subscription
/openapi.json get /zaymo/customer-portal/subscription
Retrieve the customer's current active subscription details including billing information and items. If the customer has multiple subscriptions, we recommend returning the next upcoming subscription.
# Send Subscription Now
Source: https://docs.zaymo.com/api-reference/customer-portal/send-subscription-now
/openapi.json post /zaymo/customer-portal/send-now
Trigger immediate processing and shipment of the customer's next upcoming subscription order. This endpoint is required for the 'Send Now' button to be shown in the customer portal.
# Get Discount
Source: https://docs.zaymo.com/api-reference/discounts/get-discount
/openapi.json get /zaymo/discounts/get-discount
Retrieve discount information for a given discount code. This endpoint is necessary to support discounts in the add product and reactivate endpoints. Zaymo calls this endpoint to validate discount codes and retrieve the discount type and amount before applying them to products or subscriptions.
# Overview
Source: https://docs.zaymo.com/api-reference/overview
How to build an API for integrating with Zaymo
## API Implementation Guide
This documentation outlines the API endpoints that you, as a Zaymo partner, need to implement on your server. Zaymo will make requests to these endpoints to enable in-email purchase functionality for your customers.
## Base URL
You will need to provide Zaymo with the base URL of your API implementation. This is the domain where you'll host these endpoints, for example:
```
https://api.yourdomain.com
```
When Zaymo makes requests to your API, we will append specific paths to your base URL. For example, if your base URL is `https://api.yourdomain.com`, we would make requests to endpoints like:
```
https://api.yourdomain.com/zaymo/upsell
```
All API endpoints in this documentation will follow this pattern, with `/zaymo/` as the prefix for all Zaymo-related routes.
## Authentication
All API endpoints should require authentication using an API key header. For detailed information about implementing authentication, see the [Authentication](/api-reference/authentication) page.
## Response Format
Your API responses should be returned in JSON format. A typical successful response should have the following structure:
```json theme={null}
{
"success": true,
"data": {
// Response data specific to the endpoint
}
}
```
## Error Handling
When an error occurs, your API should return an appropriate HTTP status code along with a JSON response containing error details:
```json theme={null}
{
"success": false,
"error": {
"code": "invalid_request",
"message": "A descriptive error message",
}
}
```
## Rate Limits
If you implement rate limiting on your API, please inform Zaymo of your limits so we can optimize our requests accordingly.
If you have any questions or need assistance with your API implementation, please contact our support team at [support@zaymo.com](mailto:support@zaymo.com).
# Get Cancelled Subscriptions
Source: https://docs.zaymo.com/api-reference/reactivate/get-cancelled-subscriptions
/openapi.json get /zaymo/reactivate/cancelled-subscriptions
Retrieve a list of the customer's cancelled subscriptions that are eligible for reactivation. Subscriptions will be displayed in the order they are returned by this endpoint.
# Reactivate Cancelled Subscription
Source: https://docs.zaymo.com/api-reference/reactivate/reactivate-cancelled-subscription
/openapi.json post /zaymo/reactivate/subscription
Reactivate a previously cancelled subscription for the customer.
# Swap Subscription Product
Source: https://docs.zaymo.com/api-reference/swap-up/swap-subscription-product
/openapi.json post /zaymo/customer-portal/swap-product
Swap one of the customer's current subscription items to a new product. The current item should come from GET /zaymo/customer-portal/subscription -> items[].id, and the new product should come from GET /zaymo/upsells/products. An optional discount code may be applied during the swap.
# Add Product
Source: https://docs.zaymo.com/api-reference/upsells/add-product
/openapi.json post /zaymo/upsells/add-product
Add a product to a customer's order directly from email. This endpoint processes a customer's product selection from the email upsell widget.
# Get Products
Source: https://docs.zaymo.com/api-reference/upsells/get-products
/openapi.json get /zaymo/upsells/products
Retrieve product information for in-email product blocks. This endpoint should support two modes:
- **Without `email` parameter**: Return all available products. These are your general/default product recommendations shown to any customer.
- **With `email` parameter**: Return personalized products tailored to the specific customer. Use the customer's purchase history, preferences, or any other data to curate a relevant product list.
In both cases, the response format is the same — only the product selection should differ.
# Undo Add Product (Optional)
Source: https://docs.zaymo.com/api-reference/upsells/undo-add-product-optional
/openapi.json post /zaymo/upsells/undo-add-product
Remove a product from a customer's order that was previously added using the add-product endpoint. Implementation of this endpoint is optional - if not implemented, customers will not be able to undo their purchases in the email upsell widget.
# Introduction
Source: https://docs.zaymo.com/introduction
Welcome to Zaymo API Documentation
## What is Zaymo?
Zaymo enables brands to sell directly within email and execute custom actions, creating a frictionless experience that drives higher conversion rates and increases customer lifetime value. Our in-email functionality allows customers to complete transactions, manage subscriptions, and interact with custom buttons without leaving their inbox, reducing the steps to purchase and eliminating common checkout barriers.
## Why integrate with Zaymo?
Our partners see 25-80% higher conversion rates compared to traditional email links.
One-click upsells directly in email increase average order value by 15-30%.
Customers complete purchases in seconds without leaving their inbox.
Simple API endpoints make integration quick and straightforward.
## Success Stories
Our partners have seen remarkable results after implementing Zaymo:
* **Health & Wellness Brand**: 5x ROI from one-click upsells, with 83% performance improvement over traditional email methods
* **Supplement Brand**: Decreased subscriber churn by 24% using Zaymo's in-email subscription management tools
* **Medical Supply Company**: 25% increase in post-purchase orders through in-email upsells
## Getting Started
Integrating with Zaymo is simple. Our API allows you to implement various use cases based on your business needs:
Allow customers to add products directly from email
Let subscribers manage their subscriptions without leaving email
Make it easy for customers to reactivate cancelled subscriptions
Connect any endpoint to enable custom actions directly from email
Ready to get started? Explore our [use cases](/use-cases/product-upsells) or dive into the [API reference](/api-reference/overview).
# Custom Button (NEW)
Source: https://docs.zaymo.com/use-cases/custom-button
Connect any endpoint to enable custom actions directly from email
The Custom Button widget allows you to connect any endpoint to a button in your emails, enabling customers to perform any custom action directly from their inbox with just one click.
## Use Cases
The Custom Button widget is incredibly flexible and can be used for various scenarios. You can use any `action_id` that makes sense for your business - the examples below are just suggestions:
* **Claim a Discount** (e.g., `action_id: "claim_discount_10off"`) - Apply discounts to customer accounts
* **Join a Waitlist** (e.g., `action_id: "join_waitlist_product_123"`) - Add customers to product waitlists
* **Claim a Gift** (e.g., `action_id: "claim_birthday_gift"`) - Redeem promotional items or gifts
* **Swap to Quarterly** (e.g., `action_id: "change_to_quarterly"`) - Switch billing cycles or subscription plans
## How It Works
1. Customer receives an email with a custom action button
2. Customer clicks the button to trigger the action
3. Zaymo calls your custom endpoint with the customer's email and action ID
4. Your endpoint processes the action and returns a response
5. Customer receives instant feedback without leaving their email
## Required Endpoints
| Endpoint | Purpose | Required |
| ---------------------------------------------------------------------------- | ------------------------------------------------ | -------- |
| [Execute Custom Action](/api-reference/custom-actions/execute-custom-action) | Process the custom action when button is clicked | Yes |
## Getting Started
The Custom Button widget provides maximum flexibility for creating unique in-email experiences tailored to your specific business needs. When a customer clicks your custom button, Zaymo will call your endpoint with:
* **email**: The email address of the customer who clicked the button
* **action\_id**: A unique identifier for the specific action taken
Your endpoint can then process this information however you need and return a success or failure response to the customer.
# Product Upsells
Source: https://docs.zaymo.com/use-cases/product-upsells
Allow customers to purchase products directly from email
The Product Upsells widget allows customers to purchase products or add them to subscriptions directly from an email with just one click, without ever leaving their inbox.
## How It Works
1. Customer receives an email with an embedded product block
2. Customer selects a product and clicks to purchase
3. The product is instantly purchased or added to their subscription
4. Customer receives confirmation without ever leaving their email
## Required Endpoints
| Endpoint | Purpose | Required |
| ----------------------------------------------------------- | -------------------------------------------------------- | -------- |
| [Get Products](/api-reference/upsells/get-products) | Retrieve product information to display in email | Yes |
| [Add Product](/api-reference/upsells/add-product) | Process the customer's purchase or subscription addition | Yes |
| [Undo Add Product](/api-reference/upsells/undo-add-product) | Remove a product that was previously added | No |
## Getting Started
Ready to implement Product Upsells? This widget typically provides the quickest path to value for most businesses.
Explore our API documentation
Learn how to authenticate your API requests
# Reactivate
Source: https://docs.zaymo.com/use-cases/reactivate
Help customers reactivate cancelled subscriptions from email
The Reactivate widget makes it easy for customers to reactivate cancelled subscriptions directly from email.
## How It Works
1. Former subscriber receives an email with reactivation offer
2. Customer views their cancelled subscription details
3. Customer clicks to reactivate their subscription, potentially with a special offer
4. Subscription is reactivated without leaving the email
## Required Endpoints
| Endpoint | Purpose | Required |
| ------------------------------------------------------------------------------------------------ | --------------------------------------- | -------- |
| [Get Cancelled Subscriptions](/api-reference/reactivate/get-cancelled-subscriptions) | Retrieve cancelled subscription details | Yes |
| [Reactivate Cancelled Subscription](/api-reference/reactivate/reactivate-cancelled-subscription) | Process subscription reactivation | Yes |
## Getting Started
Ready to implement the Reactivate widget? This is perfect for win-back campaigns to re-engage former subscribers.
Explore our API documentation
Learn how to authenticate your API requests
# Subscription Portal
Source: https://docs.zaymo.com/use-cases/subscription-portal
Enable subscribers to manage subscriptions directly from email
The Subscription Portal widget allows subscribers to manage their subscriptions directly from email, including rescheduling deliveries or requesting immediate shipment.
**Delay Subscription**
*Subscribers can postpone their next delivery*
**Send Now**
*Subscribers can request immediate shipment*
## How It Works
1. Subscriber receives an email with subscription management options
2. Subscriber can view current subscription details
3. Subscriber can reschedule their next delivery or request immediate shipment
4. Changes are confirmed without leaving the email
## Required Endpoints
| Endpoint | Purpose | Required |
| ----------------------------------------------------------------------------------- | ------------------------------------------ | -------- |
| [Get Current Subscription](/api-reference/customer-portal/get-current-subscription) | Retrieve current subscription details | Yes |
| [Delay Subscription](/api-reference/customer-portal/delay-subscription) | Process subscription rescheduling requests | No |
| [Send Subscription Now](/api-reference/customer-portal/send-subscription-now) | Process immediate shipment requests | No |
## Getting Started
Ready to implement the Subscription Portal? This widget helps increase customer satisfaction by giving subscribers control over their deliveries.
Explore our API documentation
Learn how to authenticate your API requests
# Swap Up
Source: https://docs.zaymo.com/use-cases/swap-up
Let subscribers swap their current subscription product directly from email
The Swap Up widget allows subscribers to upgrade or change their current subscription product directly from email without leaving their inbox.
## How It Works
1. Subscriber receives an email with a swap option tied to their current subscription
2. Zaymo loads the customer's current subscription and matching swap configuration
3. Subscriber selects the new product option they want
4. Zaymo calls your swap endpoint to execute the product change
5. The subscriber receives confirmation directly in the email
## Product Configuration Requirements
Swap Up performs a **whole-product replacement**: it swaps the subscriber's current
subscription item for a single target product, identified by id. Because of this, your
catalog must be modeled so that every swappable option is its own distinct product.
Swap Up does not support swapping between variants of the same product, changing the
billing frequency, changing quantity, or overriding price during the swap. Each swap is
a one-to-one product id → product id change.
To make Swap Up work, your store must meet the following requirements:
1. **Each swappable option is a distinct product with its own stable id.** Zaymo's custom
integration model is flat — there is no separate variant or selling-plan concept. If
customers should be able to swap between, for example, three sizes or flavors, each one
must be its own product with a unique `id`.
2. **Ids must be consistent across endpoints.** The `id` you return for a product from
[Get Products](/api-reference/upsells/get-products) must be the same `id` that appears as
`items[].id` in [Get Current Subscription](/api-reference/customer-portal/get-current-subscription)
when a customer is subscribed to that product. Zaymo matches a subscriber's current item
to a configured swap by this id, so the same product must always resolve to the same id.
3. **The swap is executed as id → id.** When a subscriber swaps, Zaymo calls
[Swap Subscription Product](/api-reference/swap-up/swap-subscription-product) with
`current_item_id` (the subscriber's current `items[].id`) and `new_product_id` (the
selected product's `id`). Your endpoint is responsible for replacing the item and
applying your own pricing and billing-frequency rules for the new product.
### Not supported
| Capability | Notes |
| -------------------------------- | ---------------------------------------------------------------------------- |
| Variant-level swaps | Model each variant as its own product instead. |
| Frequency / selling-plan changes | The new product keeps your store's billing rules. |
| Quantity changes | The swap preserves the existing line; quantity is not changed. |
| Price overrides at swap time | Pricing is owned by your store. Discounts can be passed via `discount_code`. |
## Required Endpoints
| Endpoint | Purpose | Required |
| ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | -------- |
| [Get Products](/api-reference/upsells/get-products) | Retrieve the products that can be offered as swap targets | Yes |
| [Get Current Subscription](/api-reference/customer-portal/get-current-subscription) | Retrieve the customer's current subscription item so Zaymo can determine swap eligibility | Yes |
| [Swap Subscription Product](/api-reference/swap-up/swap-subscription-product) | Execute the swap from the customer's current item to the selected new product | Yes |
## Getting Started
Swap Up works best when you already know which existing subscription products should map to which upgrade or replacement products. Zaymo handles the customer experience and selection flow, then sends your API the current subscription item and the newly selected product.
Explore the endpoints used by Swap Up
Learn how to authenticate your API requests