# 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 Zaymo Logo Zaymo Logo ## 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.