Skip to main content

Users APIs

Creating a User

Once you have authenticated, you can create users who will be placing bets on your platform. To create a user, you need to send a POST request to our API with the user's details. The reference field is optional and will be generated if not provided. The preferences field is also optional.

info

This request must have the authorization header. Refer to Authorization method guide for more details

Request

PropertyValue
methodPOST
url$baseUrl/account/user
Content-Typeapplication/json

Body

PropertyTypeRequiredDefaultDescription
namestringYes-Name of the user
referencestringNo-Preferred User reference
preferencesobjectNoNULLUser preferences
metaobjectNoNULLUser metadata (max 10 string fields)
note

The reference field is optional and will be generated if not provided.

tip

If you have a special way of tracking your users and want to use your own reference, you can provide it in the reference field.

note

The meta field allows you to store additional user metadata with the following constraints:

  • Maximum of 10 fields
  • All values must be strings
  • Keys can only contain letters, numbers, and underscores
  • Example: {"custom_id": "12345", "source": "mobile_app", "tier": "premium"}
curl -X POST "$baseUrl/account/user" \
-H "Content-Type: application/json" \
-d '{
"name": "John Doe",
"reference": "johndoe123",
"preferences": {},
"meta": {
"custom_id": "12345",
"source": "web_app",
"tier": "premium"
}
}'

Response

Http Code: 201

{
"data": {
"id": 2,
"reference": "a2_user_Xhwz442NTj74z6F0",
"created_at": "2025-09-08T12:00:00.000Z"
},
"message": "User created successfully"
}

Get Paginated Users

info

This request must have the authorization header. Refer to Authorization method guide for more details

Request

PropertyValue
methodGET
url$baseUrl/account/user
Content-Typeapplication/json

Query Parameters

PropertyTypeRequiredDefaultDescription
pagenumberNo1Page number (minimum 1)
per_pagenumberNo20Results per page (1 - 100)
searchstringNo-Case-insensitive partial match on name or reference
sort_bystringNocreated_atOne of: id, name, reference, created_at, balance, exposure
sort_orderstringNodescasc or desc
meta_*stringNo-Filter by meta field values (e.g., meta_tier=premium, meta_source=mobile_app)
note

Meta Field Filtering: You can filter users by their meta field values using the meta_* pattern:

  • Use meta_ followed by the field name and its value
  • Example: meta_tier=premium filters users where meta.tier equals "premium"
  • Multiple meta filters can be combined: meta_tier=premium&meta_source=mobile_app
  • Values are matched exactly (case-sensitive)
# Basic pagination
curl -X GET "$baseUrl/account/user?page=1&per_page=2"

# Filter by meta fields
curl -X GET "$baseUrl/account/user?page=1&per_page=10&meta_tier=premium&meta_source=mobile_app"

# Combine with search and sorting
curl -X GET "$baseUrl/account/user?search=john&sort_by=created_at&sort_order=asc&meta_tier=gold"

Response

Http Code: 200

{
"data": {
"items": [
{
"id": 1,
"account_id": 2,
"reference": "a2_user_4lH6u7hayvaqs6Ix",
"name": "Jane Doe",
"role": "user",
"preferences": { "allow_negative_balance": true },
"meta": { "tier": "premium", "source": "mobile_app" },
"balance": 0,
"exposure": 0,
"created_at": "2025-09-08T12:00:00.000Z"
},
{
"id": 2,
"account_id": 2,
"reference": "a2_user_Xhwz442NTj74z6F0",
"name": "John Doe",
"role": "user",
"preferences": {},
"meta": { "custom_id": "12345", "source": "web_app" },
"balance": 0,
"exposure": 0,
"created_at": "2025-09-08T12:05:10.000Z"
}
],
"page": 1,
"per_page": 2,
"total": 12,
"total_pages": 6
},
"message": "Users fetched successfully"
}

Get User By Id

info

This request must have the authorization header. Refer to Authorization method guide for more details

Request

PropertyValue
methodGET
url$baseUrl/account/user/:userId
Content-Typeapplication/json
curl -X GET "$baseUrl/account/user/:userId"

Response

Http Code: 200

{
"data": {
"id": 1,
"account_id": 2,
"reference": "a2_user_4lH6u7hayvaqs6Ix",
"name": "Jane Doe",
"role": "user",
"preferences": {
"allow_negative_balance": true
},
"meta": {
"tier": "premium",
"source": "mobile_app",
"custom_id": "12345"
},
"balance": 0,
"exposure": 0,
"created_at": "2025-09-08T12:00:00.000Z"
},
"message": "User fetched successfully"
}

Get User By Reference

info

This request must have the authorization header. Refer to Authorization method guide for more details

Request

PropertyValue
methodGET
url$baseUrl/account/user/:reference/reference
Content-Typeapplication/json
curl -X GET "$baseUrl/account/user/:reference/reference"

Response

Http Code: 200

{
"data": {
"id": 1,
"account_id": 2,
"reference": "a2_user_4lH6u7hayvaqs6Ix",
"name": "Jane Doe",
"role": "user",
"preferences": {
"allow_negative_balance": true
},
"meta": {
"tier": "premium",
"source": "mobile_app",
"custom_id": "12345"
},
"balance": 0,
"exposure": 0,
"created_at": "2025-09-08T12:00:00.000Z"
},
"message": "User fetched successfully"
}

Update User By Id

This endpoint allows you to update a user's information including their name, preferences, and metadata.

info

This request must have the authorization header. Refer to Authorization method guide for more details

Request

PropertyValue
methodPATCH
url$baseUrl/account/user/:userId
Content-Typeapplication/json

Path Parameters

ParameterDescription
userIdThe ID of the user

Body

PropertyTypeRequiredDefaultDescription
namestringNo-Updated name of the user
preferencesobjectNo-Updated user preferences
metaobjectNo-Updated user metadata (max 10 string fields)
note

All fields are optional in the update request. Only provided fields will be updated.

The meta field follows the same constraints as in user creation:

  • Maximum of 10 fields
  • All values must be strings
  • Keys can only contain letters, numbers, and underscores
curl -X PATCH "$baseUrl/account/user/123" \
-H "Authorization: Bearer $token" \
-H "Content-Type: application/json" \
-d '{
"name": "John Smith",
"meta": {
"tier": "gold",
"updated_source": "admin_panel"
}
}'

Response

Http Code: 200

{
"data": {
"id": 123,
"reference": "a2_user_Xhwz442NTj74z6F0",
"name": "John Smith",
"preferences": {
"allow_negative_balance": false
},
"meta": {
"tier": "gold",
"updated_source": "admin_panel",
"custom_id": "12345"
},
"updated_at": "2025-09-24T12:00:00.000Z"
},
"message": "User updated successfully"
}

Update User By Reference

This endpoint allows you to update a user's information using their reference instead of their ID.

info

This request must have the authorization header. Refer to Authorization method guide for more details

Request

PropertyValue
methodPATCH
url$baseUrl/account/user/:reference/reference
Content-Typeapplication/json

Path Parameters

ParameterDescription
referenceThe reference of the user

Body

PropertyTypeRequiredDefaultDescription
namestringNo-Updated name of the user
preferencesobjectNo-Updated user preferences
metaobjectNo-Updated user metadata (max 10 string fields)
curl -X PATCH "$baseUrl/account/user/johndoe123/reference" \
-H "Authorization: Bearer $token" \
-H "Content-Type: application/json" \
-d '{
"name": "John Smith",
"meta": {
"tier": "gold",
"updated_source": "admin_panel"
}
}'

Response

Http Code: 200

{
"data": {
"id": 123,
"reference": "johndoe123",
"name": "John Smith",
"preferences": {
"allow_negative_balance": false
},
"meta": {
"tier": "gold",
"updated_source": "admin_panel",
"custom_id": "12345"
},
"updated_at": "2025-09-24T12:00:00.000Z"
},
"message": "User updated successfully"
}