curl --request POST \
--url https://api.engagefabric.com/players \
--header 'Content-Type: application/json' \
--data '
{
"projectId": "123e4567-e89b-12d3-a456-426614174000",
"externalUserId": "user_12345",
"displayName": "John Doe",
"avatarUrl": "https://example.com/avatars/johndoe.png",
"locale": "en-US",
"metadata": {
"accountType": "premium",
"referralCode": "ABC123"
}
}
'import requests
url = "https://api.engagefabric.com/players"
payload = {
"projectId": "123e4567-e89b-12d3-a456-426614174000",
"externalUserId": "user_12345",
"displayName": "John Doe",
"avatarUrl": "https://example.com/avatars/johndoe.png",
"locale": "en-US",
"metadata": {
"accountType": "premium",
"referralCode": "ABC123"
}
}
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({
projectId: '123e4567-e89b-12d3-a456-426614174000',
externalUserId: 'user_12345',
displayName: 'John Doe',
avatarUrl: 'https://example.com/avatars/johndoe.png',
locale: 'en-US',
metadata: {accountType: 'premium', referralCode: 'ABC123'}
})
};
fetch('https://api.engagefabric.com/players', 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://api.engagefabric.com/players",
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([
'projectId' => '123e4567-e89b-12d3-a456-426614174000',
'externalUserId' => 'user_12345',
'displayName' => 'John Doe',
'avatarUrl' => 'https://example.com/avatars/johndoe.png',
'locale' => 'en-US',
'metadata' => [
'accountType' => 'premium',
'referralCode' => 'ABC123'
]
]),
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://api.engagefabric.com/players"
payload := strings.NewReader("{\n \"projectId\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"externalUserId\": \"user_12345\",\n \"displayName\": \"John Doe\",\n \"avatarUrl\": \"https://example.com/avatars/johndoe.png\",\n \"locale\": \"en-US\",\n \"metadata\": {\n \"accountType\": \"premium\",\n \"referralCode\": \"ABC123\"\n }\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://api.engagefabric.com/players")
.header("Content-Type", "application/json")
.body("{\n \"projectId\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"externalUserId\": \"user_12345\",\n \"displayName\": \"John Doe\",\n \"avatarUrl\": \"https://example.com/avatars/johndoe.png\",\n \"locale\": \"en-US\",\n \"metadata\": {\n \"accountType\": \"premium\",\n \"referralCode\": \"ABC123\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.engagefabric.com/players")
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 \"projectId\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"externalUserId\": \"user_12345\",\n \"displayName\": \"John Doe\",\n \"avatarUrl\": \"https://example.com/avatars/johndoe.png\",\n \"locale\": \"en-US\",\n \"metadata\": {\n \"accountType\": \"premium\",\n \"referralCode\": \"ABC123\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "123e4567-e89b-12d3-a456-426614174000",
"projectId": "123e4567-e89b-12d3-a456-426614174000",
"externalUserId": "user_12345",
"xp": 1250,
"level": 5,
"lives": 3,
"maxLives": 5,
"livesUpdatedAt": "2025-01-15T10:30:00Z",
"currencies": {
"coins": 500,
"gems": 50
},
"status": "ACTIVE",
"isFlagged": false,
"createdAt": "2025-01-15T10:30:00Z",
"updatedAt": "2025-01-15T10:30:00Z",
"lastSeenAt": "2025-01-15T10:30:00Z",
"displayName": "John Doe",
"avatarUrl": "https://example.com/avatars/johndoe.png",
"locale": "en-US",
"flagReason": null,
"metadata": {
"accountType": "premium"
},
"deletedAt": null
}Create or get a player
Creates a new player or returns existing player if externalUserId already exists (idempotent)
curl --request POST \
--url https://api.engagefabric.com/players \
--header 'Content-Type: application/json' \
--data '
{
"projectId": "123e4567-e89b-12d3-a456-426614174000",
"externalUserId": "user_12345",
"displayName": "John Doe",
"avatarUrl": "https://example.com/avatars/johndoe.png",
"locale": "en-US",
"metadata": {
"accountType": "premium",
"referralCode": "ABC123"
}
}
'import requests
url = "https://api.engagefabric.com/players"
payload = {
"projectId": "123e4567-e89b-12d3-a456-426614174000",
"externalUserId": "user_12345",
"displayName": "John Doe",
"avatarUrl": "https://example.com/avatars/johndoe.png",
"locale": "en-US",
"metadata": {
"accountType": "premium",
"referralCode": "ABC123"
}
}
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({
projectId: '123e4567-e89b-12d3-a456-426614174000',
externalUserId: 'user_12345',
displayName: 'John Doe',
avatarUrl: 'https://example.com/avatars/johndoe.png',
locale: 'en-US',
metadata: {accountType: 'premium', referralCode: 'ABC123'}
})
};
fetch('https://api.engagefabric.com/players', 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://api.engagefabric.com/players",
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([
'projectId' => '123e4567-e89b-12d3-a456-426614174000',
'externalUserId' => 'user_12345',
'displayName' => 'John Doe',
'avatarUrl' => 'https://example.com/avatars/johndoe.png',
'locale' => 'en-US',
'metadata' => [
'accountType' => 'premium',
'referralCode' => 'ABC123'
]
]),
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://api.engagefabric.com/players"
payload := strings.NewReader("{\n \"projectId\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"externalUserId\": \"user_12345\",\n \"displayName\": \"John Doe\",\n \"avatarUrl\": \"https://example.com/avatars/johndoe.png\",\n \"locale\": \"en-US\",\n \"metadata\": {\n \"accountType\": \"premium\",\n \"referralCode\": \"ABC123\"\n }\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://api.engagefabric.com/players")
.header("Content-Type", "application/json")
.body("{\n \"projectId\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"externalUserId\": \"user_12345\",\n \"displayName\": \"John Doe\",\n \"avatarUrl\": \"https://example.com/avatars/johndoe.png\",\n \"locale\": \"en-US\",\n \"metadata\": {\n \"accountType\": \"premium\",\n \"referralCode\": \"ABC123\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.engagefabric.com/players")
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 \"projectId\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"externalUserId\": \"user_12345\",\n \"displayName\": \"John Doe\",\n \"avatarUrl\": \"https://example.com/avatars/johndoe.png\",\n \"locale\": \"en-US\",\n \"metadata\": {\n \"accountType\": \"premium\",\n \"referralCode\": \"ABC123\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "123e4567-e89b-12d3-a456-426614174000",
"projectId": "123e4567-e89b-12d3-a456-426614174000",
"externalUserId": "user_12345",
"xp": 1250,
"level": 5,
"lives": 3,
"maxLives": 5,
"livesUpdatedAt": "2025-01-15T10:30:00Z",
"currencies": {
"coins": 500,
"gems": 50
},
"status": "ACTIVE",
"isFlagged": false,
"createdAt": "2025-01-15T10:30:00Z",
"updatedAt": "2025-01-15T10:30:00Z",
"lastSeenAt": "2025-01-15T10:30:00Z",
"displayName": "John Doe",
"avatarUrl": "https://example.com/avatars/johndoe.png",
"locale": "en-US",
"flagReason": null,
"metadata": {
"accountType": "premium"
},
"deletedAt": null
}Body
Project ID this player belongs to
"123e4567-e89b-12d3-a456-426614174000"
External user ID from the client application (unique per project)
1 - 255"user_12345"
Player display name
255"John Doe"
Player avatar URL
500"https://example.com/avatars/johndoe.png"
Player locale (e.g., en-US, fr-FR)
10"en-US"
Additional player metadata
{
"accountType": "premium",
"referralCode": "ABC123"
}
Response
Player created or retrieved successfully
Unique player identifier
"123e4567-e89b-12d3-a456-426614174000"
Project ID this player belongs to
"123e4567-e89b-12d3-a456-426614174000"
External user ID from client application
"user_12345"
Player XP
1250
Player level
5
Current lives/energy
3
Maximum lives
5
Last time lives were updated
"2025-01-15T10:30:00Z"
Player currencies (key-value pairs)
{ "coins": 500, "gems": 50 }
Player status
ACTIVE, SUSPENDED, BANNED "ACTIVE"
Whether player is flagged for review
false
Creation timestamp
"2025-01-15T10:30:00Z"
Last update timestamp
"2025-01-15T10:30:00Z"
Last activity timestamp
"2025-01-15T10:30:00Z"
Player display name
"John Doe"
Player avatar URL
"https://example.com/avatars/johndoe.png"
Player locale
"en-US"
Reason for flagging
null
Additional player metadata
{ "accountType": "premium" }
Soft deletion timestamp
null
