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

# List earning rules

Retrieves a paginated list of active earning rules (campaigns) for your organisation. Results are sorted by `created_at` in descending order.

**GET /public/earning-rules**

#### **Authorizations**

**Authorization**

**string**

**header**

**required**

Bearer authentication header of the form `Bearer <token>`, where `<token>` is your REST API token.

#### **Query Parameters**

**campaign\_type**

**enum\<string>**

Filter results to only earning rules of the given type.

Available options:

`purchase`,

`signup`,

`review`,

`daily_visit`,

`birthday`,

`anniversary`,

`twitter_follow`,

`twitter_share`,

`instagram_follow`,

`instagram_share`,

`facebook_like`,

`facebook_share`,

`newsletter_subscribe`

**per\_page**

**integer**

**default: 20**

The number of results per page.

Required range: `1 <= x <= 100`

**page**

**integer**

**default: 1**

The page number to retrieve.

#### **Response**

**200 - application/json**

**data**

**object\[]**

Hide child attributes

**data.id**

**string\<uuid>**

Unique UUID identifier for the earning rule.

Example:

`"a1b2c3d4-e5f6-7890-abcd-ef1234567890"`

**data.name**

**string**

The display name of the earning rule.

Example:

`"Place an order"`

**data.description**

**string | null**

A short description shown to customers.

Example:

`"Earn 5 points for every $1 spent."`

**data.campaign\_type**

**enum\<string>**

The type of action that triggers this earning rule.

Example:

`"purchase"`

**data.earning\_rule**

**object | null**

Defines how points are calculated when the rule is triggered.

Show child attributes

**data.earning\_rule.type**

**enum\<string>**

The method used to calculate points awarded.

Available options:

`fixed`,

`variable`

Example:

`"variable"`

**data.earning\_rule.value**

**number**

Points awarded. For `variable` type, this is points earned per `per_amount` unit.

Example:

`5`

**data.earning\_rule.per\_amount**

**number | null**

Only present for `variable` type. The unit amount required to earn the `value` of points.

Example:

`1`

**data.conditions**

**object | null**

Optional conditions that must be met for the rule to trigger.

Example:

`null`

**data.is\_active**

**boolean**

Whether this earning rule is currently active.

Example:

`true`

**data.created\_at**

**string\<date-time>**

Example:

`"2026-01-10T09:00:00.000Z"`

**meta**

**object**

Hide child attributes

**meta.pagination**

**object**

Hide child attributes

**meta.pagination.current\_page**

**integer**

Example:

`1`

**meta.pagination.per\_page**

**integer**

Example:

`20`

**meta.pagination.total**

**integer**

Example:

`4`

**meta.pagination.last\_page**

**integer**

Example:

`1`

**meta.pagination.has\_more**

**boolean**

Example:

`false`

<RequestExample>
  ```bash cURL theme={null}
  curl --request GET \
    --url "https://api.yukoapp.com/api/v1/public/earning-rules?campaign_type=purchase" \
    --header "Authorization: Bearer py_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  ```

  ```javascript JavaScript theme={null}
  const params = new URLSearchParams({ campaign_type: "purchase" });

  const response = await fetch(
    `https://api.yukoapp.com/api/v1/public/earning-rules?${params}`,
    {
      method: "GET",
      headers: {
        Authorization: "Bearer py_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
      },
    }
  );

  const data = await response.json();
  ```

  ```php PHP theme={null}
  $query = http_build_query(["campaign_type" => "purchase"]);

  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, "https://api.yukoapp.com/api/v1/public/earning-rules?{$query}");
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_HTTPHEADER, [
      "Authorization: Bearer py_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  ]);

  $response = curl_exec($ch);
  curl_close($ch);

  $data = json_decode($response, true);
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "data": [
      {
        "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "name": "Place an order",
        "description": "Earn 5 points for every $1 spent.",
        "campaign_type": "purchase",
        "earning_rule": {
          "type": "variable",
          "value": 5,
          "per_amount": 1
        },
        "conditions": null,
        "is_active": true,
        "created_at": "2026-01-10T09:00:00.000Z"
      },
      {
        "id": "b2c3d4e5-f6a7-8901-bcde-f01234567890",
        "name": "Sign up",
        "description": "Earn 200 points when you create an account.",
        "campaign_type": "signup",
        "earning_rule": {
          "type": "fixed",
          "value": 200,
          "per_amount": null
        },
        "conditions": null,
        "is_active": true,
        "created_at": "2026-01-10T09:00:00.000Z"
      }
    ],
    "meta": {
      "pagination": {
        "current_page": 1,
        "per_page": 20,
        "total": 2,
        "last_page": 1,
        "has_more": false
      }
    }
  }
  ```

  ```json 401 theme={null}
  {
    "error": {
      "code": "invalid_token",
      "message": "Invalid or revoked API token"
    }
  }
  ```
</ResponseExample>
