Platform API › Custom Fields
GET /custom-fields
Returns the complete definition of all custom fields associated to platform users. This includes both public and private custom fields. For more information, please read the Custom Fields documentation.
Resource URL
https://api.toornament.com/platform/v2/custom-fields
HTTP headers
- X-Api-Keystring
API key of your application (see Authentication)
- Authorizationstring
Access token with
platform:admin
scope (see Authorization)
Query Parameters
- target_typestring
The entity affected by the custom fields.
Possible values: user
Request Body
This endpoint does not require a request body.
Response
[200] Success
Example
[ { "id": "128114939547269789", "target_type": "user", "default_value": "#steam_id", "required": false, "public": false, "position": 5, "options": {}, "machine_name": "my_steam_id", "label": "My Steam ID", "type": "steam_player_id" } ]
Structure (collection)
- idstring
Unique identifier of the custom field.
Example: "128114939547269789"
- target_typestring
Entity affected by the custom field.
Possible values: user
- default_valuemixed|null
Default value (can be array, scalar or null). The type of value depends on the custom field type.
Example: #steam_id
- requiredboolean
Whether the custom field is required.
Example: false
- publicboolean
Whether the value of the custom field is public.
Example: false
- positioninteger
Position of the custom field (used for display purposes).
Example: 5
- optionsobject
Options of the custom field.
Example: {}
- machine_namestring
Name used to identify a custom field for computing purposes.
Pattern: ^[a-z0-9_]+$
Max. length: 255 characters
Example: "my_steam_id"
- labelstring
Label of a custom field (used for display purposes).
Max. length: 255 characters
Example: "My Steam ID"
- typestring
Data type used for both input and computing.
Example: "steam_player_id"
POST /custom-fields
Create a new custom field on the platform. You can not have more than 128 custom fields.
Resource URL
https://api.toornament.com/platform/v2/custom-fields
HTTP headers
- X-Api-Keystring
API key of your application (see Authentication)
- Authorizationstring
Access token with
platform:admin
scope (see Authorization)
Query Parameters
This endpoint does not have any query parameters.
Request Body
Data to provide to create a custom field.
Example
{ "target_type": "user", "machine_name": "my_steam_id", "label": "My Steam ID", "type": "steam_player_id", "default_value": "#steam_id", "required": false, "public": false, "position": 5, "options": {} }
Structure (object)
- target_typestring
Entity affected by the custom field.
Possible values: user
- machine_namestring
Name used to identify a custom field for computing purposes.
Pattern: ^[a-z0-9_]+$
Max. length: 255 characters
Example: "my_steam_id"
- labelstring
Label of a custom field (used for display purposes).
Max. length: 255 characters
Example: "My Steam ID"
- typestring
Data type used for both input and computing.
Example: "steam_player_id"
- default_valuemixed|null
Optional
Default value (can be array, scalar or null). The type of value depends on the custom field type.
Example: #steam_id
- requiredboolean
Optional
Whether the custom field is required.
Example: false
- publicboolean
Optional
Whether the value of the custom field is public.
Example: false
- positioninteger
Optional
Position of the custom field (used for display purposes).
Example: 5
- optionsobject
Optional
Options of the custom field.
Example: {}
Response
[201] Success.
Example
{ "id": "128114939547269789", "target_type": "user", "default_value": "#steam_id", "required": false, "public": false, "position": 5, "options": {}, "machine_name": "my_steam_id", "label": "My Steam ID", "type": "steam_player_id" }
Structure (object)
- idstring
Unique identifier of the custom field.
Example: "128114939547269789"
- target_typestring
Entity affected by the custom field.
Possible values: user
- default_valuemixed|null
Default value (can be array, scalar or null). The type of value depends on the custom field type.
Example: #steam_id
- requiredboolean
Whether the custom field is required.
Example: false
- publicboolean
Whether the value of the custom field is public.
Example: false
- positioninteger
Position of the custom field (used for display purposes).
Example: 5
- optionsobject
Options of the custom field.
Example: {}
- machine_namestring
Name used to identify a custom field for computing purposes.
Pattern: ^[a-z0-9_]+$
Max. length: 255 characters
Example: "my_steam_id"
- labelstring
Label of a custom field (used for display purposes).
Max. length: 255 characters
Example: "My Steam ID"
- typestring
Data type used for both input and computing.
Example: "steam_player_id"
GET /custom-fields/{id}
Returns a single custom field related to the platform.
Resource URL
https://api.toornament.com/platform/v2/custom-fields/{id}
HTTP headers
- X-Api-Keystring
API key of your application (see Authentication)
- Authorizationstring
Access token with
platform:admin
scope (see Authorization)
Path parameters
- idstring
The id of the requested custom field.
Query Parameters
This endpoint does not have any query parameters.
Request Body
This endpoint does not require a request body.
Response
[200] Success
Example
{ "id": "128114939547269789", "target_type": "user", "default_value": "#steam_id", "required": false, "public": false, "position": 5, "options": {}, "machine_name": "my_steam_id", "label": "My Steam ID", "type": "steam_player_id" }
Structure (object)
- idstring
Unique identifier of the custom field.
Example: "128114939547269789"
- target_typestring
Entity affected by the custom field.
Possible values: user
- default_valuemixed|null
Default value (can be array, scalar or null). The type of value depends on the custom field type.
Example: #steam_id
- requiredboolean
Whether the custom field is required.
Example: false
- publicboolean
Whether the value of the custom field is public.
Example: false
- positioninteger
Position of the custom field (used for display purposes).
Example: 5
- optionsobject
Options of the custom field.
Example: {}
- machine_namestring
Name used to identify a custom field for computing purposes.
Pattern: ^[a-z0-9_]+$
Max. length: 255 characters
Example: "my_steam_id"
- labelstring
Label of a custom field (used for display purposes).
Max. length: 255 characters
Example: "My Steam ID"
- typestring
Data type used for both input and computing.
Example: "steam_player_id"
PATCH /custom-fields/{id}
Update a single custom field related to the platform.
Resource URL
https://api.toornament.com/platform/v2/custom-fields/{id}
HTTP headers
- X-Api-Keystring
API key of your application (see Authentication)
- Authorizationstring
Access token with
platform:admin
scope (see Authorization)
Path parameters
- idstring
The id of the requested custom field.
Query Parameters
This endpoint does not have any query parameters.
Request Body
Data to provide to update the custom field.
Example
{ "label": "My Steam ID", "default_value": "#steam_id", "required": false, "public": false, "position": 5, "options": {} }
Structure (object)
- labelstring
Optional
Label of a custom field (used for display purposes).
Max. length: 255 characters
Example: "My Steam ID"
- default_valuemixed|null
Optional
Default value (can be array, scalar or null). The type of value depends on the custom field type.
Example: #steam_id
- requiredboolean
Optional
Whether the custom field is required.
Example: false
- publicboolean
Optional
Whether the value of the custom field is public.
Example: false
- positioninteger
Optional
Position of the custom field (used for display purposes).
Example: 5
- optionsobject
Optional
Options of the custom field.
Example: {}
Response
[200] Success.
Example
{ "id": "128114939547269789", "target_type": "user", "default_value": "#steam_id", "required": false, "public": false, "position": 5, "options": {}, "machine_name": "my_steam_id", "label": "My Steam ID", "type": "steam_player_id" }
Structure (object)
- idstring
Unique identifier of the custom field.
Example: "128114939547269789"
- target_typestring
Entity affected by the custom field.
Possible values: user
- default_valuemixed|null
Default value (can be array, scalar or null). The type of value depends on the custom field type.
Example: #steam_id
- requiredboolean
Whether the custom field is required.
Example: false
- publicboolean
Whether the value of the custom field is public.
Example: false
- positioninteger
Position of the custom field (used for display purposes).
Example: 5
- optionsobject
Options of the custom field.
Example: {}
- machine_namestring
Name used to identify a custom field for computing purposes.
Pattern: ^[a-z0-9_]+$
Max. length: 255 characters
Example: "my_steam_id"
- labelstring
Label of a custom field (used for display purposes).
Max. length: 255 characters
Example: "My Steam ID"
- typestring
Data type used for both input and computing.
Example: "steam_player_id"
DELETE /custom-fields/{id}
Delete a custom field related to the platform.
Resource URL
https://api.toornament.com/platform/v2/custom-fields/{id}
HTTP headers
- X-Api-Keystring
API key of your application (see Authentication)
- Authorizationstring
Access token with
platform:admin
scope (see Authorization)
Path parameters
- idstring
The id of the requested custom field.
Query Parameters
This endpoint does not have any query parameters.
Request Body
This endpoint does not require a request body.