Generate Auth Token
curl --request POST \
--url https://loyalife-api.xoxoday.in/lbms-ingress/oauth/api/Auth/Token \
--header 'Content-Type: application/json' \
--data '
{
"grant_type": "client_credentials",
"client_id": "your-client-id",
"client_secret": "your-client-secret"
}
'import requests
url = "https://loyalife-api.xoxoday.in/lbms-ingress/oauth/api/Auth/Token"
payload = {
"grant_type": "client_credentials",
"client_id": "your-client-id",
"client_secret": "your-client-secret"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
grant_type: 'client_credentials',
client_id: 'your-client-id',
client_secret: 'your-client-secret'
})
};
fetch('https://loyalife-api.xoxoday.in/lbms-ingress/oauth/api/Auth/Token', 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://loyalife-api.xoxoday.in/lbms-ingress/oauth/api/Auth/Token",
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([
'grant_type' => 'client_credentials',
'client_id' => 'your-client-id',
'client_secret' => 'your-client-secret'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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://loyalife-api.xoxoday.in/lbms-ingress/oauth/api/Auth/Token"
payload := strings.NewReader("{\n \"grant_type\": \"client_credentials\",\n \"client_id\": \"your-client-id\",\n \"client_secret\": \"your-client-secret\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://loyalife-api.xoxoday.in/lbms-ingress/oauth/api/Auth/Token")
.header("Content-Type", "application/json")
.body("{\n \"grant_type\": \"client_credentials\",\n \"client_id\": \"your-client-id\",\n \"client_secret\": \"your-client-secret\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://loyalife-api.xoxoday.in/lbms-ingress/oauth/api/Auth/Token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"grant_type\": \"client_credentials\",\n \"client_id\": \"your-client-id\",\n \"client_secret\": \"your-client-secret\"\n}"
response = http.request(request)
puts response.read_body{
"results": {
"token": "eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTUxMiIsInR5cCI6IkpXVCJ9...",
"tokenExpiresOn": "2026-03-16T15:15:02Z"
}
}{
"results": {
"IsSucessful": false,
"ErrorCode": "E401",
"ExceptionMessage": "Invalid client credentials"
}
}Authentication
Generate Auth Token
Exchange your Loyalife client credentials for a JWT bearer token to authenticate API calls.
POST
/
lbms-ingress
/
oauth
/
api
/
Auth
/
Token
Generate Auth Token
curl --request POST \
--url https://loyalife-api.xoxoday.in/lbms-ingress/oauth/api/Auth/Token \
--header 'Content-Type: application/json' \
--data '
{
"grant_type": "client_credentials",
"client_id": "your-client-id",
"client_secret": "your-client-secret"
}
'import requests
url = "https://loyalife-api.xoxoday.in/lbms-ingress/oauth/api/Auth/Token"
payload = {
"grant_type": "client_credentials",
"client_id": "your-client-id",
"client_secret": "your-client-secret"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
grant_type: 'client_credentials',
client_id: 'your-client-id',
client_secret: 'your-client-secret'
})
};
fetch('https://loyalife-api.xoxoday.in/lbms-ingress/oauth/api/Auth/Token', 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://loyalife-api.xoxoday.in/lbms-ingress/oauth/api/Auth/Token",
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([
'grant_type' => 'client_credentials',
'client_id' => 'your-client-id',
'client_secret' => 'your-client-secret'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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://loyalife-api.xoxoday.in/lbms-ingress/oauth/api/Auth/Token"
payload := strings.NewReader("{\n \"grant_type\": \"client_credentials\",\n \"client_id\": \"your-client-id\",\n \"client_secret\": \"your-client-secret\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://loyalife-api.xoxoday.in/lbms-ingress/oauth/api/Auth/Token")
.header("Content-Type", "application/json")
.body("{\n \"grant_type\": \"client_credentials\",\n \"client_id\": \"your-client-id\",\n \"client_secret\": \"your-client-secret\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://loyalife-api.xoxoday.in/lbms-ingress/oauth/api/Auth/Token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"grant_type\": \"client_credentials\",\n \"client_id\": \"your-client-id\",\n \"client_secret\": \"your-client-secret\"\n}"
response = http.request(request)
puts response.read_body{
"results": {
"token": "eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTUxMiIsInR5cCI6IkpXVCJ9...",
"tokenExpiresOn": "2026-03-16T15:15:02Z"
}
}{
"results": {
"IsSucessful": false,
"ErrorCode": "E401",
"ExceptionMessage": "Invalid client credentials"
}
}Loyalife uses OAuth 2.0 client credentials flow for API authentication. This endpoint exchanges your
client_id and client_secret for a JWT bearer token valid for 30 minutes (configurable). Every subsequent API call must include this token in the Authorization header — there is no session or cookie-based alternative. Cache the token and reuse it; never generate a new token per request.
Credentials are per-program. Find your
client_id and client_secret in Loyalife Admin under Configurations → Program Settings → API. Regenerating credentials immediately invalidates all previously issued tokens.Responses
200 — Success
200 — Success
| Path | Type | Description |
|---|---|---|
results.token | string | JWT bearer token. Use as Authorization: bearer {token} in all subsequent calls. |
results.tokenExpiresOn | string (date-time) | ISO 8601 expiry timestamp. Refresh before this time. |
401 — Invalid Credentials
401 — Invalid Credentials
| Path | Type | Description |
|---|---|---|
results.IsSucessful | boolean | false |
results.ErrorCode | string | Error code from the platform |
results.ExceptionMessage | string | Human-readable reason — check this field for details |
Error Codes
| Code | ExceptionMessage | Cause |
|---|---|---|
000 | Success | Token generated successfully |
401 (HTTP) | Unauthorized | Invalid client_id or client_secret |
999 | Bad request | Missing or malformed fields in the request payload |
Body
application/json
OAuth 2.0 grant type
Available options:
client_credentials Example:
"client_credentials"
Your OAuth client ID from Loyalife Admin → Program Configuration → API
Example:
"your-client-id"
Your OAuth client secret. Never expose in client-side code.
Example:
"your-client-secret"
Optional. Binds token to a specific member. JSON-encoded array: ["LOGIN","{RelationReference}"]. Omit for a general-purpose program token.
Example:
"[\"LOGIN\",\"jane.doe@example.com\"]"
Response
Token issued
Show child attributes
Show child attributes