Segments - Create Segment
Creates a new player segment by defining the conditions on player properties. Also, create actions to target the player segments for a title.
POST https://titleId.playfabapi.com/Admin/CreateSegment
Request Header
| Name | Required | Type | Description |
|---|---|---|---|
| X-SecretKey | True |
string |
This API requires a title secret key, available to title admins, from PlayFab Game Manager. |
Request Body
| Name | Required | Type | Description |
|---|---|---|---|
| SegmentModel | True |
Segment model with all of the segment properties data. |
Responses
| Name | Type | Description |
|---|---|---|
| 200 OK | ||
| 400 Bad Request |
This is the outer wrapper for all responses with errors |
Security
X-SecretKey
This API requires a title secret key, available to title admins, from PlayFab Game Manager.
Type:
apiKey
In:
header
Definitions
AdCampaignSegmentFilter
| Name | Type | Description |
|---|---|---|
| CampaignId |
string |
Campaign id. |
| CampaignSource |
string |
Campaign source. |
| Comparison |
Campaign comparison. |
AddInventoryItemsV2SegmentAction
| Name | Type | Description |
|---|---|---|
| Amount |
number |
Amount of the item to be granted to a player |
| CollectionId |
string |
The collection id for where the item will be granted in the player inventory |
| DurationInSeconds |
number |
The duration in seconds of the subscription to be granted to a player |
| ItemId |
string |
The id of item to be granted to the player |
| StackId |
string |
The stack id for where the item will be granted in the player inventory |
AllPlayersSegmentFilter
ApiErrorWrapper
The basic wrapper around every failed API response
| Name | Type | Description |
|---|---|---|
| code |
integer |
Numerical HTTP code |
| error |
string |
Playfab error code |
| errorCode |
integer |
Numerical PlayFab error code |
| errorDetails |
object |
Detailed description of individual issues with the request object |
| errorMessage |
string |
Description for the PlayFab errorCode |
| status |
string |
String HTTP code |
BanPlayerSegmentAction
| Name | Type | Description |
|---|---|---|
| BanHours |
number |
Ban hours duration. |
| ReasonForBan |
string |
Reason for ban. |
ChurnPredictionSegmentFilter
| Name | Type | Description |
|---|---|---|
| Comparison |
Comparison |
|
| RiskLevel |
RiskLevel |
ChurnRiskLevel
| Value | Description |
|---|---|
| NoData | |
| LowRisk | |
| MediumRisk | |
| HighRisk |
CreateSegmentRequest
Send all the segment details part of CreateSegmentRequest
| Name | Type | Description |
|---|---|---|
| SegmentModel |
Segment model with all of the segment properties data. |
CreateSegmentResponse
| Name | Type | Description |
|---|---|---|
| ErrorMessage |
string |
Error message. |
| SegmentId |
string |
Segment id. |
CustomPropertyBooleanSegmentFilter
| Name | Type | Description |
|---|---|---|
| Comparison |
Custom property comparison. |
|
| PropertyName |
string |
Custom property name. |
| PropertyValue |
boolean |
Custom property boolean value. |
CustomPropertyDateTimeSegmentFilter
| Name | Type | Description |
|---|---|---|
| Comparison |
Custom property comparison. |
|
| PropertyName |
string |
Custom property name. |
| PropertyValue |
string |
Custom property datetime value. |
CustomPropertyNumericSegmentFilter
| Name | Type | Description |
|---|---|---|
| Comparison |
Custom property comparison. |
|
| PropertyName |
string |
Custom property name. |
| PropertyValue |
number |
Custom property numeric value. |
CustomPropertyStringSegmentFilter
| Name | Type | Description |
|---|---|---|
| Comparison |
Custom property comparison. |
|
| PropertyName |
string |
Custom property name. |
| PropertyValue |
string |
Custom property string value. |
DeleteInventoryItemsV2SegmentAction
| Name | Type | Description |
|---|---|---|
| CollectionId |
string |
The collection id for where the item will be removed from the player inventory |
| ItemId |
string |
The id of item to be removed from the player |
| StackId |
string |
The stack id for where the item will be removed from the player inventory |
DeletePlayerSegmentAction
DeletePlayerStatisticSegmentAction
| Name | Type | Description |
|---|---|---|
| StatisticName |
string |
Statistic name. |
EmailNotificationSegmentAction
| Name | Type | Description |
|---|---|---|
| EmailTemplateId |
string |
Email template id. |
| EmailTemplateName |
string |
Email template name. |
ExecuteAzureFunctionSegmentAction
| Name | Type | Description |
|---|---|---|
| AzureFunction |
string |
Azure function. |
| FunctionParameter |
object |
Azure function parameter. |
| GenerateFunctionExecutedEvents |
boolean |
Generate play stream event. |
ExecuteCloudScriptSegmentAction
| Name | Type | Description |
|---|---|---|
| CloudScriptFunction |
string |
Cloud script function. |
| CloudScriptPublishResultsToPlayStream |
boolean |
Generate play stream event. |
| FunctionParameter |
object |
Cloud script function parameter. |
| FunctionParameterJson |
string |
Cloud script function parameter json text. |
FirstLoginDateSegmentFilter
| Name | Type | Description |
|---|---|---|
| Comparison |
First player login date comparison. |
|
| LogInDate |
string |
First player login date. |
FirstLoginTimespanSegmentFilter
| Name | Type | Description |
|---|---|---|
| Comparison |
First player login duration comparison. |
|
| DurationInMinutes |
number |
First player login duration. |
GrantItemSegmentAction
| Name | Type | Description |
|---|---|---|
| CatelogId |
string |
Item catalog id. |
| ItemId |
string |
Item id. |
| Quantity |
number |
Item quantity. |
GrantVirtualCurrencySegmentAction
| Name | Type | Description |
|---|---|---|
| Amount |
number |
Virtual currency amount. |
| CurrencyCode |
string |
Virtual currency code. |
IncrementPlayerStatisticSegmentAction
| Name | Type | Description |
|---|---|---|
| IncrementValue |
number |
Increment value. |
| StatisticName |
string |
Statistic name. |
LastLoginDateSegmentFilter
| Name | Type | Description |
|---|---|---|
| Comparison |
Last player login date comparison. |
|
| LogInDate |
string |
Last player login date. |
LastLoginTimespanSegmentFilter
| Name | Type | Description |
|---|---|---|
| Comparison |
Last player login duration comparison. |
|
| DurationInMinutes |
number |
Last player login duration. |
LinkedUserAccountHasEmailSegmentFilter
| Name | Type | Description |
|---|---|---|
| Comparison |
Login provider comparison. |
|
| LoginProvider |
Login provider. |
LinkedUserAccountSegmentFilter
| Name | Type | Description |
|---|---|---|
| LoginProvider |
Login provider. |
LocationSegmentFilter
| Name | Type | Description |
|---|---|---|
| CountryCode |
Segment country code. |
PlayerChurnPredictionSegmentFilter
| Name | Type | Description |
|---|---|---|
| Comparison |
Comparison |
|
| RiskLevel |
RiskLevel |
PlayerChurnPredictionTimeSegmentFilter
| Name | Type | Description |
|---|---|---|
| Comparison |
Comparison |
|
| DurationInDays |
number |
DurationInDays |
PlayerChurnPreviousPredictionSegmentFilter
| Name | Type | Description |
|---|---|---|
| Comparison |
Comparison |
|
| RiskLevel |
RiskLevel |
PushNotificationSegmentAction
| Name | Type | Description |
|---|---|---|
| PushNotificationTemplateId |
string |
Push notification template id. |
PushNotificationSegmentFilter
| Name | Type | Description |
|---|---|---|
| PushNotificationDevicePlatform |
Push notification device platform. |
SegmentAndDefinition
| Name | Type | Description |
|---|---|---|
| AdCampaignFilter |
Filter property for ad campaign filter. |
|
| AllPlayersFilter |
property for all player filter. |
|
| ChurnPredictionFilter |
Filter property for player churn risk level. |
|
| CustomPropertyBooleanFilter |
Filter property for boolean custom properties. |
|
| CustomPropertyDateTimeFilter |
Filter property for datetime custom properties. |
|
| CustomPropertyNumericFilter |
Filter property for numeric custom properties. |
|
| CustomPropertyStringFilter |
Filter property for string custom properties. |
|
| FirstLoginDateFilter |
Filter property for first login date. |
|
| FirstLoginFilter |
Filter property for first login timespan. |
|
| LastLoginDateFilter |
Filter property for last login date. |
|
| LastLoginFilter |
Filter property for last login timespan. |
|
| LinkedUserAccountFilter |
Filter property for linked in user account. |
|
| LinkedUserAccountHasEmailFilter |
Filter property for linked in user account has email. |
|
| LocationFilter |
Filter property for location. |
|
| PlayerChurnPredictionFilter |
Filter property for current player churn value. |
|
| PlayerChurnPredictionTimeFilter |
Filter property for player churn timespan. |
|
| PlayerChurnPreviousPredictionFilter |
Filter property for previous player churn value. |
|
| PushNotificationFilter |
Filter property for push notification. |
|
| StatisticFilter |
Filter property for statistics. |
|
| TagFilter |
Filter property for tags. |
|
| TotalValueToDateInUSDFilter |
Filter property for total value to date in USD. |
|
| UserOriginationFilter |
Filter property for user origination. |
|
| ValueToDateFilter |
Filter property for value to date. |
|
| VirtualCurrencyBalanceFilter |
Filter property for virtual currency. |
SegmentCountryCode
| Value | Description |
|---|---|
| AF | |
| AX | |
| AL | |
| DZ | |
| AS | |
| AD | |
| AO | |
| AI | |
| AQ | |
| AG | |
| AR | |
| AM | |
| AW | |
| AU | |
| AT | |
| AZ | |
| BS | |
| BH | |
| BD | |
| BB | |
| BY | |
| BE | |
| BZ | |
| BJ | |
| BM | |
| BT | |
| BO | |
| BQ | |
| BA | |
| BW | |
| BV | |
| BR | |
| IO | |
| BN | |
| BG | |
| BF | |
| BI | |
| KH | |
| CM | |
| CA | |
| CV | |
| KY | |
| CF | |
| TD | |
| CL | |
| CN | |
| CX | |
| CC | |
| CO | |
| KM | |
| CG | |
| CD | |
| CK | |
| CR | |
| CI | |
| HR | |
| CU | |
| CW | |
| CY | |
| CZ | |
| DK | |
| DJ | |
| DM | |
| DO | |
| EC | |
| EG | |
| SV | |
| GQ | |
| ER | |
| EE | |
| ET | |
| FK | |
| FO | |
| FJ | |
| FI | |
| FR | |
| GF | |
| PF | |
| TF | |
| GA | |
| GM | |
| GE | |
| DE | |
| GH | |
| GI | |
| GR | |
| GL | |
| GD | |
| GP | |
| GU | |
| GT | |
| GG | |
| GN | |
| GW | |
| GY | |
| HT | |
| HM | |
| VA | |
| HN | |
| HK | |
| HU | |
| IS | |
| IN | |
| ID | |
| IR | |
| IQ | |
| IE | |
| IM | |
| IL | |
| IT | |
| JM | |
| JP | |
| JE | |
| JO | |
| KZ | |
| KE | |
| KI | |
| KP | |
| KR | |
| KW | |
| KG | |
| LA | |
| LV | |
| LB | |
| LS | |
| LR | |
| LY | |
| LI | |
| LT | |
| LU | |
| MO | |
| MK | |
| MG | |
| MW | |
| MY | |
| MV | |
| ML | |
| MT | |
| MH | |
| MQ | |
| MR | |
| MU | |
| YT | |
| MX | |
| FM | |
| MD | |
| MC | |
| MN | |
| ME | |
| MS | |
| MA | |
| MZ | |
| MM | |
| NA | |
| NR | |
| NP | |
| NL | |
| NC | |
| NZ | |
| NI | |
| NE | |
| NG | |
| NU | |
| NF | |
| MP | |
| NO | |
| OM | |
| PK | |
| PW | |
| PS | |
| PA | |
| PG | |
| PY | |
| PE | |
| PH | |
| PN | |
| PL | |
| PT | |
| PR | |
| QA | |
| RE | |
| RO | |
| RU | |
| RW | |
| BL | |
| SH | |
| KN | |
| LC | |
| MF | |
| PM | |
| VC | |
| WS | |
| SM | |
| ST | |
| SA | |
| SN | |
| RS | |
| SC | |
| SL | |
| SG | |
| SX | |
| SK | |
| SI | |
| SB | |
| SO | |
| ZA | |
| GS | |
| SS | |
| ES | |
| LK | |
| SD | |
| SR | |
| SJ | |
| SZ | |
| SE | |
| CH | |
| SY | |
| TW | |
| TJ | |
| TZ | |
| TH | |
| TL | |
| TG | |
| TK | |
| TO | |
| TT | |
| TN | |
| TR | |
| TM | |
| TC | |
| TV | |
| UG | |
| UA | |
| AE | |
| GB | |
| US | |
| UM | |
| UY | |
| UZ | |
| VU | |
| VE | |
| VN | |
| VG | |
| VI | |
| WF | |
| EH | |
| YE | |
| ZM | |
| ZW |
SegmentCurrency
| Value | Description |
|---|---|
| AED | |
| AFN | |
| ALL | |
| AMD | |
| ANG | |
| AOA | |
| ARS | |
| AUD | |
| AWG | |
| AZN | |
| BAM | |
| BBD | |
| BDT | |
| BGN | |
| BHD | |
| BIF | |
| BMD | |
| BND | |
| BOB | |
| BRL | |
| BSD | |
| BTN | |
| BWP | |
| BYR | |
| BZD | |
| CAD | |
| CDF | |
| CHF | |
| CLP | |
| CNY | |
| COP | |
| CRC | |
| CUC | |
| CUP | |
| CVE | |
| CZK | |
| DJF | |
| DKK | |
| DOP | |
| DZD | |
| EGP | |
| ERN | |
| ETB | |
| EUR | |
| FJD | |
| FKP | |
| GBP | |
| GEL | |
| GGP | |
| GHS | |
| GIP | |
| GMD | |
| GNF | |
| GTQ | |
| GYD | |
| HKD | |
| HNL | |
| HRK | |
| HTG | |
| HUF | |
| IDR | |
| ILS | |
| IMP | |
| INR | |
| IQD | |
| IRR | |
| ISK | |
| JEP | |
| JMD | |
| JOD | |
| JPY | |
| KES | |
| KGS | |
| KHR | |
| KMF | |
| KPW | |
| KRW | |
| KWD | |
| KYD | |
| KZT | |
| LAK | |
| LBP | |
| LKR | |
| LRD | |
| LSL | |
| LYD | |
| MAD | |
| MDL | |
| MGA | |
| MKD | |
| MMK | |
| MNT | |
| MOP | |
| MRO | |
| MUR | |
| MVR | |
| MWK | |
| MXN | |
| MYR | |
| MZN | |
| NAD | |
| NGN | |
| NIO | |
| NOK | |
| NPR | |
| NZD | |
| OMR | |
| PAB | |
| PEN | |
| PGK | |
| PHP | |
| PKR | |
| PLN | |
| PYG | |
| QAR | |
| RON | |
| RSD | |
| RUB | |
| RWF | |
| SAR | |
| SBD | |
| SCR | |
| SDG | |
| SEK | |
| SGD | |
| SHP | |
| SLL | |
| SOS | |
| SPL | |
| SRD | |
| STD | |
| SVC | |
| SYP | |
| SZL | |
| THB | |
| TJS | |
| TMT | |
| TND | |
| TOP | |
| TRY | |
| TTD | |
| TVD | |
| TWD | |
| TZS | |
| UAH | |
| UGX | |
| USD | |
| UYU | |
| UZS | |
| VEF | |
| VND | |
| VUV | |
| WST | |
| XAF | |
| XCD | |
| XDR | |
| XOF | |
| XPF | |
| YER | |
| ZAR | |
| ZMW | |
| ZWD |
SegmentFilterComparison
| Value | Description |
|---|---|
| GreaterThan | |
| LessThan | |
| EqualTo | |
| NotEqualTo | |
| GreaterThanOrEqual | |
| LessThanOrEqual | |
| Exists | |
| Contains | |
| NotContains |
SegmentLoginIdentityProvider
| Value | Description |
|---|---|
| Unknown | |
| PlayFab | |
| Custom | |
| GameCenter | |
| GooglePlay | |
| Steam | |
| XBoxLive | |
| PSN | |
| Kongregate | |
| IOSDevice | |
| AndroidDevice | |
| Twitch | |
| WindowsHello | |
| GameServer | |
| CustomServer | |
| NintendoSwitch | |
| FacebookInstantGames | |
| OpenIdConnect | |
| Apple | |
| NintendoSwitchAccount | |
| GooglePlayGames |
SegmentModel
| Name | Type | Description |
|---|---|---|
| Description |
string |
Segment description. |
| EnteredSegmentActions |
Segment actions for current entered segment players. |
|
| LastUpdateTime |
string |
Segment last updated date time. |
| LeftSegmentActions |
Segment actions for current left segment players. |
|
| Name |
string |
Segment name. |
| SegmentId |
string |
Segment id in hex. |
| SegmentOrDefinitions |
Segment or definitions. This includes segment and definitions and filters. |
SegmentOrDefinition
| Name | Type | Description |
|---|---|---|
| SegmentAndDefinitions |
List of segment and definitions. |
SegmentPushNotificationDevicePlatform
| Value | Description |
|---|---|
| ApplePushNotificationService | |
| GoogleCloudMessaging |
SegmentTrigger
| Name | Type | Description |
|---|---|---|
| AddInventoryItemsV2Action |
Add inventory item v2 segment trigger action. |
|
| BanPlayerAction |
Ban player segment trigger action. |
|
| DeleteInventoryItemsV2Action |
Delete inventory item v2 segment trigger action. |
|
| DeletePlayerAction |
Delete player segment trigger action. |
|
| DeletePlayerStatisticAction |
Delete player statistic segment trigger action. |
|
| EmailNotificationAction |
Email notification segment trigger action. |
|
| ExecuteAzureFunctionAction |
Execute azure function segment trigger action. |
|
| ExecuteCloudScriptAction |
Execute cloud script segment trigger action. |
|
| GrantItemAction |
Grant item segment trigger action. |
|
| GrantVirtualCurrencyAction |
Grant virtual currency segment trigger action. |
|
| IncrementPlayerStatisticAction |
Increment player statistic segment trigger action. |
|
| PushNotificationAction |
Push notification segment trigger action. |
|
| SubtractInventoryItemsV2Action |
Subtract inventory item v2 segment trigger action. |
StatisticSegmentFilter
| Name | Type | Description |
|---|---|---|
| Comparison |
Statistic filter comparison. |
|
| FilterValue |
string |
Statistic filter value. |
| Name |
string |
Statistic name. |
| UseCurrentVersion |
boolean |
Use current version of statistic? |
| Version |
number |
Statistic version. |
SubtractInventoryItemsV2SegmentAction
| Name | Type | Description |
|---|---|---|
| Amount |
number |
Amount of the item to removed from the player |
| CollectionId |
string |
The collection id for where the item will be removed from the player inventory |
| DurationInSeconds |
number |
The duration in seconds to be removed from the subscription in the players inventory |
| ItemId |
string |
The id of item to be removed from the player |
| StackId |
string |
The stack id for where the item will be removed from the player inventory |
TagSegmentFilter
| Name | Type | Description |
|---|---|---|
| Comparison |
Tag comparison. |
|
| TagValue |
string |
Tag value. |
TotalValueToDateInUSDSegmentFilter
| Name | Type | Description |
|---|---|---|
| Amount |
string |
Total value to date USD amount. |
| Comparison |
Total value to date USD comparison. |
UserOriginationSegmentFilter
| Name | Type | Description |
|---|---|---|
| LoginProvider |
User login provider. |
ValueToDateSegmentFilter
| Name | Type | Description |
|---|---|---|
| Amount |
string |
Value to date amount. |
| Comparison |
Value to date comparison. |
|
| Currency |
Currency using for filter. |
VirtualCurrencyBalanceSegmentFilter
| Name | Type | Description |
|---|---|---|
| Amount |
number |
Total amount. |
| Comparison |
Amount comparison. |
|
| CurrencyCode |
string |
Currency code. |
Error Codes
| Name | Code |
|---|---|
| InvalidSegment | 1242 |
| NameNotAvailable | 1058 |
| ProductDisabledForTitle | 1609 |
| SegmentManagementInvalidInput | 10005 |
| SegmentManagementInvalidSegmentId | 10004 |
| SegmentManagementInvalidSegmentName | 10006 |
| SegmentManagementNoExpressionTree | 10001 |
| SegmentManagementSegmentCountOverLimit | 10003 |
| SegmentManagementTriggerActionCountOverLimit | 10002 |
| UnknownError | 1039 |