Skip to main content
GET
/
earning_rules
List earning rules
curl --request GET \
  --url https://api.smile.io/v1/earning_rules \
  --header 'Authorization: Bearer <token>'
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://api.smile.io/v1/earning_rules"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.smile.io/v1/earning_rules")
.header("Authorization", "Bearer <token>")
.asString();
const url = 'https://api.smile.io/v1/earning_rules';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.smile.io/v1/earning_rules",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
$headers=@{}
$headers.Add("Authorization", "Bearer <token>")
$response = Invoke-WebRequest -Uri 'https://api.smile.io/v1/earning_rules' -Method GET -Headers $headers
import requests

url = "https://api.smile.io/v1/earning_rules"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
require 'uri'
require 'net/http'

url = URI("https://api.smile.io/v1/earning_rules")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
{
  "earning_rules": [
    {
      "id": 739246764,
      "name": "Place an order",
      "image_url": "https://platform.smile.io/images/earning/order-online.svg",
      "action_text": null,
      "action_url": null,
      "restricted_to_vip_tier_ids": [
        426715799
      ],
      "reward": {
        "type": "points"
      },
      "reward_value": {
        "type": "variable",
        "variable": {
          "value": 5,
          "per_amount": 1
        },
        "fixed": {
          "value": 100
        }
      },
      "earning_limit": {
        "max": 5,
        "type": "rolling",
        "rolling": {
          "unit": "day",
          "unit_count": 30
        }
      }
    }
  ],
  "metadata": {
    "next_cursor": "aWQ6MixkaXJlY3Rpb246bmV4dA==",
    "previous_cursor": ""
  }
}
This endpoint requires the scope.
Results are sorted by id in descending order.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

limit
integer
default:50

The maximum number of earning rules to retrieve.

Required range: 1 <= x <= 250
cursor
string

Cursor for the page of earning rules to retrieve.

Response

200 - application/json
earning_rules
object[]
metadata
object