curl --request POST \
--url https://admin.snagsolutions.io/api/loyalty/currencies \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"organizationId": "123e4567-e89b-12d3-a456-426614174001",
"websiteId": "123e4567-e89b-12d3-a456-426614174002",
"name": "Loyalty Points",
"symbol": "LP",
"decimals": 2,
"imageUrl": "https://d1ked0nzx7in3u.cloudfront.net/images/loyalty.png",
"apiGetUrl": "https://api.example.com/get-loyalty",
"apiGetTransactionEntryUrl": "https://api.example.com/get-loyalty-tx",
"apiPostUrl": "https://api.example.com/post-loyalty",
"sortId": 1,
"apiAuthType": "basic",
"apiAuthKey": "apiKey123",
"apiAuthValue": "apiValue456"
}
'import requests
url = "https://admin.snagsolutions.io/api/loyalty/currencies"
payload = {
"organizationId": "123e4567-e89b-12d3-a456-426614174001",
"websiteId": "123e4567-e89b-12d3-a456-426614174002",
"name": "Loyalty Points",
"symbol": "LP",
"decimals": 2,
"imageUrl": "https://d1ked0nzx7in3u.cloudfront.net/images/loyalty.png",
"apiGetUrl": "https://api.example.com/get-loyalty",
"apiGetTransactionEntryUrl": "https://api.example.com/get-loyalty-tx",
"apiPostUrl": "https://api.example.com/post-loyalty",
"sortId": 1,
"apiAuthType": "basic",
"apiAuthKey": "apiKey123",
"apiAuthValue": "apiValue456"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
organizationId: '123e4567-e89b-12d3-a456-426614174001',
websiteId: '123e4567-e89b-12d3-a456-426614174002',
name: 'Loyalty Points',
symbol: 'LP',
decimals: 2,
imageUrl: 'https://d1ked0nzx7in3u.cloudfront.net/images/loyalty.png',
apiGetUrl: 'https://api.example.com/get-loyalty',
apiGetTransactionEntryUrl: 'https://api.example.com/get-loyalty-tx',
apiPostUrl: 'https://api.example.com/post-loyalty',
sortId: 1,
apiAuthType: 'basic',
apiAuthKey: 'apiKey123',
apiAuthValue: 'apiValue456'
})
};
fetch('https://admin.snagsolutions.io/api/loyalty/currencies', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://admin.snagsolutions.io/api/loyalty/currencies",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'organizationId' => '123e4567-e89b-12d3-a456-426614174001',
'websiteId' => '123e4567-e89b-12d3-a456-426614174002',
'name' => 'Loyalty Points',
'symbol' => 'LP',
'decimals' => 2,
'imageUrl' => 'https://d1ked0nzx7in3u.cloudfront.net/images/loyalty.png',
'apiGetUrl' => 'https://api.example.com/get-loyalty',
'apiGetTransactionEntryUrl' => 'https://api.example.com/get-loyalty-tx',
'apiPostUrl' => 'https://api.example.com/post-loyalty',
'sortId' => 1,
'apiAuthType' => 'basic',
'apiAuthKey' => 'apiKey123',
'apiAuthValue' => 'apiValue456'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://admin.snagsolutions.io/api/loyalty/currencies"
payload := strings.NewReader("{\n \"organizationId\": \"123e4567-e89b-12d3-a456-426614174001\",\n \"websiteId\": \"123e4567-e89b-12d3-a456-426614174002\",\n \"name\": \"Loyalty Points\",\n \"symbol\": \"LP\",\n \"decimals\": 2,\n \"imageUrl\": \"https://d1ked0nzx7in3u.cloudfront.net/images/loyalty.png\",\n \"apiGetUrl\": \"https://api.example.com/get-loyalty\",\n \"apiGetTransactionEntryUrl\": \"https://api.example.com/get-loyalty-tx\",\n \"apiPostUrl\": \"https://api.example.com/post-loyalty\",\n \"sortId\": 1,\n \"apiAuthType\": \"basic\",\n \"apiAuthKey\": \"apiKey123\",\n \"apiAuthValue\": \"apiValue456\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://admin.snagsolutions.io/api/loyalty/currencies")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"organizationId\": \"123e4567-e89b-12d3-a456-426614174001\",\n \"websiteId\": \"123e4567-e89b-12d3-a456-426614174002\",\n \"name\": \"Loyalty Points\",\n \"symbol\": \"LP\",\n \"decimals\": 2,\n \"imageUrl\": \"https://d1ked0nzx7in3u.cloudfront.net/images/loyalty.png\",\n \"apiGetUrl\": \"https://api.example.com/get-loyalty\",\n \"apiGetTransactionEntryUrl\": \"https://api.example.com/get-loyalty-tx\",\n \"apiPostUrl\": \"https://api.example.com/post-loyalty\",\n \"sortId\": 1,\n \"apiAuthType\": \"basic\",\n \"apiAuthKey\": \"apiKey123\",\n \"apiAuthValue\": \"apiValue456\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://admin.snagsolutions.io/api/loyalty/currencies")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"organizationId\": \"123e4567-e89b-12d3-a456-426614174001\",\n \"websiteId\": \"123e4567-e89b-12d3-a456-426614174002\",\n \"name\": \"Loyalty Points\",\n \"symbol\": \"LP\",\n \"decimals\": 2,\n \"imageUrl\": \"https://d1ked0nzx7in3u.cloudfront.net/images/loyalty.png\",\n \"apiGetUrl\": \"https://api.example.com/get-loyalty\",\n \"apiGetTransactionEntryUrl\": \"https://api.example.com/get-loyalty-tx\",\n \"apiPostUrl\": \"https://api.example.com/post-loyalty\",\n \"sortId\": 1,\n \"apiAuthType\": \"basic\",\n \"apiAuthKey\": \"apiKey123\",\n \"apiAuthValue\": \"apiValue456\"\n}"
response = http.request(request)
puts response.read_body{
"id": "123e4567-e89b-12d3-a456-426614174005",
"organizationId": "123e4567-e89b-12d3-a456-426614174001",
"websiteId": "123e4567-e89b-12d3-a456-426614174002",
"imageUrl": "https://d1ked0nzx7in3u.cloudfront.net/images/loyalty.png",
"name": "Loyalty Points",
"symbol": "LP",
"decimals": 2,
"createdById": "123e4567-e89b-12d3-a456-426614174010",
"createdAt": "2023-10-01T12:34:56.000Z",
"updatedAt": "2023-10-05T15:30:00.000Z",
"apiGetUrl": "https://api.example.com/get-loyalty",
"apiGetTransactionEntryUrl": "https://api.example.com/get-loyalty",
"apiPostUrl": "https://api.example.com/post-loyalty",
"apiAuthType": "basic",
"apiAuthKey": "apiKey123",
"apiAuthValue": "apiValue456",
"sortId": 1,
"deletedAt": null,
"isTokenRewardCurrency": false
}{
"error": "<string>"
}{
"error": "<string>"
}{
"success": false,
"message": "Internal server error",
"debugInfo": "Stack trace or additional error details"
}Create a loyalty currency
Create a loyalty currency
curl --request POST \
--url https://admin.snagsolutions.io/api/loyalty/currencies \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"organizationId": "123e4567-e89b-12d3-a456-426614174001",
"websiteId": "123e4567-e89b-12d3-a456-426614174002",
"name": "Loyalty Points",
"symbol": "LP",
"decimals": 2,
"imageUrl": "https://d1ked0nzx7in3u.cloudfront.net/images/loyalty.png",
"apiGetUrl": "https://api.example.com/get-loyalty",
"apiGetTransactionEntryUrl": "https://api.example.com/get-loyalty-tx",
"apiPostUrl": "https://api.example.com/post-loyalty",
"sortId": 1,
"apiAuthType": "basic",
"apiAuthKey": "apiKey123",
"apiAuthValue": "apiValue456"
}
'import requests
url = "https://admin.snagsolutions.io/api/loyalty/currencies"
payload = {
"organizationId": "123e4567-e89b-12d3-a456-426614174001",
"websiteId": "123e4567-e89b-12d3-a456-426614174002",
"name": "Loyalty Points",
"symbol": "LP",
"decimals": 2,
"imageUrl": "https://d1ked0nzx7in3u.cloudfront.net/images/loyalty.png",
"apiGetUrl": "https://api.example.com/get-loyalty",
"apiGetTransactionEntryUrl": "https://api.example.com/get-loyalty-tx",
"apiPostUrl": "https://api.example.com/post-loyalty",
"sortId": 1,
"apiAuthType": "basic",
"apiAuthKey": "apiKey123",
"apiAuthValue": "apiValue456"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
organizationId: '123e4567-e89b-12d3-a456-426614174001',
websiteId: '123e4567-e89b-12d3-a456-426614174002',
name: 'Loyalty Points',
symbol: 'LP',
decimals: 2,
imageUrl: 'https://d1ked0nzx7in3u.cloudfront.net/images/loyalty.png',
apiGetUrl: 'https://api.example.com/get-loyalty',
apiGetTransactionEntryUrl: 'https://api.example.com/get-loyalty-tx',
apiPostUrl: 'https://api.example.com/post-loyalty',
sortId: 1,
apiAuthType: 'basic',
apiAuthKey: 'apiKey123',
apiAuthValue: 'apiValue456'
})
};
fetch('https://admin.snagsolutions.io/api/loyalty/currencies', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://admin.snagsolutions.io/api/loyalty/currencies",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'organizationId' => '123e4567-e89b-12d3-a456-426614174001',
'websiteId' => '123e4567-e89b-12d3-a456-426614174002',
'name' => 'Loyalty Points',
'symbol' => 'LP',
'decimals' => 2,
'imageUrl' => 'https://d1ked0nzx7in3u.cloudfront.net/images/loyalty.png',
'apiGetUrl' => 'https://api.example.com/get-loyalty',
'apiGetTransactionEntryUrl' => 'https://api.example.com/get-loyalty-tx',
'apiPostUrl' => 'https://api.example.com/post-loyalty',
'sortId' => 1,
'apiAuthType' => 'basic',
'apiAuthKey' => 'apiKey123',
'apiAuthValue' => 'apiValue456'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://admin.snagsolutions.io/api/loyalty/currencies"
payload := strings.NewReader("{\n \"organizationId\": \"123e4567-e89b-12d3-a456-426614174001\",\n \"websiteId\": \"123e4567-e89b-12d3-a456-426614174002\",\n \"name\": \"Loyalty Points\",\n \"symbol\": \"LP\",\n \"decimals\": 2,\n \"imageUrl\": \"https://d1ked0nzx7in3u.cloudfront.net/images/loyalty.png\",\n \"apiGetUrl\": \"https://api.example.com/get-loyalty\",\n \"apiGetTransactionEntryUrl\": \"https://api.example.com/get-loyalty-tx\",\n \"apiPostUrl\": \"https://api.example.com/post-loyalty\",\n \"sortId\": 1,\n \"apiAuthType\": \"basic\",\n \"apiAuthKey\": \"apiKey123\",\n \"apiAuthValue\": \"apiValue456\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://admin.snagsolutions.io/api/loyalty/currencies")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"organizationId\": \"123e4567-e89b-12d3-a456-426614174001\",\n \"websiteId\": \"123e4567-e89b-12d3-a456-426614174002\",\n \"name\": \"Loyalty Points\",\n \"symbol\": \"LP\",\n \"decimals\": 2,\n \"imageUrl\": \"https://d1ked0nzx7in3u.cloudfront.net/images/loyalty.png\",\n \"apiGetUrl\": \"https://api.example.com/get-loyalty\",\n \"apiGetTransactionEntryUrl\": \"https://api.example.com/get-loyalty-tx\",\n \"apiPostUrl\": \"https://api.example.com/post-loyalty\",\n \"sortId\": 1,\n \"apiAuthType\": \"basic\",\n \"apiAuthKey\": \"apiKey123\",\n \"apiAuthValue\": \"apiValue456\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://admin.snagsolutions.io/api/loyalty/currencies")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"organizationId\": \"123e4567-e89b-12d3-a456-426614174001\",\n \"websiteId\": \"123e4567-e89b-12d3-a456-426614174002\",\n \"name\": \"Loyalty Points\",\n \"symbol\": \"LP\",\n \"decimals\": 2,\n \"imageUrl\": \"https://d1ked0nzx7in3u.cloudfront.net/images/loyalty.png\",\n \"apiGetUrl\": \"https://api.example.com/get-loyalty\",\n \"apiGetTransactionEntryUrl\": \"https://api.example.com/get-loyalty-tx\",\n \"apiPostUrl\": \"https://api.example.com/post-loyalty\",\n \"sortId\": 1,\n \"apiAuthType\": \"basic\",\n \"apiAuthKey\": \"apiKey123\",\n \"apiAuthValue\": \"apiValue456\"\n}"
response = http.request(request)
puts response.read_body{
"id": "123e4567-e89b-12d3-a456-426614174005",
"organizationId": "123e4567-e89b-12d3-a456-426614174001",
"websiteId": "123e4567-e89b-12d3-a456-426614174002",
"imageUrl": "https://d1ked0nzx7in3u.cloudfront.net/images/loyalty.png",
"name": "Loyalty Points",
"symbol": "LP",
"decimals": 2,
"createdById": "123e4567-e89b-12d3-a456-426614174010",
"createdAt": "2023-10-01T12:34:56.000Z",
"updatedAt": "2023-10-05T15:30:00.000Z",
"apiGetUrl": "https://api.example.com/get-loyalty",
"apiGetTransactionEntryUrl": "https://api.example.com/get-loyalty",
"apiPostUrl": "https://api.example.com/post-loyalty",
"apiAuthType": "basic",
"apiAuthKey": "apiKey123",
"apiAuthValue": "apiValue456",
"sortId": 1,
"deletedAt": null,
"isTokenRewardCurrency": false
}{
"error": "<string>"
}{
"error": "<string>"
}{
"success": false,
"message": "Internal server error",
"debugInfo": "Stack trace or additional error details"
}Authorizations
Body
Body
Schema for creating a new loyalty currency
Unique identifier for the organization
"123e4567-e89b-12d3-a456-426614174001"
Unique identifier for the website
"123e4567-e89b-12d3-a456-426614174002"
Name of the loyalty currency
"Loyalty Points"
Symbol representing the loyalty currency
"LP"
Number of decimal places for the currency
x >= 02
URL of the image; must start with AWS S3 asset URL base
"https://d1ked0nzx7in3u.cloudfront.net/images/loyalty.png"
Optional API GET URL for fetching data
1"https://api.example.com/get-loyalty"
Optional API GET URL for fetching transaction entry data
1"https://api.example.com/get-loyalty-tx"
Optional API POST URL for sending data
1"https://api.example.com/post-loyalty"
Optional sorting identifier
1
Type of authentication used for API
none, basic, bearer, apiKey "basic"
Authentication key for API
1"apiKey123"
Authentication value for API
1"apiValue456"
Response
200
Schema for a loyalty currency
Unique identifier for the loyalty currency
"123e4567-e89b-12d3-a456-426614174005"
Unique identifier for the organization
"123e4567-e89b-12d3-a456-426614174001"
Unique identifier for the website
"123e4567-e89b-12d3-a456-426614174002"
URL of the image
"https://d1ked0nzx7in3u.cloudfront.net/images/loyalty.png"
Name of the loyalty currency
"Loyalty Points"
Symbol representing the loyalty currency
"LP"
Number of decimal places for the currency
x >= 02
ID of the user who created the currency
"123e4567-e89b-12d3-a456-426614174010"
Timestamp when the currency was created
"2023-10-01T12:34:56.000Z"
Timestamp when the currency was last updated
"2023-10-05T15:30:00.000Z"
API GET URL for fetching data
"https://api.example.com/get-loyalty"
API GET URL for fetching transaction entry data
"https://api.example.com/get-loyalty"
API POST URL for sending data
"https://api.example.com/post-loyalty"
Type of authentication used for API
none, basic, bearer, apiKey "basic"
Authentication key for API
"apiKey123"
Authentication value for API
"apiValue456"
Sorting identifier
1
Timestamp when the currency was deleted, if applicable
null
True for LoyaltyCurrency rows auto-created by resolveTokenReward (Option 1 hidden currency backing a token-reward rule). Excluded from list responses by default; opt in via excludeTokenRewardCurrencies=false on the list endpoint.
false
Was this page helpful?