Alternative schemas
The basics
The Mailchimp Marketing API has several endpoints that are capable of accepting or returning multiple types of data. The API specifies alternative schemas for these endpoints, with additional parameters for requesting a particular type of data.
This documentation covers the Marketing API’s implementation of alternative schemas, including tables of the supported alternative schemas and their parameters. For further details on other aspects of these endpoints, consult the full API reference.
Structure
To specify alternate schemas, the Marketing API uses x-oneOf, a variation on the Open API Specification’s oneOf keyword. The value of x-oneOf is an array of objects, each representing a possible schema for the endpoint.
To choose among alternative schemas, you need to know the name of the schema and the field where you provide that name. The name of each schema is the x-value inside the schema object. The field name for a particular endpoint is specified as the propertyName of its x-discriminator object. Your code should be able to handle any type of data based on its x-value, or you should limit your API calls to the data types you want to handle.
For example, say you want to add a segment using a conditions parameter to determine who is included in the segment. This parameter’s specification indicates that it uses alternative schemas with the x-discriminator named condition_type. Find the x-value of the type of segment you want to create and pass that within conditions.
For some endpoints, specifying a particular schema affects not only the type of data returned, but also the other values you can pass in your request. Operators for comparing data are given in the op field, and valid comparisons are given in the value field.
Activity schemas
The Member Activity Feed endpoint can return a range of activity types. Although the x-discriminator for these activity schemas is activity_type, the relevant request parameter is activity_filters, which accepts an array of x-values instead of a single string. If you pass activity_filters, activity matching one of the provided types will be returned; if you omit it, any type of activity that matches your query will be returned.
Email Opens — Activity feed item representing opening an email.
Email Clicks — Activity feed item representing having a link clicked by a contact.
Email Bounced — Activity feed item representing an email to this contact bouncing.
List Unsubscribed — Activity feed item representing this contact unsubscribing from a list.
Email Sent — Activity feed item representing having an email sent to the contact.
Email Conversation — Activity feed item representing an individual reply in a conversation.
Note — Activity feed item representing a note on the contact record.
Marketing Permission — Activity feed item indicating if a marketing permission was added or updated.
Postcard Sent — Activity feed item representing a time when a contact was sent a particular postcard.
Squatter Signup — Activity feed item to representing a contact signing up for the audience from a squatter page.
Website Signup — Activity feed item to representing a contact signing up for the contact through a website page.
Landing Page Signup — Activity feed item to representing a contact signing up for the list via a landing page.
Ecommerce Signup — Activity feed item to representing a contact signing up for the list via a ecommerce store.
Generic Signup — Activity feed item that represents a contact signing up for the audience via a generic some generic method (specifically, one we can’t link to).
Ecommerce Order — Activity feed item that represents an order.
Contact Activity Event — Activity feed item that represents a generic event.
Survey response — Represents when a contact completes and submits a survey
Segment condition schemas
A variety of endpoints accept or return segment condition data, from the Segments endpoints themselves to others like automation, list, and campaign endpoints. Because there are many ways to define a segment, there are many alternative schemas for segment conditions.
The x-discriminator for segment conditions is condition_type. The request parameter conditions accepts an array of objects that indicate the desired segment condition (field), operator, value, and optional extra information. Multiple segment conditions can be combined like so:
Aim Segment — Segment by interaction with a specific campaign.
Automation Segment — Segment by interaction with an Automation workflow.
Poll Activity Segment — Segment by poll activity.
Conversation Segment — Segment by interaction with a campaign via Conversations.
Date Segment — Segment by a specific date field.
Email Client Segment — Segment by use of a particular email client.
Language Segment — Segment by language.
Member Rating Segment — Segment by member rating.
Signup Source Segment — Segment by signup source.
SurveyMonkey Segment — Segment by interaction with a SurveyMonkey survey.
VIP Segment — Segment by VIP status.
Interests Segment — Segment by an interest group merge field.
Ecommerce Category Segment — Segment by purchases in specific items or categories.
Ecommerce Number Segment — Segment by average spent total, number of orders, total number of products purchased, or average number of products per order.
Ecommerce Purchased Segment — Segment by whether someone has purchased anything.
Ecommerce Spent Segment — Segment by amount spent on a single order or across all orders.
Ecommerce Purchased Store Segment — Segment by purchases from a specific store.
Goal Activity Segment — Segment by Goal activity.
Goal Timestamp Segment — Segment by most recent interaction with a website.
Similar Subscribers Segment Member Segment — Segment by similar subscribers.
Static Segment Member Segment — Segment by a given static segment.
Location-Based Segment — Segment by a specific country or US state.
Geolocation Segment — Segment by a specific geographic region.
US ZIP Code Segment — Segment by a specific US ZIP code.
Unknown Location-Based Segment — Segment members whose location information is unknown.
Zip Code Location-Based Segment — Segment by a specific US ZIP code.
Social Profiles Age Segment — Segment by age ranges in Social Profiles data.
Social Profiles Gender Segment — Segment by listed gender in Social Profiles data.
Social Profiles Influence Segment — Segment by influence rating in Social Profiles data.
Social Profiles Social Network Segment — Segment by social network in Social Profiles data.
Social Profiles Social Network Follow Segment — Segment by social network in Social Profiles data.
Address Merge Field Segment — Segment by an address-type merge field.
Address/Zip Merge Field Segment — Segment by an address-type merge field within a given distance.
Birthday Merge Field Segment — Segment by a contact’s birthday.
Date Merge Field Segment — Segment by a given date merge field.
Dropdown/Radio Merge Field Segment — Segment by a given dropdown or radio button merge field.
Text or Number Merge Field Segment — Segment by a given text or number merge field.
Email Segment — Segment by email address.
Predicted Gender Segment — Segment by predicted gender.
Predicted Age Segment — Segment by predicted age.
New Subscribers Prebuilt Segment — Segment by when people subscribed.