Get campaign

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

Overview

Retrieve one or more campaigns for a site by campaign ID or campaign key. This endpoint is public — it only requires the site_id — and is typically used to resolve the plan and coupon attached to a promotional campaign before presenting the offer to a customer.

Provide exactly one identifier:

  • campaign_id — returns the single campaign with that ID.
  • campaign_key — returns every campaign whose run matches that key.

Results are always scoped to the site. A valid request that matches nothing returns an empty campaigns array with HTTP 200 — it is not treated as an error. The only 404 is returned when neither campaign_id nor campaign_key is supplied.

Each campaign in the response embeds its full plan (including the parent product) and its coupon, when one is attached (coupon is null otherwise).

Example:

curl --request GET \
  --url 'https://www.pelcro.com/api/v1/sdk/campaign?site_id=1037&campaign_id=1035'
{
  "error": false,
  "data": {
    "campaigns": [
      {
        "id": 1035,
        "name": "Campaign-Me",
        "plan": {
          "id": 1023,
          "nickname": "Daily",
          "interval": "day",
          "interval_count": 1,
          "amount": 2400,
          "currency": "usd",
          "auto_renew": true,
          "type": "regular",
          "product": { "id": 1036, "name": "Consulting Services" }
        },
        "coupon": {
          "id": 1038,
          "code": "VAMOS",
          "discount_type": "percentage",
          "percent_off": 50,
          "valid": true
        }
      }
    ]
  }
}
📘

Looking up by key

A campaign key is matched against campaign runs, then the campaigns behind those runs are returned. Several campaigns can share a key, so campaign_key may return more than one campaign while campaign_id returns at most one.

Query Params
int32
required
int32
string
string
enum
Defaults to en
Allowed:
Headers
string
Defaults to application/json
Responses

Language
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json