Batch update traits
curl --request PUT \
--url https://api.manalens.dev/v0/projects/{projectId}/players/traits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
[
{
"user_id": "<string>"
}
]
'import requests
url = "https://api.manalens.dev/v0/projects/{projectId}/players/traits"
payload = [{ "user_id": "<string>" }]
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify([{user_id: '<string>'}])
};
fetch('https://api.manalens.dev/v0/projects/{projectId}/players/traits', 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.manalens.dev/v0/projects/{projectId}/players/traits",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
[
'user_id' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.manalens.dev/v0/projects/{projectId}/players/traits"
payload := strings.NewReader("[\n {\n \"user_id\": \"<string>\"\n }\n]")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.put("https://api.manalens.dev/v0/projects/{projectId}/players/traits")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("[\n {\n \"user_id\": \"<string>\"\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.manalens.dev/v0/projects/{projectId}/players/traits")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"user_id\": \"<string>\"\n }\n]"
response = http.request(request)
puts response.read_body{
"updated": 0,
"failed": 0,
"updated_at": "<string>",
"results": [
{
"index": 0,
"user_id": "<string>",
"set": [
"<string>"
],
"deleted": [
"<string>"
],
"error": {
"code": "<string>",
"message": "<string>"
}
}
]
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"refused": [
{
"index": 0,
"message_id": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"results": [
{
"index": 0,
"user_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
],
"feature": "<string>",
"billing_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"refused": [
{
"index": 0,
"message_id": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"results": [
{
"index": 0,
"user_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
],
"feature": "<string>",
"billing_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"refused": [
{
"index": 0,
"message_id": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"results": [
{
"index": 0,
"user_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
],
"feature": "<string>",
"billing_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"refused": [
{
"index": 0,
"message_id": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"results": [
{
"index": 0,
"user_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
],
"feature": "<string>",
"billing_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"refused": [
{
"index": 0,
"message_id": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"results": [
{
"index": 0,
"user_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
],
"feature": "<string>",
"billing_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"refused": [
{
"index": 0,
"message_id": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"results": [
{
"index": 0,
"user_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
],
"feature": "<string>",
"billing_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"refused": [
{
"index": 0,
"message_id": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"results": [
{
"index": 0,
"user_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
],
"feature": "<string>",
"billing_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"refused": [
{
"index": 0,
"message_id": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"results": [
{
"index": 0,
"user_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
],
"feature": "<string>",
"billing_url": "<string>"
}
}Players API
Batch Update Traits
Set or delete traits for up to 100 identified players in one request. Each item is a flat object with a required user_id. null deletes a trait. Each item gets its own result, so one bad item does not fail the batch.
PUT
/
v0
/
projects
/
{projectId}
/
players
/
traits
Batch update traits
curl --request PUT \
--url https://api.manalens.dev/v0/projects/{projectId}/players/traits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
[
{
"user_id": "<string>"
}
]
'import requests
url = "https://api.manalens.dev/v0/projects/{projectId}/players/traits"
payload = [{ "user_id": "<string>" }]
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify([{user_id: '<string>'}])
};
fetch('https://api.manalens.dev/v0/projects/{projectId}/players/traits', 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.manalens.dev/v0/projects/{projectId}/players/traits",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
[
'user_id' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.manalens.dev/v0/projects/{projectId}/players/traits"
payload := strings.NewReader("[\n {\n \"user_id\": \"<string>\"\n }\n]")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.put("https://api.manalens.dev/v0/projects/{projectId}/players/traits")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("[\n {\n \"user_id\": \"<string>\"\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.manalens.dev/v0/projects/{projectId}/players/traits")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"user_id\": \"<string>\"\n }\n]"
response = http.request(request)
puts response.read_body{
"updated": 0,
"failed": 0,
"updated_at": "<string>",
"results": [
{
"index": 0,
"user_id": "<string>",
"set": [
"<string>"
],
"deleted": [
"<string>"
],
"error": {
"code": "<string>",
"message": "<string>"
}
}
]
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"refused": [
{
"index": 0,
"message_id": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"results": [
{
"index": 0,
"user_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
],
"feature": "<string>",
"billing_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"refused": [
{
"index": 0,
"message_id": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"results": [
{
"index": 0,
"user_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
],
"feature": "<string>",
"billing_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"refused": [
{
"index": 0,
"message_id": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"results": [
{
"index": 0,
"user_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
],
"feature": "<string>",
"billing_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"refused": [
{
"index": 0,
"message_id": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"results": [
{
"index": 0,
"user_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
],
"feature": "<string>",
"billing_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"refused": [
{
"index": 0,
"message_id": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"results": [
{
"index": 0,
"user_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
],
"feature": "<string>",
"billing_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"refused": [
{
"index": 0,
"message_id": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"results": [
{
"index": 0,
"user_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
],
"feature": "<string>",
"billing_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"refused": [
{
"index": 0,
"message_id": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"results": [
{
"index": 0,
"user_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
],
"feature": "<string>",
"billing_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"refused": [
{
"index": 0,
"message_id": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"results": [
{
"index": 0,
"user_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
],
"feature": "<string>",
"billing_url": "<string>"
}
}Use this endpoint for a backfill or a sync, for example to link many players to their Discord accounts at once. Authentication and the trait rules are the same as for Update Traits.
Valid items are written; failed items are not. When no item is valid, the response is
Body
An array of 1 to 100 items. Each item is a flat object:user_id plus the traits for that player. Items use the plain user_id, not the player key. The body is at most 200 KB.
[
{ "user_id": "player_42", "discord_id": "112233445566778899" },
{ "user_id": "player_43", "steam_id": "STEAM_0:1:12345", "twitter": null }
]
| Rule | Value |
|---|---|
user_id | Required in each item. 1 to 255 characters. |
| Traits | 1 to 50 per item, at most 8 KB as JSON per item. The same key and value rules as the single endpoint. |
Same user_id twice | The second item fails. Merge its traits into the first item. |
Response
200 when at least one item is valid. results has one entry per item, in request order:
{
"updated": 1,
"failed": 1,
"updated_at": "2026-11-15T12:00:00.000Z",
"results": [
{ "index": 0, "user_id": "player_42", "set": ["discord_id"], "deleted": [] },
{ "index": 1, "user_id": "player_43", "error": { "code": "INVALID_TRAITS", "message": "steam_id must be a SteamID64 (17 digits, 76561197960265729 to 76561202255233023)" } }
]
}
400 with INVALID_TRAITS and the same results. The batch response does not return the merged traits; read a player with Get Player, with MCP get_player, or on the profile’s Traits tab.
Delete traits in a batch
Sendnull. Set and delete can mix in one item and across items:
curl -sS -X PUT \
-H "Authorization: Bearer $MANALENS_PROJECT_KEY" \
-H "Content-Type: application/json" \
-d '[
{ "user_id": "player_42", "discord_id": null, "discord": null },
{ "user_id": "player_43", "discord_id": "998877665544332211" }
]' \
"https://api.manalens.dev/v0/projects/$PROJECT_ID/players/traits"
Errors
Request errors are the same as for Update Traits, with a 200 KB body limit. A request-level400 (not an array, or more than 100 items) writes nothing.Authorizations
Body
application/json
Response
At least one item is valid. results has one entry per item, in request order.