Create profile with server-side API
Creates a new end user of your app in Adapty.
Method and endpoint
POST https://api.adapty.io/api/v2/server-side-api/profile/
Parameters
Profile_id
or customer_user_id
must be set up as a header as described in Authorization.
Parameter | Type | Required in request | Nullable in request | Description |
---|---|---|---|---|
first_name | String | ➖ | ➕ | Your end user's first name. |
last_name | String | ➖ | ➕ | Your end user's last name. |
gender | String | ➖ | ➕ | Your end user's gender. |
String | ➖ | ➕ | Your end user's email. | |
phone_number | String | ➖ | ➕ | Your end user's phone number. |
birthday | ISO 8601 date | ➖ | ➖ | Your end user's birthday. |
ip_country | String | ➖ | ➖ | Country of the end user in ISO 3166-2 format. It needs to be passed if the request is made from the server and not from the client, in order to set the current country. Otherwise, we will determine the country by the IP address of the request. |
store_country | String | ➖ | ➕ | Country of the end user app store. |
store | String | ➖ | ➕ | The app store. |
analytics_disabled | Boolean | ➖ | ➖ | Option to opt out of external analytics. When analytics is disabled, events won’t be sent to integrations, and the fields idfa, idfv, and advertising_id will become nullable. ON - External analytics is opted out for this user OFF - Analytics is active by default. |
custom_attributes | Dictionary | ➖ | ➖ | Allows setting up to 30 custom attributes for the profile. If you use the custom_attributes dictionary, at least one attribute key is required. Key: Must be a string with no more than 30 characters, using only letters, numbers, dashes, periods, and underscores. Value: Must be a string or float with no more than 30 characters. Booleans will be converted to floats. To delete an attribute, send an empty value or null. |
installation_meta | Dictionary | ➖ | ➖ | Contains information about the specific app on a specific device, structured as a dictionary of Installation Meta objects. |
Example request
{
"first_name": "Jane",
"last_name": "Doe",
"gender": "f",
"email": "[email protected]",
"phone_number": "+1234567890",
"birthday": "2000-12-31",
"ip_country": "FR",
"store_country": "US",
"store": "app_store",
"analytics_disabled": true,
"custom_attributes": [
{
"key": "favourite_sport",
"value": "yoga"
}
],
"installation_meta": {
"device_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"device": "string",
"locale": "en",
"os": "string",
"platform": "iOS",
"timezone": "Europe/Rome",
"user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 17_1_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1 Mobile/15E148 Safari/604.1",
"idfa": "EA7583CD-A667-48BC-B806-42ECB2B48333",
"idfv": "E9D48DA5-3930-4B41-8521-D953AECD2F33",
"advertising_id": "",
"android_id": "",
"android_app_set_id": ""
}
}
Successful response
Header:
Name | Type | Description |
---|---|---|
Request-Id | String | The Request ID, which is included in all backend logs. Example: 758f01dfd9e74ccfbabb4934241c4966 . |
Body:
Successful response example
{
"data": {
"app_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"profile_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"customer_user_id": "8612ED7C-3477-466D-93AE-1854B8E5FDD5",
"total_revenue_usd": 109.88999999999999,
"segment_hash": "string",
"timestamp": 0,
"custom_attributes": [
{
"key": "string",
"value": "string"
}
],
"access_levels": [
{
"access_level_id": "premium",
"store": "app_store",
"store_product_id": "weekly_8.99",
"store_base_plan_id": "",
"store_transaction_id": "530001802720333",
"store_original_transaction_id": "530001724306018",
"offer": {
"category": "introductory",
"type": "free_trial",
"id": "offer12"
},
"environment": "Production",
"starts_at": "2022-10-12T09:42:50.000000+0000",
"purchased_at": "2022-10-12T09:42:50.000000+0000",
"originally_purchased_at": "2021-10-12T09:42:50.000000+0000",
"expires_at": "2022-10-12T09:42:50.000000+0000",
"renewal_cancelled_at": "2022-10-12T09:42:50.000000+0000",
"billing_issue_detected_at": "2022-10-12T09:42:50.000000+0000",
"is_in_grace_period": true,
"cancellation_reason": "voluntarily_cancelled"
}
],
"subscriptions": [
{
"store": "app_store",
"store_product_id": "weekly_8.99",
"store_base_plan_id": "",
"store_transaction_id": "530001802720333",
"store_original_transaction_id": "530001724306018",
"offer": {
"offer_category": "introductory",
"offer_type": "free_trial",
"offer_id": "offer12"
},
"environment": "Production",
"purchased_at": "2022-10-12T09:42:50.000000+0000",
"originally_purchased_at": "2021-10-12T09:42:50.000000+0000",
"expires_at": "2022-10-12T09:42:50.000000+0000",
"renewal_cancelled_at": "2022-10-12T09:42:50.000000+0000",
"billing_issue_detected_at": "2022-10-12T09:42:50.000000+0000",
"is_in_grace_period": true,
"cancellation_reason": "voluntarily_cancelled"
}
],
"non_subscriptions": [
{
"purchase_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"store": "app_store",
"store_product_id": "weekly_8.99",
"store_base_plan_id": "",
"store_transaction_id": "530001724306018",
"store_original_transaction_id": "530001724306018",
"purchased_at": "2022-10-12T09:42:50.000000+0000",
"environment": "Production",
"is_refund": true,
"is_consumable": true
}
]
}
}
Errors
401 - Unauthorized
The request failed due to missing or incorrect authorization. Check the Authorization page, paying close attention to the Authorization header.
The request also failed because the specified profile wasn’t found.
Body:
Parameter | Type | Description |
---|---|---|
errors | Object |
|
error_code | String | Short error name. Always not_authenticated . |
status_code | Integer | HTTP status. Always 401. |
Response example:
{
"errors": [
{
"source": "non_field_errors",
"errors": [
"Authentication credentials were not provided."
]
}
],
"error_code": "not_authenticated",
"status_code": 401
}
404 - Not found
The request failed because the specified profile wasn’t found.
Body
Parameter | Type | Description |
---|---|---|
errors | Object |
|
error_code | String | Short error name. Always not_found . |
status_code | Integer | HTTP status. Always 404 . |
Response example
{
"errors": [
{
"source": "non_field_errors",
"errors": [
"Not found."
]
}
],
"error_code": "not_found",
"status_code": 404
}
See also: