PUT/email_campaign/{email_campaign_id}
This method lets users update an existing email campaign. Pass the emailCampaignId in the request URL and specify the changes to field values in the request payload.
Note: You can only update the custom fields of an email campaign. Fixed values, such as the emailCampaignType, cannot be changed. For full specifications of fixed values for each email campaign type, see the createEmailCampaign method documentation.
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
Parameter | Type | Description |
---|---|---|
email_campaign_id | string | This path parameter specifies the unique eBay assigned identifier for the email campaign being updated. Use the getEmailCampaigns method to retrieve a list of email campaign IDs for a seller. Occurrence: Required |
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 |
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 limit to the number of audience codes that may be entered. 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 |
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: Optional |
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. The maximum length is 1000 characters 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 ID 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 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: Optional |
subject | string | The email campaign subject. The maximum length is 70 characters. 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 ID to the email campaign that is generated when the email campaign is created. Occurrence: Always |
emailCampaignStatus | EmailCampaignStatusEnum | The email campaign status. See EmailCampaignStatusEnum for a list of email campaign statuses and their descriptions. 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. |
35801 | STORE_CRM | REQUEST | 'audiences' is required for this call. |
35802 | STORE_CRM | REQUEST | No email campaign found for email campaign ID {email_campaign_id}. |
35803 | STORE_CRM | REQUEST | 'subject' is required for this call. |
35804 | STORE_CRM | REQUEST | 'personalizedMessage' is required for this call. |
35805 | STORE_CRM | REQUEST | 'subject' length is too long. For maximum limits, see the documentation for this call. |
35806 | STORE_CRM | REQUEST | 'audiences' value is not suitable for current email campaign type. |
35807 | STORE_CRM | REQUEST | 'itemIds' is required for this call. |
35808 | STORE_CRM | REQUEST | For 'WELCOME' type campaign, 'itemIds' should be empty. |
35809 | STORE_CRM | REQUEST | The item {itemIds} size exceeds maximum. For maximum limits, see the documentation for this call. |
35810 | STORE_CRM | REQUEST | No eligible items for current campaign. |
35811 | STORE_CRM | REQUEST | 'promotionId' is required for this call. |
35812 | STORE_CRM | REQUEST | 'promotionId' is invalid, promotion may be inactive or non-exist. |
35813 | STORE_CRM | REQUEST | 'scheduleDate' is not required for this call. |
35814 | STORE_CRM | REQUEST | 'scheduleDate' is missing or invalid, please use a valid UTC format(yyyy-MM-ddThh:mm:sssZ) string. |
35815 | STORE_CRM | REQUEST | 'email_campaign_id' is not eligible for editing. |
35816 | STORE_CRM | REQUEST | 'personalizedMessage' length is too long. For maximum limits, see the documentation for this call. |
35817 | STORE_CRM | REQUEST | The email campaign schedule date {scheduleDate} must be in the future. |
35818 | STORE_CRM | REQUEST | 'itemIds' contains ineligible item id, please check the item list |
35819 | 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: Updating an Email Campaign
This method updates an existing email campaign.
Input
The emailCampaignId URI parameter is required to specify the email campaign that is being updated.
The existing email campaign will be updated with the values passed in the request payload. Note that only custom fields can be updated. Fixed values, such as the emailCampaignType cannot be changed.
In this sample, the subject, audienceCodes, scheduledDate, and personalizedMessage are being updated. In addiiton, the lte has been updated to show that the price range of the listings selected will be less than or equal to 100 USD.
PUThttps://api.ebay.com/sell/marketing/v1/email_campaign/b********3
Output
If the call is successful, the emailCampaignId and emailCampaignStatus for the updated email campaign are returned.