| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
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 keyA campaign key is matched against campaign runs, then the campaigns behind those runs are returned. Several campaigns can share a key, so
campaign_keymay return more than one campaign whilecampaign_idreturns at most one.
