Wish Promotions Platform API

The Promotions Platform API from Wish — 6 operation(s) for promotions platform.

OpenAPI Specification

wish-promotions-platform-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  contact:
    email: partner-api@wish.com
  x-wish-dev-contact:
    assignee: kwei
    email: marketplace-external-api@contextlogic.com
  description: "\nWish Marketplace V3 API\n\n# General Information\n\n The Wish Marketplace API will be using oAuth to authenticate in order to offer better security for its users\n\n *   Learn about oAuth [here](oauth).\n *   If you are a merchant and want to create an application for yourself, learn about how to create a private app [here](../../private-app)\n *   If you are a ERP and create applications that'll be used by multiple merchants, learn about how to create a public app [here]( ../../public-app). You will need to apply to be a verified public application\n\n ## How to Test\n\n To avoid testing the API on production data, use our sandbox. The sandbox is completely contained and will not affect Wish users or your merchant account. \n \n To reach the sandbox, visit: https://sandbox.merchant.wish.com.\n\n To use the sandbox in testing, use https://sandbox.merchant.wish.com/api/v3/ as your base URL.\n\n How to Generate test data after you have created a sandbox account:\n 1. Navigate to the [unfulfilled orders page](https://sandbox.merchant.wish.com/transactions/action)\n 2. Hover over the dropdown next to the 'fulfill with csv' button and select Generate Orders\n\n ## Date/Time Format\n\n  All dates and times in our API are returned in the same format. It is in the form `YYYY-MM-DDTHH:mm:ss.sss±XX:ZZ` or `YYYY-MM-DDTHH:mm:ss.sssZ`, where 'Z' represents UTC timezone.\n  When sending timestamps in URL parameters or the request body, millisecond is optional and will defaults to 0 if not provided.\n\n  * `YYYY` is the year\n  * `MM` is the month\n  * `DD` is the day\n  * `HH` is the hour (in 24-hour clock format)\n  * `mm` is the minutes\n  * `ss.sss` is the seconds and milliseconds\n  * `±XX:ZZ` is the UTC offset of the form +XX:ZZ or -XX:ZZ where XX is a 2-digit string giving the number of UTC offset hours, and ZZ is a 2-digit string giving the number of UTC offset minutes.\n\n ## Response Schema\n\n  Every response returned from the Wish API will have the same schema. This schema is intended to give you a predictable manner to check the status of your request and know where to get the data. Each response will have the following top level attributes: message, code and data.\n\n  **Attributes**\n\n  <table>\n  <tbody>\n  <tr>\n  <th>Message</th>\n  <td>A message describing the error that happened, example: \"We could not find a product for id: '5d30f60e0a6fc464f4f376b0'\"</td>\n  </tr>\n  <tr>\n  <th>Code</th>\n  <td>A unique number which represents the error that has occurred, example: 1008 or 0 if success.</td>\n  </tr>\n  <tr>\n  <th>Data</th>\n  <td>For errors this will be empty.</td>\n  </tr>\n  </tbody>\n  </table>\n\n ## General Querying Techniques\n\n ### Partial Resources\n All GET endpoints (except OAuth) support a fields parameter which allows for requesting a partial response. Any fields specified in the response schema of an endpoint can be selected. The top level attribute `data` can be ignored when using the fields parameter.\n\n **Syntax**\n * Comma-separated list to select multiple fields\n * Use forward slash `/` to select nested field: `field1/nested_field`\n * Use parentheses `( )` to select multiple nested fields: `field1(nested_field1,nested_field2)`\n * Use `*` for wildcard selection: `field1/nested_field/*`\n\n\n **Example:**\n ```\n https://merchant.wish.com/api/v3/demo/get?fields=title,items(id,info/name)\n ```\n Which would result in the following partial response:\n ```\n {\n   \"title\": \"demo\",\n   \"items\": [\n     {\n       \"id\": \"1\",\n       \"info\": {\n         \"name\": \"demo_item_1\"\n       }\n     }, {\n       \"id\": \"2\",\n       \"info\": {\n         \"name\": \"demo_item_2\"\n       }\n     },\n     ...\n   ]\n }\n ```\n\n ## Locale\n   You can optionally specify locale in order to translate content and error messages into your language.\n   To do this use the [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language) header to specify your preferred locales.\n   If none is provided, your default locale will be used.\n\n   For example, to request content in Chinese use: `Accept-Language: zh`\n\n   In the response, you will receive a [Content-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Language) header that specifies the locale code of the response content.\n\n\n ## Rate-Limiting\n\n  Rate-limiting will be performed on a per-merchant basis for each app. It is your responsibility to ensure you are not making frequent unnecessary calls to the API.\n\n  If the rate limits cannot satisfy your need, we highly recommend integrating webhooks for your app. With webhooks, instead of pulling resources periodically, your app will receive real-time notifications for particular events that occur to a merchant’s store. [Learn more](https://merchant.wish.com/documentation/webhooks)\n\n  **Normal Usage**\n\n  To help you track the rate-limiter status, the following response header(s) will be provided with each response:\n\n   * `Wish-Rate-Limit-Remaining`: The number of calls remaining in the current rate-limiting window.\n\n\n  **Rate-Limit Exceeded**\n\n  After you exceed the number of allowed calls in the current rate-limiting window, you will receive a `429 Too Many Requests` error response and the following additional header(s):\n\n   * `Wish-Rate-Limit-Reset`: The time the rate-limiter will reset.\n\n\n  Once you receive this response there is nothing you can do except wait for the rate-limiter to reset. In order to avoid being rate-limited, you may want to cache your responses.\n\n ## Sorting\n   ### Overview\n   Sorting is available for most endpoints that return a collection (list) of objects. Each collection has a different set of enabled parameters for sorting, so please check specific collection section for detail.\n\n   ### Usage\n   Append `sort_by={parameter_name}.{asc|desc}` in your API request where `parameter_name` is a valid sortable parameter of that endpoint.\n\n   Example:\n   ```\n   /api/v3/penalties?sort_by=created_at.asc\n   ```\n\n ## Pagination\n  All bulk-fetching API methods that return lists of resource support pagination.\n  These methods commonly take at least 3 parameters: `limit`, `{attribute}_min`, `{attribute}_max`. Attribute can be `id`, `create_at`, etc., depending on each specific method.\n  For instance, you make a request to get a list of penalties `/api/v3/penalties?limit=20&created_at_max=2020-04-08T23:59:59Z&sort_by=created_at_max.desc`,\n  which means to fetch 20 penalities sorted by their creation time, with the most recent one being created before `2020-04-08T23:59:59Z`.\n  Assume that the response contains 20 `penalty` objects with the last object being `penalty_foo`,\n  then your subsequent request can be `/api/v3/penalties?limit=20&created_at_max={penalty_foo.create_at}&sort_by=created_at_max.desc` to fetch the next page of list.\n  Note that when fetching next page using `id_min` or `id_max`, you need to perform `+/- 1`(correspondingly) on the last object's ID in the current page, as `id_min` and `id_max` are inclusive. (All V3 API resources' IDs are either integer or BSON object ID - a hex number).\n\n\n ## Request ID\n  Each API request is associated with a unique identifier. You can find this value in response headers, under `Wish-Request-Id`.\n  **When you need to contact us about a specific request, please provide this ID to ensure the fastest possible reply**\n\n# Authentication\nFor all requests that require OAuth2 authentication, the access token must be provided in the `Authorization` request header in the following format: `Authorization: Bearer <token>`\n\nFor example:\n```\nAuthorization: Bearer 3d6e2d71bc464e42bfbdb081afb73c1e\n```\n<!-- ReDoc-Inject: <security-definitions> -->\n"
  version: 3.0.65
  title: Wish Marketplace V3 Brands Promotions Platform API
servers:
- url: https://merchant.wish.com
  description: V3 API endpoint
security:
- OAuth2: []
tags:
- name: Promotions Platform
paths:
  /api/v3/promotions/eligible_products:
    get:
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/PromotionEligibleProduct'
                type: array
          description: successfully queried for eligible products
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
          description: failed to queried for eligible products
      parameters:
      - $ref: '#/components/parameters/promotions_updated_at_min'
      - $ref: '#/components/parameters/promotions_updated_at_max'
      - in: query
        description: Promotion type for eligible products search. This field is required if there is no event ID specified.
        name: promotion_type
        schema:
          $ref: '#/components/schemas/PromotionType'
      - required: false
        in: query
        description: List of product IDs for eligible products search.
        name: product_ids
        schema:
          items:
            type: string
            description: Product ID
            format: object-id
          type: array
          maxItems: 25
      - required: false
        in: query
        description: ID of the promotion event
        name: event_id
        schema:
          type: string
          format: object-id
      - required: false
        in: query
        description: The limit on the number of products that will be returned.
        name: limit
        schema:
          default: 25
          minimum: 1
          type: integer
          maximum: 200
      - required: false
        in: query
        description: The attribute to sort products in the response. The most recently updated products will be returned first if `desc`.
        name: sort_by
        schema:
          default: updated_at.desc
          pattern: ^(updated_at)(\.(asc|desc))?$
          type: string
      tags:
      - Promotions Platform
      summary: Get eligible products
      security:
      - OAuth2:
        - promotions:read
      operationId: getPromotionsEligibleProducts
      x-code-samples:
      - lang: java_unirest
        source: "HttpResponse<String> response = Unirest.get(\"https://merchant.wish.com/api/v3/promotions/eligible_products?updated_at_min=SOME_STRING_VALUE&updated_at_max=SOME_STRING_VALUE&promotion_type=SOME_STRING_VALUE&product_ids=SOME_ARRAY_VALUE&event_id=SOME_STRING_VALUE&limit=SOME_INTEGER_VALUE&sort_by=SOME_STRING_VALUE\")\n  .header(\"authorization\", \"Bearer REPLACE_BEARER_TOKEN\")\n  .asString();"
      - lang: php_curl
        source: "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n  CURLOPT_URL => \"https://merchant.wish.com/api/v3/promotions/eligible_products?updated_at_min=SOME_STRING_VALUE&updated_at_max=SOME_STRING_VALUE&promotion_type=SOME_STRING_VALUE&product_ids=SOME_ARRAY_VALUE&event_id=SOME_STRING_VALUE&limit=SOME_INTEGER_VALUE&sort_by=SOME_STRING_VALUE\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => array(\n    \"authorization: Bearer REPLACE_BEARER_TOKEN\"\n  ),\n));\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"
      - lang: javascript_jquery
        source: "var settings = {\n  \"async\": true,\n  \"crossDomain\": true,\n  \"url\": \"https://merchant.wish.com/api/v3/promotions/eligible_products?updated_at_min=SOME_STRING_VALUE&updated_at_max=SOME_STRING_VALUE&promotion_type=SOME_STRING_VALUE&product_ids=SOME_ARRAY_VALUE&event_id=SOME_STRING_VALUE&limit=SOME_INTEGER_VALUE&sort_by=SOME_STRING_VALUE\",\n  \"method\": \"GET\",\n  \"headers\": {\n    \"authorization\": \"Bearer REPLACE_BEARER_TOKEN\"\n  }\n}\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"
      - lang: shell_curl
        source: "curl --request GET \\\n  --url 'https://merchant.wish.com/api/v3/promotions/eligible_products?updated_at_min=SOME_STRING_VALUE&updated_at_max=SOME_STRING_VALUE&promotion_type=SOME_STRING_VALUE&product_ids=SOME_ARRAY_VALUE&event_id=SOME_STRING_VALUE&limit=SOME_INTEGER_VALUE&sort_by=SOME_STRING_VALUE' \\\n  --header 'authorization: Bearer REPLACE_BEARER_TOKEN'"
      - lang: python_requests
        source: 'import requests


          url = "https://merchant.wish.com/api/v3/promotions/eligible_products"


          querystring = {"updated_at_min":"SOME_STRING_VALUE","updated_at_max":"SOME_STRING_VALUE","promotion_type":"SOME_STRING_VALUE","product_ids":"SOME_ARRAY_VALUE","event_id":"SOME_STRING_VALUE","limit":"SOME_INTEGER_VALUE","sort_by":"SOME_STRING_VALUE"}


          headers = {''authorization'': ''Bearer REPLACE_BEARER_TOKEN''}


          response = requests.request("GET", url, headers=headers, params=querystring)


          print(response.text)'
      description: Get eligible products
  /api/v3/promotions/campaigns/{id}/cancel:
    put:
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PromotionsCampaign'
          description: successfully cancelled a campaign
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
          description: failed to cancel a campaign
      parameters:
      - required: true
        in: path
        description: ID of the campaign you want to Cancel
        name: id
        schema:
          type: string
          format: object-id
      tags:
      - Promotions Platform
      summary: Cancel a promotion campaign
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CancelPromotionsCampaign'
      security:
      - OAuth2:
        - promotions:write
      operationId: cancelPromotionsCampaign
      x-code-samples:
      - lang: java_unirest
        source: "HttpResponse<String> response = Unirest.put(\"https://merchant.wish.com/api/v3/promotions/campaigns/{id}/cancel\")\n  .header(\"content-type\", \"application/json\")\n  .header(\"authorization\", \"Bearer REPLACE_BEARER_TOKEN\")\n  .body(\"{\\\"comment\\\":\\\"string\\\",\\\"reason\\\":\\\"WRONG_PRODUCTS\\\"}\")\n  .asString();"
      - lang: php_curl
        source: "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n  CURLOPT_URL => \"https://merchant.wish.com/api/v3/promotions/campaigns/{id}/cancel\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PUT\",\n  CURLOPT_POSTFIELDS => \"{\\\"comment\\\":\\\"string\\\",\\\"reason\\\":\\\"WRONG_PRODUCTS\\\"}\",\n  CURLOPT_HTTPHEADER => array(\n    \"authorization: Bearer REPLACE_BEARER_TOKEN\",\n    \"content-type: application/json\"\n  ),\n));\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"
      - lang: javascript_jquery
        source: "var settings = {\n  \"async\": true,\n  \"crossDomain\": true,\n  \"url\": \"https://merchant.wish.com/api/v3/promotions/campaigns/{id}/cancel\",\n  \"method\": \"PUT\",\n  \"headers\": {\n    \"content-type\": \"application/json\",\n    \"authorization\": \"Bearer REPLACE_BEARER_TOKEN\"\n  },\n  \"processData\": false,\n  \"data\": \"{\\\"comment\\\":\\\"string\\\",\\\"reason\\\":\\\"WRONG_PRODUCTS\\\"}\"\n}\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"
      - lang: shell_curl
        source: "curl --request PUT \\\n  --url 'https://merchant.wish.com/api/v3/promotions/campaigns/{id}/cancel' \\\n  --header 'authorization: Bearer REPLACE_BEARER_TOKEN' \\\n  --header 'content-type: application/json' \\\n  --data '{\"comment\":\"string\",\"reason\":\"WRONG_PRODUCTS\"}'"
      - lang: python_requests
        source: "import requests\n\nurl = \"https://merchant.wish.com/api/v3/promotions/campaigns/{id}/cancel\"\n\npayload = \"{\\\"comment\\\":\\\"string\\\",\\\"reason\\\":\\\"WRONG_PRODUCTS\\\"}\"\nheaders = {\n    'content-type': \"application/json\",\n    'authorization': \"Bearer REPLACE_BEARER_TOKEN\"\n    }\n\nresponse = requests.request(\"PUT\", url, data=payload, headers=headers)\n\nprint(response.text)"
      description: Cancel a promotion campaign.
  /api/v3/promotions/campaigns:
    post:
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PromotionsCampaign'
          description: successfully created a campaign
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
          description: failed to create a campaign
      tags:
      - Promotions Platform
      summary: Create a promotion campaign
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePromotionsCampaign'
      security:
      - OAuth2:
        - promotions:write
      operationId: createPromotionsCampaign
      x-code-samples:
      - lang: java_unirest
        source: "HttpResponse<String> response = Unirest.post(\"https://merchant.wish.com/api/v3/promotions/campaigns\")\n  .header(\"content-type\", \"application/json\")\n  .header(\"authorization\", \"Bearer REPLACE_BEARER_TOKEN\")\n  .body(\"{\\\"countries\\\":[\\\"US\\\"],\\\"end_at\\\":\\\"2022-04-20T07:00:00Z\\\",\\\"event_id\\\":\\\"string\\\",\\\"name\\\":\\\"string\\\",\\\"promotion_type\\\":\\\"DISCOUNT\\\",\\\"start_at\\\":\\\"2022-04-13T07:00:00Z\\\",\\\"variations_discount_data\\\":{\\\"default_discount_percentage\\\":5,\\\"default_max_quantity\\\":0,\\\"discount_data\\\":[{\\\"discount_percentage\\\":5,\\\"max_quantity\\\":0,\\\"product_id\\\":\\\"string\\\",\\\"variation_id\\\":\\\"string\\\"}]}}\")\n  .asString();"
      - lang: php_curl
        source: "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n  CURLOPT_URL => \"https://merchant.wish.com/api/v3/promotions/campaigns\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => \"{\\\"countries\\\":[\\\"US\\\"],\\\"end_at\\\":\\\"2022-04-20T07:00:00Z\\\",\\\"event_id\\\":\\\"string\\\",\\\"name\\\":\\\"string\\\",\\\"promotion_type\\\":\\\"DISCOUNT\\\",\\\"start_at\\\":\\\"2022-04-13T07:00:00Z\\\",\\\"variations_discount_data\\\":{\\\"default_discount_percentage\\\":5,\\\"default_max_quantity\\\":0,\\\"discount_data\\\":[{\\\"discount_percentage\\\":5,\\\"max_quantity\\\":0,\\\"product_id\\\":\\\"string\\\",\\\"variation_id\\\":\\\"string\\\"}]}}\",\n  CURLOPT_HTTPHEADER => array(\n    \"authorization: Bearer REPLACE_BEARER_TOKEN\",\n    \"content-type: application/json\"\n  ),\n));\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"
      - lang: javascript_jquery
        source: "var settings = {\n  \"async\": true,\n  \"crossDomain\": true,\n  \"url\": \"https://merchant.wish.com/api/v3/promotions/campaigns\",\n  \"method\": \"POST\",\n  \"headers\": {\n    \"content-type\": \"application/json\",\n    \"authorization\": \"Bearer REPLACE_BEARER_TOKEN\"\n  },\n  \"processData\": false,\n  \"data\": \"{\\\"countries\\\":[\\\"US\\\"],\\\"end_at\\\":\\\"2022-04-20T07:00:00Z\\\",\\\"event_id\\\":\\\"string\\\",\\\"name\\\":\\\"string\\\",\\\"promotion_type\\\":\\\"DISCOUNT\\\",\\\"start_at\\\":\\\"2022-04-13T07:00:00Z\\\",\\\"variations_discount_data\\\":{\\\"default_discount_percentage\\\":5,\\\"default_max_quantity\\\":0,\\\"discount_data\\\":[{\\\"discount_percentage\\\":5,\\\"max_quantity\\\":0,\\\"product_id\\\":\\\"string\\\",\\\"variation_id\\\":\\\"string\\\"}]}}\"\n}\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"
      - lang: shell_curl
        source: "curl --request POST \\\n  --url 'https://merchant.wish.com/api/v3/promotions/campaigns' \\\n  --header 'authorization: Bearer REPLACE_BEARER_TOKEN' \\\n  --header 'content-type: application/json' \\\n  --data '{\"countries\":[\"US\"],\"end_at\":\"2022-04-20T07:00:00Z\",\"event_id\":\"string\",\"name\":\"string\",\"promotion_type\":\"DISCOUNT\",\"start_at\":\"2022-04-13T07:00:00Z\",\"variations_discount_data\":{\"default_discount_percentage\":5,\"default_max_quantity\":0,\"discount_data\":[{\"discount_percentage\":5,\"max_quantity\":0,\"product_id\":\"string\",\"variation_id\":\"string\"}]}}'"
      - lang: python_requests
        source: "import requests\n\nurl = \"https://merchant.wish.com/api/v3/promotions/campaigns\"\n\npayload = \"{\\\"countries\\\":[\\\"US\\\"],\\\"end_at\\\":\\\"2022-04-20T07:00:00Z\\\",\\\"event_id\\\":\\\"string\\\",\\\"name\\\":\\\"string\\\",\\\"promotion_type\\\":\\\"DISCOUNT\\\",\\\"start_at\\\":\\\"2022-04-13T07:00:00Z\\\",\\\"variations_discount_data\\\":{\\\"default_discount_percentage\\\":5,\\\"default_max_quantity\\\":0,\\\"discount_data\\\":[{\\\"discount_percentage\\\":5,\\\"max_quantity\\\":0,\\\"product_id\\\":\\\"string\\\",\\\"variation_id\\\":\\\"string\\\"}]}}\"\nheaders = {\n    'content-type': \"application/json\",\n    'authorization': \"Bearer REPLACE_BEARER_TOKEN\"\n    }\n\nresponse = requests.request(\"POST\", url, data=payload, headers=headers)\n\nprint(response.text)"
      description: Create a promotion campaign.
    get:
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/PromotionsCampaign'
                type: array
          description: successfully queried for campaigns
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
          description: failed to query for campaigns
      parameters:
      - in: query
        example: '2022-04-13T07:00:00Z'
        description: Only return campaigns that start at or after this time.
        name: start_at_min
        schema:
          type: string
          format: date-time
      - in: query
        example: '2022-04-14T07:00:00Z'
        description: Only return campaigns that start at or before this time.
        name: start_at_max
        schema:
          type: string
          format: date-time
      - in: query
        example: '2022-04-20T07:00:00Z'
        description: Only return campaigns that end on or after this time.
        name: end_at_min
        schema:
          type: string
          format: date-time
      - in: query
        example: '2022-04-21T07:00:00Z'
        description: Only return campaigns that end on or before this time.
        name: end_at_max
        schema:
          type: string
          format: date-time
      - in: query
        example: '2022-04-12T07:00:00.000Z'
        description: Specify the beginning of the time window to view desired campaigns when filtering by campaign creation time. Campaigns created before this time will not show.
        name: created_at_min
        schema:
          type: string
          format: date-time
      - in: query
        example: '2022-04-13T07:00:00.000Z'
        description: Specify the end of the time window to view desired campaigns when filtering by campaign creation time. Campaigns created after this time will not show.
        name: created_at_max
        schema:
          type: string
          format: date-time
      - in: query
        description: Restrict campaigns within provided states. Usually used with start_at_min/max and end_at_min/max filters.
        name: states
        schema:
          items:
            $ref: '#/components/schemas/PromotionsCampaignState'
          type: array
      - in: query
        description: Restrict campaigns within provided promotion types
        name: promotion_types
        schema:
          items:
            $ref: '#/components/schemas/PromotionType'
          type: array
      - in: query
        description: ID of the product that result campaigns should include.
        name: product_id
        schema:
          type: string
          format: object-id
      - in: query
        description: Name of the campaigns that result campaigns should include.
        name: name
        schema:
          minLength: 1
          type: string
          maxLength: 300
      - in: query
        description: A limit on the number of campaigns that will be returned.
        name: limit
        schema:
          default: 25
          minimum: 1
          type: integer
          maximum: 200
      - in: query
        description: Only 3 fields are enabled for sorting:`start_at`, `end_at` or `created_at`. Default order is `desc`, use `asc` to sort in reverse.
        name: sort_by
        schema:
          default: end_at.desc
          pattern: ^(start_at|end_at|created_at)(\.(asc|desc))?$
          type: string
      tags:
      - Promotions Platform
      summary: List promotion campaigns
      security:
      - OAuth2:
        - promotions:read
      operationId: listPromotionsCampaigns
      x-code-samples:
      - lang: java_unirest
        source: "HttpResponse<String> response = Unirest.get(\"https://merchant.wish.com/api/v3/promotions/campaigns?start_at_min=SOME_STRING_VALUE&start_at_max=SOME_STRING_VALUE&end_at_min=SOME_STRING_VALUE&end_at_max=SOME_STRING_VALUE&created_at_min=SOME_STRING_VALUE&created_at_max=SOME_STRING_VALUE&states=SOME_ARRAY_VALUE&promotion_types=SOME_ARRAY_VALUE&product_id=SOME_STRING_VALUE&name=SOME_STRING_VALUE&limit=SOME_INTEGER_VALUE&sort_by=SOME_STRING_VALUE\")\n  .header(\"authorization\", \"Bearer REPLACE_BEARER_TOKEN\")\n  .asString();"
      - lang: php_curl
        source: "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n  CURLOPT_URL => \"https://merchant.wish.com/api/v3/promotions/campaigns?start_at_min=SOME_STRING_VALUE&start_at_max=SOME_STRING_VALUE&end_at_min=SOME_STRING_VALUE&end_at_max=SOME_STRING_VALUE&created_at_min=SOME_STRING_VALUE&created_at_max=SOME_STRING_VALUE&states=SOME_ARRAY_VALUE&promotion_types=SOME_ARRAY_VALUE&product_id=SOME_STRING_VALUE&name=SOME_STRING_VALUE&limit=SOME_INTEGER_VALUE&sort_by=SOME_STRING_VALUE\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => array(\n    \"authorization: Bearer REPLACE_BEARER_TOKEN\"\n  ),\n));\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"
      - lang: javascript_jquery
        source: "var settings = {\n  \"async\": true,\n  \"crossDomain\": true,\n  \"url\": \"https://merchant.wish.com/api/v3/promotions/campaigns?start_at_min=SOME_STRING_VALUE&start_at_max=SOME_STRING_VALUE&end_at_min=SOME_STRING_VALUE&end_at_max=SOME_STRING_VALUE&created_at_min=SOME_STRING_VALUE&created_at_max=SOME_STRING_VALUE&states=SOME_ARRAY_VALUE&promotion_types=SOME_ARRAY_VALUE&product_id=SOME_STRING_VALUE&name=SOME_STRING_VALUE&limit=SOME_INTEGER_VALUE&sort_by=SOME_STRING_VALUE\",\n  \"method\": \"GET\",\n  \"headers\": {\n    \"authorization\": \"Bearer REPLACE_BEARER_TOKEN\"\n  }\n}\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"
      - lang: shell_curl
        source: "curl --request GET \\\n  --url 'https://merchant.wish.com/api/v3/promotions/campaigns?start_at_min=SOME_STRING_VALUE&start_at_max=SOME_STRING_VALUE&end_at_min=SOME_STRING_VALUE&end_at_max=SOME_STRING_VALUE&created_at_min=SOME_STRING_VALUE&created_at_max=SOME_STRING_VALUE&states=SOME_ARRAY_VALUE&promotion_types=SOME_ARRAY_VALUE&product_id=SOME_STRING_VALUE&name=SOME_STRING_VALUE&limit=SOME_INTEGER_VALUE&sort_by=SOME_STRING_VALUE' \\\n  --header 'authorization: Bearer REPLACE_BEARER_TOKEN'"
      - lang: python_requests
        source: 'import requests


          url = "https://merchant.wish.com/api/v3/promotions/campaigns"


          querystring = {"start_at_min":"SOME_STRING_VALUE","start_at_max":"SOME_STRING_VALUE","end_at_min":"SOME_STRING_VALUE","end_at_max":"SOME_STRING_VALUE","created_at_min":"SOME_STRING_VALUE","created_at_max":"SOME_STRING_VALUE","states":"SOME_ARRAY_VALUE","promotion_types":"SOME_ARRAY_VALUE","product_id":"SOME_STRING_VALUE","name":"SOME_STRING_VALUE","limit":"SOME_INTEGER_VALUE","sort_by":"SOME_STRING_VALUE"}


          headers = {''authorization'': ''Bearer REPLACE_BEARER_TOKEN''}


          response = requests.request("GET", url, headers=headers, params=querystring)


          print(response.text)'
      description: List promotion campaigns
  /api/v3/promotions/campaigns/{id}:
    put:
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PromotionsCampaign'
          description: successfully updated a campaign
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
          description: failed to update a campaign
      parameters:
      - required: true
        in: path
        description: ID of the campaign you want to update
        name: id
        schema:
          type: string
          format: object-id
      tags:
      - Promotions Platform
      summary: Update a promotion campaign
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdatePromotionsCampaign'
      security:
      - OAuth2:
        - promotions:write
      operationId: updatePromotionsCampaign
      x-code-samples:
      - lang: java_unirest
        source: "HttpResponse<String> response = Unirest.put(\"https://merchant.wish.com/api/v3/promotions/campaigns/{id}\")\n  .header(\"content-type\", \"application/json\")\n  .header(\"authorization\", \"Bearer REPLACE_BEARER_TOKEN\")\n  .body(\"{\\\"variations_discount_data\\\":{\\\"default_discount_percentage\\\":5,\\\"default_max_quantity\\\":0,\\\"discount_data\\\":[{\\\"discount_percentage\\\":5,\\\"max_quantity\\\":0,\\\"product_id\\\":\\\"string\\\",\\\"variation_id\\\":\\\"string\\\"}]}}\")\n  .asString();"
      - lang: php_curl
        source: "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n  CURLOPT_URL => \"https://merchant.wish.com/api/v3/promotions/campaigns/{id}\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PUT\",\n  CURLOPT_POSTFIELDS => \"{\\\"variations_discount_data\\\":{\\\"default_discount_percentage\\\":5,\\\"default_max_quantity\\\":0,\\\"discount_data\\\":[{\\\"discount_percentage\\\":5,\\\"max_quantity\\\":0,\\\"product_id\\\":\\\"string\\\",\\\"variation_id\\\":\\\"string\\\"}]}}\",\n  CURLOPT_HTTPHEADER => array(\n    \"authorization: Bearer REPLACE_BEARER_TOKEN\",\n    \"content-type: application/json\"\n  ),\n));\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"
      - lang: javascript_jquery
        source: "var settings = {\n  \"async\": true,\n  \"crossDomain\": true,\n  \"url\": \"https://merchant.wish.com/api/v3/promotions/campaigns/{id}\",\n  \"method\": \"PUT\",\n  \"headers\": {\n    \"content-type\": \"application/json\",\n    \"authorization\": \"Bearer REPLACE_BEARER_TOKEN\"\n  },\n  \"processData\": false,\n  \"data\": \"{\\\"variations_discount_data\\\":{\\\"default_discount_percentage\\\":5,\\\"default_max_quantity\\\":0,\\\"discount_data\\\":[{\\\"discount_percentage\\\":5,\\\"max_quantity\\\":0,\\\"product_id\\\":\\\"string\\\",\\\"variation_id\\\":\\\"string\\\"}]}}\"\n}\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});"
      - lang: shell_curl
        

# --- truncated at 32 KB (64 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/wish/refs/heads/main/openapi/wish-promotions-platform-api-openapi.yml