Get User Status Data
curl --request GET \
--url https://userservice-staging.withbenji.com/users/{id} \
--header 'x-api-key: <api-key>'import requests
url = "https://userservice-staging.withbenji.com/users/{id}"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://userservice-staging.withbenji.com/users/{id}', 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://userservice-staging.withbenji.com/users/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://userservice-staging.withbenji.com/users/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://userservice-staging.withbenji.com/users/{id}")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://userservice-staging.withbenji.com/users/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"code": "ok",
"data": {
"user": {
"created_date": "2024-08-05T16:54:35.804289+00:00",
"email": "test@test.com",
"first_name": "Test",
"last_name": "User",
"id": 1,
"merchants": [
{
"created_date": "2024-08-23T19:46:01.684468+00:00",
"external_id": "7267281436852",
"id": 1,
"merchant_id": 1,
"total_rewards_earned": 266,
"total_rewards_redeemed": 0,
"user_id": 1
}
],
"partner_status_tiers": [
{
"created_date": "2024-08-05T17:31:43.002778+00:00",
"external_id": "123456789",
"id": 1,
"partner_id": 1,
"partner_status_tier_id": 1,
"total_rewards": 19700,
"total_rewards_earned": 0,
"total_rewards_redeemed": 0,
"user_id": 1
}
]
}
}
}
{
"error": "invalid_token",
"message": "Invalid token"
}
{
"error": "unauthorized_request",
"message": "Token is not authorized to make this request"
}
{
"error": "user_does_not_exist",
"message": "The user does not exist"
}
Get User Status Data
Endpoint to retrieve user basic data, as well as their linked partners and merchants
GET
/
users
/
{id}
Get User Status Data
curl --request GET \
--url https://userservice-staging.withbenji.com/users/{id} \
--header 'x-api-key: <api-key>'import requests
url = "https://userservice-staging.withbenji.com/users/{id}"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://userservice-staging.withbenji.com/users/{id}', 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://userservice-staging.withbenji.com/users/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://userservice-staging.withbenji.com/users/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://userservice-staging.withbenji.com/users/{id}")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://userservice-staging.withbenji.com/users/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"code": "ok",
"data": {
"user": {
"created_date": "2024-08-05T16:54:35.804289+00:00",
"email": "test@test.com",
"first_name": "Test",
"last_name": "User",
"id": 1,
"merchants": [
{
"created_date": "2024-08-23T19:46:01.684468+00:00",
"external_id": "7267281436852",
"id": 1,
"merchant_id": 1,
"total_rewards_earned": 266,
"total_rewards_redeemed": 0,
"user_id": 1
}
],
"partner_status_tiers": [
{
"created_date": "2024-08-05T17:31:43.002778+00:00",
"external_id": "123456789",
"id": 1,
"partner_id": 1,
"partner_status_tier_id": 1,
"total_rewards": 19700,
"total_rewards_earned": 0,
"total_rewards_redeemed": 0,
"user_id": 1
}
]
}
}
}
{
"error": "invalid_token",
"message": "Invalid token"
}
{
"error": "unauthorized_request",
"message": "Token is not authorized to make this request"
}
{
"error": "user_does_not_exist",
"message": "The user does not exist"
}
The
x-api-key header value to be used on this API is a user-based access token.integer
required
The Benji Platform ID of the user
Return values
object
A user object property
Show properties
Show properties
integer
Benji Platform user identifier
string
The user’s first name
string
The user’s last name
array
An array of merchants that the user is connected to
Show items
Show items
Hide properties
Hide properties
integer
The ID of the merchant partner in the Benji Platform
integer
The ID of the user in the Benji Platform
string
The user’s id on the specific merchant
integer
The total amount of merchant specific rewards earned on the Benji Platform
integer
The total amount of merchant specific rewards redeemed on the Benji Platform
datetime
The date this user was associated to the merchant partner on the Benji platform
array
An array of user partner status tier objects
Show items
Show items
Hide properties
Hide properties
integer
The ID of the partner in the Benji Platform
integer
The ID of the partner status tier in the Benji Platform
integer
The ID of the user in the Benji Platform
string
The user’s loyalty program identifier
integer
The current rewards amount in the user’s account, regardless of Benji originated transactions
integer
The total amount of partner specific rewards earned on the Benji Platform
integer
The total amount of partner specific rewards redeemed on the Benji Platform
datetime
The date this user was associated to the loyalty partner on the Benji platform
{
"code": "ok",
"data": {
"user": {
"created_date": "2024-08-05T16:54:35.804289+00:00",
"email": "test@test.com",
"first_name": "Test",
"last_name": "User",
"id": 1,
"merchants": [
{
"created_date": "2024-08-23T19:46:01.684468+00:00",
"external_id": "7267281436852",
"id": 1,
"merchant_id": 1,
"total_rewards_earned": 266,
"total_rewards_redeemed": 0,
"user_id": 1
}
],
"partner_status_tiers": [
{
"created_date": "2024-08-05T17:31:43.002778+00:00",
"external_id": "123456789",
"id": 1,
"partner_id": 1,
"partner_status_tier_id": 1,
"total_rewards": 19700,
"total_rewards_earned": 0,
"total_rewards_redeemed": 0,
"user_id": 1
}
]
}
}
}
{
"error": "invalid_token",
"message": "Invalid token"
}
{
"error": "unauthorized_request",
"message": "Token is not authorized to make this request"
}
{
"error": "user_does_not_exist",
"message": "The user does not exist"
}
Note that you will only receive data that you as a loyalty partner or merchant partner are allowed to see based on the permissions in the access token you provide to the API.
Was this page helpful?
⌘I