POST/email_campaign
This method creates a new email campaign. An eBay store owner can create six different types of email campaigns: Welcome, New products & collections, Coupon, Sale event + markdown, Order discount, and Volume pricing.
A successful createEmailCampaign request returns the emailCampaignId assigned to the new email campaign.
The fields emailCampaignType, audienceCodes, itemSelectMode, subject, and personalizedMessage are required for all email campaign types.
Specific email campaign types have required values for additional fields. For more information on the email campaign types, see the Store Email Campaigns section of the Selling Integration Guide.
Input
Resource URI
This method is supported in Sandbox environment. To access the endpoint, just replace the api.ebay.com
root URI with api.sandbox.ebay.com
URI parameters
This method has no URI parameters.
HTTP request headers
All requests made to eBay REST operations require you to provide the Authorization
HTTP header for authentication authorization.
The table below shows additional HTTP request headers that are either required, conditionally required, or strongly recommended for this method. Other standard HTTP request headers- opens rest request components page (not in this table) can also be used, but they are optional.
Header | Type | Description |
---|---|---|
Content-Type | string | This header indicates the format of the request body provided by the client. Its value should be set to application/json. For more information, refer to HTTP request headers. Occurrence: Required |
X-EBAY-C-MARKETPLACE-ID | string | The eBay marketplace that the email campaign interfaces with. eBay marketplaces correspond to geographical regions or large submarkets of regions. For example, EBAY-US corresponds to the United States market.See MarketplaceIdEnum for supported values. Occurrence: Required |
OAuth scope
This request requires an access token created with the authorization code grant flow, using one or more scopes from the following list (please check your Application Keys page for a list of OAuth scopes available to your application):
https://api.ebay.com/oauth/api_scope/sell.marketing
See OAuth access tokens for more information.
Request payload
Copy complete valid JSON to clipboardRequest fields
Input container/field | Type | Description |
---|---|---|
audienceCodes | array of string | An array of audience codes for the audiences of the email campaign. At least one audience code is required. There is no upper limit to the number of audience codes. Occurrence: Required |
categoryId | string | The unique identifier of either an eBay category or a store category. Occurrence: Conditional |
categoryType | CategoryTypeEnum | This field must be set when applying an email campaign to a specific eBay category or store category. The enumeration value used indicates which type of category the categoryId belongs to. Occurrence: Optional |
emailCampaignType | CampaignTypeEnum | The email campaign type of the email campaign being created. There are six email campaigns that a user can create:
Note: emailCampaignType cannot be updated once the email campaign is created. Occurrence: Required |
itemIds | array of string | An array of unique identifiers for the listings displayed in an email campaign. Used if the seller wishes to select the eBay listings in the email campaign rather than have eBay automatically select them. Occurrence: Conditional |
itemSelectMode | ItemSelectModeEnum | Determines whether listings featured in an email campaign are selected by the seller or by eBay. Occurrence: Required |
personalizedMessage | string | The body of the email campaign. Accepts HTML and CSS. Occurrence: Required |
priceRange | PriceRange | This container is used if the seller wants to apply the email campaign to listings based on a price range. Occurrence: Optional |
priceRange.currency | string | Specifies the currency of the listings in an email campaign using one of the three-digit codes of the CurrencyCodeEnum type. Occurrence: Conditional |
priceRange.gte | number | The listings selected will be greater than or equal to this value. The value entered must be given in number format, such as 20.00. Occurrence: Optional |
priceRange.lte | number | The listings selected will be less than or equal to this value. The value entered must be given in number format, such as 100.00. Occurrence: Optional |
promotionId | string | The unique identifier of the discount used for an email campaign if the emailCampaignType is set to Occurrence: Conditional |
promotionSelectModeEnum | PromotionSelectModeEnum | The selection mode for the discount used if the emailCampaignType is set to Occurrence: Conditional |
scheduleDate | string | The date and time that the email campaign newsletter will be sent, given in UTC format. Example: 2023-05-20T03:13:35Z Occurrence: Optional |
sort | ItemSortEnum | The sort rule is used to display the listings featured in the email campaign.
The default sort rule is NEWLY_LISTED . Occurrence: Conditional |
subject | string | The subject line of the email campaign. Occurrence: Required |
Output
HTTP response headers
This call has no response headers.
Response payload
Response fields
Output container/field | Type | Description |
---|---|---|
emailCampaignId | string | The unique eBay-assigned identifier of the email campaign. It is generated automatically when the email campaign is created. Occurrence: Always |
emailCampaignStatus | EmailCampaignStatusEnum | The status of the email campaign. Occurrence: Always |
HTTP status codes
This call can return one of the following HTTP status codes. For an overview of the status codes, see HTTP status codes in Using eBay RESTful APIs.
Status | Meaning |
---|---|
200 | OK |
400 | Bad Request |
500 | Internal Server Error |
Error codes
For more on errors, plus the codes of other common errors, see Handling errors.
Code | Domain | Category | Meaning |
---|---|---|---|
35000 | STORE_CRM | APPLICATION | Internal server error encountered. If this problem persists, contact the eBay Developers Program for support. |
35001 | STORE_CRM | BUSINESS | A store subscription is required for this call, please check the store subscription status for current seller. |
35201 | STORE_CRM | REQUEST | 'marketplaceId' value is not supported. For the valid values, see the documentation for this call. |
35202 | STORE_CRM | REQUEST | 'emailCampaignType' value is not supported. For the valid values, see the documentation for this call. |
35203 | STORE_CRM | REQUEST | 'audiences' is required for this call. |
35204 | STORE_CRM | REQUEST | 'subject' is required for this call. |
35205 | STORE_CRM | REQUEST | 'personalizedMessage' is required for this call. |
35206 | STORE_CRM | REQUEST | 'subject' length is too long. For maximum limits, see the documentation for this call. |
35207 | STORE_CRM | REQUEST | 'audiences' value is not suitable for current email campaign type. |
35208 | STORE_CRM | REQUEST | 'itemIds' is required for this call. |
35209 | STORE_CRM | REQUEST | For 'WELCOME' type campaign, 'itemIds' should be empty. |
35210 | STORE_CRM | REQUEST | The item {itemIds} size exceeds maximum. For maximum limits, see the documentation for this call. |
35211 | STORE_CRM | REQUEST | No eligible items for current campaign. |
35212 | STORE_CRM | REQUEST | 'promotionId' is required for this call. |
35213 | STORE_CRM | REQUEST | 'promotionId' is invalid, promotion may be inactive or non-exist. |
35214 | STORE_CRM | REQUEST | 'scheduleDate' is not required for this call. |
35215 | STORE_CRM | REQUEST | 'scheduleDate' is missing or invalid, please use a valid UTC format(yyyy-MM-ddThh:mm.sssZ) string. |
35216 | STORE_CRM | REQUEST | Only one 'WELCOME' type email campaign is allowed for one marketplace. |
35217 | STORE_CRM | REQUEST | Only one automated promotion email campaign is allowed for one campaign type per marketplace id. |
35218 | STORE_CRM | REQUEST | 'personalizedMessage' length is too long. For maximum limits, see the documentation for this call. |
35219 | STORE_CRM | REQUEST | The email campaign schedule date {scheduleDate} must be in the future. |
35220 | STORE_CRM | REQUEST | 'itemIds' contains ineligible item id, please check the item list |
35221 | STORE_CRM | REQUEST | 'itemSelectMode' is invalid for this campaign, please see the documentation for this call. |
Warnings
This call has no warnings.
Samples
New to making API calls? Please see Making a Call.
Note: Identifiers, such as order IDs or user IDs, and personal data in these samples might be anonymized or may no longer be active on eBay. If necessary, substitute current, relevant eBay data in your requests.
Sample 1: Creating an Email Campaign
This method creates a new email campaign.
Input
No query or URI path parameters are needed for this call.
In this sample, an ITEM_SHOWCASE
email campaign is being created, as specified by the emailCampaignType field. This email campaign type is used to feature new products and collections that a seller wants to highlight. The campaign is being sent to all subscribers and followers of the seller's store, as specified by the audiences container and is scheduled to be sent at 2023-04-13T02:50:13.000Z
. A subject and personalizedMessage have also been added to let the audience know that this is a test email campaign.
POSThttps://api.ebay.com/sell/marketing/v1/email_campaign
Output
If the call is successful, the emailCampaignId and emailCampaignStatus for the created email campaign are returned.