---
title: "Create marketing events"

doc_type: openapi
doc_category: openapi
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/docs/admin-rest-api/marketing/marketing-events/create-marketing-events'
  md: 'https://developer.shopline.com/docs/admin-rest-api/marketing/marketing-events/create-marketing-events.md'
---
# Create marketing events

- **Base URL:** `https://{handle}.myshopline.com/admin/openapi`
- **Required Scopes:** `write_marketing_event`
- **API Version:** v20270301
- **API Type:** Admin
- **API Protocol:** RESTful

## Endpoint

```http
POST /sales/marketing_events.json
```

## Base URL

* `https://{handle}.myshopline.com/admin/openapi`

  * `{handle}`: `handle` : The store's unique identifier, which is the prefix of the store's domain name. For example, if a store's domain name is `open001.myshopline.com` , the store handle is `open001` .

## Required Permissions

* `write_marketing_event`

## Request

### Request Headers

* `Content-Type`

  string (required)

  The field must be set to the fixed value `application/json; charset=utf-8`.

* `Authorization`

  string (required)

   The access token for the API resource. Refer to [App authorization](https://developer.shopline.com/docs/apps/api-instructions-for-use/app-authorization.md?lang=en) to obtain the access token, and then pass the obtained token in the Bearer format. 

### Request Body

* `marketing_event`

  object

  Marketing events

  * `utm_term`

    string

    Key words for identification search

  * `event_type`

    string

    ●ad : advertising ● post : push ( fb post-chinese ) ● message : sms ● retargeting : dynamic redirect advertising ● transactional : ● affiliate : distribution / kol / red people ●Loyalty : gift card ● newsletter : subscription mail ● abandoned_cart : discard ● live : live broadcast

  * `marketing_channel`

    string

    Marketing event select channels ● search ● display ● social ● email ● referral ● sms

  * `remote_id`

    string

    Resources id

  * `utm_source`

    string

    Advertising customers , advertising websites

  * `utm_medium`

    string

    Identification source type

  * `utm_campaign`

    string

    Identify specific advertising

  * `started_at`

    string

    Start time

  * `description`

    string

    Description

  * `ended_at`

    string

    End time

  * `referring_domain`

    string

    Domain name for marketing events , if marketing_channel is search and social , specify is needed

  * `utm_content`

    string

    Distinguish between the same ad and different links

  * `preview_url`

    string

    Url to preview(Examples link are for reference only)

  * `manage_url`

    string

    Managed links (Examples link are for reference only)

## Response

### Status Codes

* `200`

  For the complete list of codes and messages, see [Http status code](https://developer.shopline.com/docs/apps/api-instructions-for-use/http-status-code.md?lang=en).

* `400`

  

* `401`

  

* `429`

  

### Response Headers

* `traceId`

  A globally unique identifier for the request. It is used to track the request flow throughout the system, allowing for easy location and debugging when issues arise.

### Response Body

#### 200

* `marketing_event`

  object

  Marketing events

  * `remote_id`

    string

    Resources id

  * `referring_domain`

    string

    Domain name for marketing events , if marketing_channel is search and social , specify is needed

  * `preview_url`

    string

    Url to preview

  * `marketing_channel`

    string

    Marketing event select channels ● search ● display ● social ● email ● referral ● sms

  * `description`

    string

    Marketing campaign description

  * `utm_medium`

    string

    Identification source type

  * `utm_campaign`

    string

    Identify specific advertising

  * `utm_term`

    string

    Key words for identification search

  * `event_type`

    string

    ●ad : advertising ● post : push ( fb post-chinese ) ● message : sms ● retargeting : dynamic redirect advertising ● transactional : ● affiliate : distribution / kol / red people ●Loyalty : gift card ● newsletter : subscription mail ● abandoned_cart : discard ● live : live broadcast

  * `id`

    string

    Id for marketing events

  * `marketing_event_id`

    string

    Yingxiao id for marketing events

  * `manage_url`

    string

    Managed links (Examples link are for reference only)

  * `ended_at`

    string

    End time

  * `started_at`

    string

    Start time

  * `utm_content`

    string

    Distinguish between the same ad and different links

  * `utm_source`

    string

    Advertising customers , advertising websites


#### 400

* `errors`

  string

  Error message. 


#### 401

* `errors`

  string

  Error message. 


#### 429

* `errors`

  string

  Error message. 


## OpenAPI Definition

```json
{
  "externalDocs": {
    "description": "Permission point used by the interface is `write_marketing_event` , For more information about the use of permission points, see",
    "url": "ec20/3cv5d7wpfgr6a8z5/xabczf5442284vkq?lang=en",
    "errorTableDescription": ""
  },
  "operationId": "weHj9xMI",
  "parameters": [
    {
      "name": "Content-Type",
      "in": "header",
      "description": "The field must be set to the fixed value `application/json; charset=utf-8`.",
      "required": true,
      "style": "string",
      "schema": {
        "name": "Content-Type",
        "type": "string",
        "example": "application/json; charset=utf-8"
      }
    },
    {
      "name": "Authorization",
      "in": "header",
      "description": " The access token for the API resource. Refer to [App authorization](https://developer.shopline.com/docs/apps/api-instructions-for-use/app-authorization.md?lang=en) to obtain the access token, and then pass the obtained token in the Bearer format. ",
      "required": true,
      "style": "string",
      "schema": {
        "name": "Authorization",
        "description": " The access token for the API. Please refer to [App authorization](https://developer.shopline.com/docs/apps/api-instructions-for-use/app-authorization.md?lang=en) to obtain the access token, and then put the obtained access token into the API request header in Bearer Token.",
        "type": "string",
        "example": "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6MCwiYXBwS2V5IjoiNzU2ZjI1NWE2NjdlZTcwNTk1MzM0ZjVjYzk4NzU5MzBmN2E3NGZjMSIsImV4cCI6MTg3OTQ4MjA3NiwiaXNzIjoieXNvdWwiLCJzZWxsZXJJZCI6IjIwMDAyMzQ4ODAiLCJzdG9yZUlkIjoiMTY3MjM2OTcyOTYwNiIsInRpbWVzdGFtcCI6MTc4NDc4NzY3NjY2MSwidmVyc2lvbiI6IlYyIn0.3ZzbGAH4cLU1QR2VPEvMOQInUDvus-C4amkINSQIPuNVlXsFKj0sAt1c0KnUy9MWUOFV9cHlkf7J90r2y1FzpA"
      },
      "example": "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6MCwiYXBwS2V5IjoiNzU2ZjI1NWE2NjdlZTcwNTk1MzM0ZjVjYzk4NzU5MzBmN2E3NGZjMSIsImV4cCI6MTg3OTQ4MjA3NiwiaXNzIjoieXNvdWwiLCJzZWxsZXJJZCI6IjIwMDAyMzQ4ODAiLCJzdG9yZUlkIjoiMTY3MjM2OTcyOTYwNiIsInRpbWVzdGFtcCI6MTc4NDc4NzY3NjY2MSwidmVyc2lvbiI6IlYyIn0.3ZzbGAH4cLU1QR2VPEvMOQInUDvus-C4amkINSQIPuNVlXsFKj0sAt1c0KnUy9MWUOFV9cHlkf7J90r2y1FzpA"
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "marketing_event": {
              "name": "marketing_event",
              "description": "Marketing events",
              "type": "object",
              "properties": {
                "utm_term": {
                  "name": "utm_term",
                  "description": "Key words for identification search",
                  "type": "string",
                  "example": "This is search word for utm item"
                },
                "event_type": {
                  "name": "event_type",
                  "description": "●ad : advertising ● post : push ( fb post-chinese ) ● message : sms ● retargeting : dynamic redirect advertising ● transactional : ● affiliate : distribution / kol / red people ●Loyalty : gift card ● newsletter : subscription mail ● abandoned_cart : discard ● live : live broadcast",
                  "type": "string",
                  "example": "ad"
                },
                "marketing_channel": {
                  "name": "marketing_channel",
                  "description": "Marketing event select channels ● search ● display ● social ● email ● referral ● sms",
                  "type": "string",
                  "example": "search"
                },
                "remote_id": {
                  "name": "remote_id",
                  "description": "Resources id",
                  "type": "string",
                  "example": "6019932248291157288"
                },
                "utm_source": {
                  "name": "utm_source",
                  "description": "Advertising customers , advertising websites",
                  "type": "string",
                  "example": "manong.myshopline.com"
                },
                "utm_medium": {
                  "name": "utm_medium",
                  "description": "Identification source type",
                  "type": "string",
                  "example": "email"
                },
                "utm_campaign": {
                  "name": "utm_campaign",
                  "description": "Identify specific advertising",
                  "type": "string",
                  "example": "google"
                },
                "started_at": {
                  "name": "started_at",
                  "description": "Start time",
                  "type": "string",
                  "example": "2022-12-15T09:00:00+08:00"
                },
                "description": {
                  "name": "description",
                  "description": "Description",
                  "type": "string",
                  "example": "This is description for marketing event"
                },
                "ended_at": {
                  "name": "ended_at",
                  "description": "End time",
                  "type": "string",
                  "example": "2023-12-15T09:00:00+08:00"
                },
                "referring_domain": {
                  "name": "referring_domain",
                  "description": "Domain name for marketing events , if marketing_channel is search and social , specify is needed",
                  "type": "string",
                  "example": "manong.myshopline.com"
                },
                "utm_content": {
                  "name": "utm_content",
                  "description": "Distinguish between the same ad and different links",
                  "type": "string",
                  "example": "googleAds"
                },
                "preview_url": {
                  "name": "preview_url",
                  "description": "Url to preview(Examples link are for reference only)",
                  "type": "string",
                  "example": "https://manong.myshopline.com/"
                },
                "manage_url": {
                  "name": "manage_url",
                  "description": "Managed links (Examples link are for reference only)",
                  "type": "string",
                  "example": "https://manong.myshopline.com/admin/"
                }
              },
              "required": [
                "event_type",
                "marketing_channel"
              ],
              "example": {
                "remote_id": "6019932248291157288",
                "started_at": "2022-12-15T09:00:00+08:00",
                "utm_campaign": "google",
                "ended_at": "2023-12-15T09:00:00+08:00",
                "marketing_channel": "search",
                "utm_content": "googleAds",
                "description": "This is description for marketing event",
                "manage_url": "https://manong.myshopline.com/admin/",
                "utm_medium": "email",
                "utm_source": "manong.myshopline.com",
                "utm_term": "This is search word for utm item",
                "preview_url": "https://manong.myshopline.com/",
                "event_type": "ad",
                "referring_domain": "manong.myshopline.com"
              }
            }
          },
          "example": {
            "marketing_event": {
              "utm_campaign": "google",
              "preview_url": "https://manong.myshopline.com/",
              "event_type": "ad",
              "referring_domain": "manong.myshopline.com",
              "remote_id": "6019932248291157288",
              "utm_content": "googleAds",
              "utm_term": "This is search word for utm item",
              "utm_medium": "email",
              "description": "This is description for marketing event",
              "ended_at": "2023-12-15T09:00:00+08:00",
              "manage_url": "https://manong.myshopline.com/admin/",
              "marketing_channel": "search",
              "started_at": "2022-12-15T09:00:00+08:00",
              "utm_source": "manong.myshopline.com"
            }
          }
        },
        "examples": {
          "Create a marketing event": {
            "value": {
              "marketing_event": {
                "utm_medium": "email",
                "utm_source": "manong.myshopline.com",
                "ended_at": "2023-12-15T09:00:00+08:00",
                "remote_id": "6019932248291157288",
                "event_type": "ad",
                "utm_campaign": "google",
                "utm_term": "This is search word for utm item",
                "started_at": "2022-12-15T09:00:00+08:00",
                "marketing_channel": "search",
                "referring_domain": "manong.myshopline.com",
                "description": "This is description for marketing event",
                "utm_content": "googleAds",
                "manage_url": "https://manong.myshopline.com/admin/",
                "preview_url": "https://manong.myshopline.com/"
              }
            }
          },
          "Create a marketing event for an illegal event type": {
            "value": {
              "marketing_event": {
                "manage_url": "https://manong.myshopline.com/admin/",
                "preview_url": "https://manong.myshopline.com/",
                "utm_source": "manong.myshopline.com",
                "ended_at": "2023-12-15T09:00:00+08:00",
                "marketing_channel": "search",
                "started_at": "2022-12-15T09:00:00+08:00",
                "utm_medium": "email",
                "description": "This is description for marketing event",
                "referring_domain": "manong.myshopline.com",
                "utm_campaign": "google",
                "utm_content": "googleAds",
                "remote_id": "6019932248291157288",
                "utm_term": "This is search word for utm item",
                "event_type": "illegal event type"
              }
            }
          },
          "Create a marketing event for an illegal marketing channel": {
            "value": {
              "marketing_event": {
                "utm_campaign": "google",
                "marketing_channel": "illegal marketing channel",
                "preview_url": "https://manong.myshopline.com/",
                "referring_domain": "manong.myshopline.com",
                "utm_medium": "email",
                "ended_at": "2023-12-15T09:00:00+08:00",
                "remote_id": "6019932248291157288",
                "utm_content": "googleAds",
                "utm_source": "manong.myshopline.com",
                "description": "This is description for marketing event",
                "utm_term": "This is search word for utm item",
                "event_type": "ad",
                "manage_url": "https://manong.myshopline.com/admin/",
                "started_at": "2022-12-15T09:00:00+08:00"
              }
            }
          }
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "description": "For the complete list of codes and messages, see [Http status code](https://developer.shopline.com/docs/apps/api-instructions-for-use/http-status-code.md?lang=en).",
      "headers": {
        "traceId": {
          "description": "A globally unique identifier for the request. It is used to track the request flow throughout the system, allowing for easy location and debugging when issues arise."
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "marketing_event": {
                "name": "marketing_event",
                "description": "Marketing events",
                "type": "object",
                "properties": {
                  "remote_id": {
                    "name": "remote_id",
                    "description": "Resources id",
                    "type": "string",
                    "example": "6019942645165466925"
                  },
                  "referring_domain": {
                    "name": "referring_domain",
                    "description": "Domain name for marketing events , if marketing_channel is search and social , specify is needed",
                    "type": "string",
                    "example": "manong.myshopline.com"
                  },
                  "preview_url": {
                    "name": "preview_url",
                    "description": "Url to preview",
                    "type": "string",
                    "example": "https://manong.myshopline.com/"
                  },
                  "marketing_channel": {
                    "name": "marketing_channel",
                    "description": "Marketing event select channels ● search ● display ● social ● email ● referral ● sms",
                    "type": "string",
                    "example": "search"
                  },
                  "description": {
                    "name": "description",
                    "description": "Marketing campaign description",
                    "type": "string",
                    "example": "This is description for marketing event"
                  },
                  "utm_medium": {
                    "name": "utm_medium",
                    "description": "Identification source type",
                    "type": "string",
                    "example": "email"
                  },
                  "utm_campaign": {
                    "name": "utm_campaign",
                    "description": "Identify specific advertising",
                    "type": "string",
                    "example": "google"
                  },
                  "utm_term": {
                    "name": "utm_term",
                    "description": "Key words for identification search",
                    "type": "string",
                    "example": "This is search word for utm item"
                  },
                  "event_type": {
                    "name": "event_type",
                    "description": "●ad : advertising ● post : push ( fb post-chinese ) ● message : sms ● retargeting : dynamic redirect advertising ● transactional : ● affiliate : distribution / kol / red people ●Loyalty : gift card ● newsletter : subscription mail ● abandoned_cart : discard ● live : live broadcast",
                    "type": "string",
                    "example": "ad"
                  },
                  "id": {
                    "name": "id",
                    "description": "Id for marketing events",
                    "type": "string",
                    "example": "4073"
                  },
                  "marketing_event_id": {
                    "name": "marketing_event_id",
                    "description": "Yingxiao id for marketing events",
                    "type": "string",
                    "example": "MA_6019943243021559089"
                  },
                  "manage_url": {
                    "name": "manage_url",
                    "description": "Managed links (Examples link are for reference only)",
                    "type": "string",
                    "example": "https://manong.myshopline.com/admin/"
                  },
                  "ended_at": {
                    "name": "ended_at",
                    "description": "End time",
                    "type": "string",
                    "example": "2023-12-15T09:00:00+08:00"
                  },
                  "started_at": {
                    "name": "started_at",
                    "description": "Start time",
                    "type": "string",
                    "example": "2022-12-15T09:00:00+08:00"
                  },
                  "utm_content": {
                    "name": "utm_content",
                    "description": "Distinguish between the same ad and different links",
                    "type": "string",
                    "example": "googleAds"
                  },
                  "utm_source": {
                    "name": "utm_source",
                    "description": "Advertising customers , advertising websites",
                    "type": "string",
                    "example": "manong.myshopline.com"
                  }
                },
                "example": {
                  "started_at": "2022-12-15T09:00:00+08:00",
                  "utm_campaign": "google",
                  "ended_at": "2023-12-15T09:00:00+08:00",
                  "manage_url": "https://manong.myshopline.com/admin/",
                  "marketing_channel": "search",
                  "utm_source": "manong.myshopline.com",
                  "utm_content": "googleAds",
                  "utm_term": "This is search word for utm item",
                  "marketing_event_id": "MA_6019943243021559089",
                  "remote_id": "6019942645165466925",
                  "utm_medium": "email",
                  "description": "This is description for marketing event",
                  "referring_domain": "manong.myshopline.com",
                  "id": "4073",
                  "event_type": "ad",
                  "preview_url": "https://manong.myshopline.com/"
                }
              }
            },
            "example": {
              "marketing_event": {
                "remote_id": "6019942645165466925",
                "preview_url": "https://manong.myshopline.com/",
                "description": "This is description for marketing event",
                "marketing_event_id": "MA_6019943243021559089",
                "event_type": "ad",
                "referring_domain": "manong.myshopline.com",
                "ended_at": "2023-12-15T09:00:00+08:00",
                "utm_term": "This is search word for utm item",
                "utm_medium": "email",
                "id": "4073",
                "utm_source": "manong.myshopline.com",
                "manage_url": "https://manong.myshopline.com/admin/",
                "marketing_channel": "search",
                "utm_content": "googleAds",
                "utm_campaign": "google",
                "started_at": "2022-12-15T09:00:00+08:00"
              }
            }
          },
          "examples": {
            "Create a marketing event": {
              "value": {
                "marketing_event": {
                  "utm_source": "manong.myshopline.com",
                  "utm_content": "googleAds",
                  "marketing_event_id": "MA_6062143268514178052",
                  "id": 4355,
                  "referring_domain": "manong.myshopline.com",
                  "ended_at": "2023-12-15T09:00:00+08:00",
                  "utm_campaign": "google",
                  "description": "This is description for marketing event",
                  "remote_id": "6019932248291157288",
                  "utm_term": "This is search word for utm item",
                  "event_type": "ad",
                  "preview_url": "https://manong.myshopline.com/",
                  "started_at": "2022-12-15T09:00:00+08:00",
                  "utm_medium": "email",
                  "marketing_channel": "search",
                  "manage_url": "https://manong.myshopline.com/admin/"
                }
              }
            }
          }
        }
      }
    },
    "400": {
      "headers": {
        "traceId": {
          "description": "A globally unique identifier for the request. It is used to track the request flow throughout the system, allowing for easy location and debugging when issues arise."
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "errors": {
                "name": "errors",
                "description": "Error message. ",
                "type": "string"
              }
            },
            "required": [
              "errors"
            ]
          },
          "examples": {
            "Create a marketing event for an illegal event type": {
              "value": {}
            },
            "Create a marketing event for an illegal marketing channel": {
              "value": {}
            }
          }
        }
      }
    },
    "401": {
      "headers": {
        "traceId": {
          "description": "A globally unique identifier for the request. It is used to track the request flow throughout the system, allowing for easy location and debugging when issues arise."
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "errors": {
                "description": "Error message. ",
                "type": "string"
              }
            },
            "required": [
              "errors"
            ]
          }
        }
      }
    },
    "429": {
      "headers": {
        "traceId": {
          "description": "A globally unique identifier for the request. It is used to track the request flow throughout the system, allowing for easy location and debugging when issues arise."
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "errors": {
                "description": "Error message. ",
                "type": "string"
              }
            },
            "required": [
              "errors"
            ]
          }
        }
      }
    }
  },
  "security": [
    {
      "oauth2": []
    }
  ],
  "method": "post",
  "path": "/sales/marketing_events.json",
  "servers": [
    {
      "url": "https://{handle}.myshopline.com/admin/openapi",
      "variables": {
        "handle": {
          "default": "openapiceshidianpu",
          "description": "`handle` : The store's unique identifier, which is the prefix of the store's domain name. For example, if a store's domain name is `open001.myshopline.com` , the store handle is `open001` ."
        }
      }
    }
  ],
  "info": {
    "title": "Create marketing events",
    "version": "v20270301"
  },
  "authIndexes": [
    "write_marketing_event"
  ]
}
```