Get campaign

Retrieve campaigns by campaign_id or campaign_key. Provide exactly one identifier: campaign_id returns the matching campaign, while campaign_key returns every campaign whose run matches that key. Results are scoped to the site, and an unknown identifier yields an empty campaigns array (HTTP 200).

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

The unique identifier of the site associated with your account.

int32

The campaign unique identifier. Required if campaign_key is not provided.

string

The campaign key. This will search and retrieve campaigns by associated runs. Required if campaign_id is not provided.

string
enum
Defaults to en

Optional. Two-letter ISO 639-1 language code used to localize response messages. Supported values: en, fr, it, ko, es, de. Defaults to en; an unsupported value falls back to en.

Allowed:
Responses

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