> ## Documentation Index
> Fetch the complete documentation index at: https://docs.withbenji.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Campaign Eligibility

> Evaluate which campaigns and offers a user is eligible for within a partnership

> [!NOTE]
>
> This endpoint requires both your **partner API key** in the `x-api-key` header and a Bearer token in the `Authorization` header. The Bearer token is the user access token obtained after a successful [Benji Connect SDK](https://docs.withbenji.com/connect/methods.md#onsuccess) `onSuccess` callback. See [Exchange Token](https://docs.withbenji.com/connect/exchange_token.md) and [API Authentication](https://docs.withbenji.com/api-reference/authentication.md). Partner API keys can be generated through the dashboard.

**x-api-key** `string` *required*

Your partner API key, generated through the dashboard. Required together with `Authorization`.

**Authorization** `string` *required*

A `Bearer` user access token obtained after the [Benji Connect SDK](https://docs.withbenji.com/connect/methods.md#onsuccess) `onSuccess` callback. Required together with `x-api-key`. See [Exchange Token](https://docs.withbenji.com/connect/exchange_token.md).

**partnership\_id** `string` *required*

The UUID of the partnership to evaluate. Only active campaigns that belong to this partnership are considered.

**user\_id** `integer` *required*

The Benji Platform identifier of the user to evaluate eligibility for.

**campaign\_type** `integer`

Restricts the evaluation to one campaign type. If omitted, campaigns of every type are evaluated.

**possible campaign type values**

* **EARN (1)** : Campaigns that reward users with points \\

* **REDEEM (2)** : Campaigns that let users spend points on a perk or discount \\

* **CONNECT\_ONLY (3)** : Campaigns that only require connecting an account \\

* **TRANSFER (4)** : Campaigns that transfer points between programs

**transaction\_context** `object`

Additional context used to evaluate the campaign conditions. For `REDEEM` perk flows, include the offers you want to evaluate.

**properties**

**offer\_ids** `array`

Non-empty list of unique offer IDs (strings) to evaluate, for example `["sku-1"]`. Required to evaluate `REDEEM` perk offers.

**campaign\_flow\_ids** `array`

Optional list of campaign flow IDs. When set, only these flows are evaluated. Use this when more than one active flow could match the same offer.

**coupon\_code** `string`

Optional coupon code to validate against the evaluated `REDEEM` perk offers. The result of the check is returned in `coupon_valid`.

**trigger\_id** `integer`

Restricts the evaluation to campaign flows that use this trigger.

**trigger\_event\_id** `integer`

The ID of an existing trigger event. When sent together with `trigger_id`, the evaluation uses the transaction context stored on that trigger event.

**extra\_data** `object`

Optional user payload, in the same shape as the [Get User](https://docs.withbenji.com/api-reference/endpoint/users/get.md) response. When provided, Benji does not look the user up again before evaluating eligibility.

### Response

**campaigns\_eligibility** `array` *required*

One entry per evaluated campaign flow (or per offer, for `REDEEM` perk flows). An empty array is returned when the partnership does not exist or has no live campaign flows that match the request.

**properties**

**campaign\_id** `integer` *required*

The ID of the campaign that was evaluated.

**campaign\_flow\_id** `integer` *required*

The ID of the campaign flow that was evaluated.

**is\_eligible** `boolean` *required*

Whether the user is eligible for this campaign flow.

**failure\_reasons** `array` *required*

Human-readable messages explaining why the user is not eligible. Empty when `is_eligible` is `true`.

**failure\_reason\_id** `integer`

Integer representing the reason the user is not eligible. `null` when the user is eligible.

**possible failure reason values**

* **INCOMPLETE\_TRANSACTION\_CONTEXT (1)** \\

* **TRANSACTION\_AMOUNT\_CONDITION\_FAILED (2)** \\

* **ITEM\_PRICE\_CONDITION\_FAILED (3)** \\

* **PRODUCT\_CONDITION\_FAILED (4)** \\

* **STATUS\_TIER\_CONDITION\_FAILED (5)** \\

* **CUSTOM\_ATTRIBUTE\_CONDITION\_FAILED (6)** \\

* **TRANSACTION\_SESSION\_INCOMPLETE (7)** \\

* **USER\_LIMIT\_EXCEEDED (8)** \\

* **USER\_LIMIT\_MINIMUM\_NOT\_MET (9)** \\

* **OUT\_OF\_STOCK (10)** \\

* **INSUFFICIENT\_FUNDS (11)** \\

* **REQUIRES\_LOGIN (12)** \\

* **USER\_BLOCKED (13)**

**base\_reward\_amount** `number` *required*

The reward amount of the flow before multipliers and discounts are applied. For `REDEEM` perk offers this is the points price.

**reward\_amount** `number` *required*

The reward amount after multipliers and discounts are applied. For `REDEEM` perk offers this is the points the user pays.

**multiplier\_id** `integer`

The ID of the multiplier applied to the reward, if any.

**trigger\_event\_id** `integer`

The ID of the trigger event used for the evaluation, if any.

**action\_partner\_id** `integer`

The ID of the partner that owns the eligible action.

**offer\_id** `string`

The ID of the evaluated offer. Only returned for `REDEEM` perk flows.

**redemption\_token** `string`

A single-use token that authorizes the redemption of this offer. Only returned when `is_eligible` is `true` for a `REDEEM` perk offer, and expires after 600 seconds (10 minutes). Pass this token to [Add Item to Cart](https://docs.withbenji.com/api-reference/endpoint/users/add-cart-item.md) or [Redeem by Token](https://docs.withbenji.com/api-reference/endpoint/transactions/redeem.md). It is not the token used by [Redeem Cart by Token](https://docs.withbenji.com/api-reference/endpoint/transactions/redeem-cart-by-token.md).

**points\_price\_after\_discount** `number`

The points price of the offer after discounts, if a discount applies.

**coupon\_valid** `boolean` *required*

Whether the `coupon_code` sent in the request is valid for this offer. `false` when no coupon code was sent.

**coupon\_id** `string`

The ID of the coupon applied to the offer, if any.

**coupon\_group\_name** `string`

The name of the coupon group the applied coupon belongs to, if any.

**user\_max\_limit** `integer`

The number of units of this offer the user can still redeem.

**user\_personal\_max\_limit** `integer`

The number of units of this offer the user can still redeem for themselves.

**user\_gift\_max\_limit** `integer`

The number of units of this offer the user can still redeem as gifts.

**available\_count** `integer`

The number of units of this offer currently in stock. `null` when the offer has no stock limit.

**product\_id** `integer`

The ID of the product the offer belongs to. Only returned when the offer belongs to a product with a limit.

**product\_max\_limit** `integer`

The number of units of the product the user can still redeem. Only returned when the offer belongs to a product with a limit.

**product\_personal\_max\_limit** `integer`

The number of units of the product the user can still redeem for themselves. Only returned when the offer belongs to a product with a limit.

**product\_gift\_max\_limit** `integer`

The number of units of the product the user can still redeem as gifts. Only returned when the offer belongs to a product with a limit.

**product\_limit** `object`

The limit configuration of the product the offer belongs to. Only returned when the offer belongs to a product with a limit.

**product limit properties**

**product\_category\_id** `integer` *required*

The ID of the product.

**product\_name** `string`

The name of the product.

**variant\_ids** `array` *required*

The IDs of the offers (variants) that belong to the product.

**limit\_value** `integer`

The maximum number of units of the product a user can redeem in the limit window.

**personal\_limit\_value** `integer`

The maximum number of units of the product a user can redeem for themselves in the limit window.

**trigger\_time\_range** `integer`

Integer representing the time range the limit applies to.

**possible time range values**

* **PER\_DAY (1)** \\

* **PER\_WEEK (2)** \\

* **PER\_MONTH (3)** \\

* **PER\_QUARTER (4)** \\

* **PER\_YEAR (5)** \\

* **CAMPAIGN\_LIFETIME (6)** \\

* **PER\_SIX\_MONTHS (7)**

**time\_window\_mode** `integer`

Integer representing how the limit window is measured.

**possible time window mode values**

* **CALENDAR (1)** : The window follows calendar boundaries (default) \\

* **ELAPSED (2)** : A rolling window anchored on the time of the request

```bash cURL theme={null}
curl --request POST \
  --url https://api-staging.withbenji.com/partnerships/550e8400-e29b-41d4-a716-446655440000/campaigns/eligibility \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <your-partner-api-key>' \
  --header 'Authorization: Bearer <user-access-token>' \
  --data '{
    "user_id": 155,
    "campaign_type": 2,
    "transaction_context": {
      "offer_ids": ["sku-1"]
    }
  }'
```

```json 200 theme={null}
{
    "code": "ok",
    "data": {
        "campaigns_eligibility": [
            {
                "campaign_id": 118,
                "campaign_flow_id": 305,
                "is_eligible": true,
                "failure_reasons": [],
                "failure_reason_id": null,
                "base_reward_amount": 500.0,
                "reward_amount": 450.0,
                "multiplier_id": null,
                "trigger_event_id": null,
                "action_partner_id": 61,
                "offer_id": "sku-1",
                "redemption_token": "3f6c0a52-8d1e-4f0b-9a57-0b6f2f7a7c11",
                "points_price_after_discount": 450.0,
                "coupon_valid": false,
                "coupon_id": null,
                "coupon_group_name": null,
                "user_max_limit": 3,
                "user_personal_max_limit": null,
                "user_gift_max_limit": null,
                "available_count": 25
            },
            {
                "campaign_id": 118,
                "campaign_flow_id": 306,
                "is_eligible": false,
                "failure_reasons": [
                    "Loyalty points balance 120 is too low for cost 800"
                ],
                "failure_reason_id": 11,
                "base_reward_amount": 800.0,
                "reward_amount": 800.0,
                "multiplier_id": null,
                "trigger_event_id": null,
                "action_partner_id": 61,
                "offer_id": "sku-2",
                "redemption_token": null,
                "points_price_after_discount": null,
                "coupon_valid": false,
                "coupon_id": null,
                "coupon_group_name": null,
                "user_max_limit": null,
                "user_personal_max_limit": null,
                "user_gift_max_limit": null,
                "available_count": 25
            }
        ]
    }
}
```

```json 400 theme={null}
{
  "code": "partnership_trigger_event_reward_transaction_already_exists_error",
  "message": "Partnership trigger event reward transaction already exists"
}
```

```json 401 theme={null}
{
  "code": "unauthorized_error",
  "message": "Unauthorized."
}
```

```json 422 theme={null}
{
  "code": 422,
  "status": "Unprocessable Entity",
  "errors": {
    "json": {
      "user_id": ["Missing data for required field."]
    }
  }
}
```

```json 500 theme={null}
{
  "code": "user_eligibility_data_unavailable",
  "message": "Unable to load eligibility data for user 155."
}
```

> [!TIP]
>
> Evaluating eligibility for a `REDEEM` perk offer issues a new `redemption_token` for every eligible offer. Each token is single-use and lasts 600 seconds (10 minutes). Use it with [Add Item to Cart](https://docs.withbenji.com/api-reference/endpoint/users/add-cart-item.md) or [Redeem by Token](https://docs.withbenji.com/api-reference/endpoint/transactions/redeem.md). Request eligibility again if a token expires or has already been consumed.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.