Get profile with server-side API
Retrieves the details of an existing end user of your app.
Method and endpoint
GET https://api.adapty.io/api/v2/server-side-api/profile/
Example request
- cURL
- Python
- JavaScript
curl --location 'https://api.adapty.io/api/v2/server-side-api/profile/' \
--header 'adapty-customer-user-id: <YOUR_CUSTOMER_USER_ID>' \
--header 'Content-Type: application/json' \
--header 'Authorization: Api-Key <YOUR_SECRET_API_KEY>'
import requests
import json
url = "https://api.adapty.io/api/v2/server-side-api/profile/"
headers = {
"adapty-customer-user-id": "<YOUR_CUSTOMER_USER_ID>",
"Content-Type": "application/json",
"Authorization": "Api-Key <YOUR_SECRET_API_KEY>"
}
response = requests.get(url, headers=headers)
print(response.text)
const myHeaders = new Headers();
myHeaders.append("Authorization", "Api-Key <YOUR_SECRET_API_KEY>");
myHeaders.append("adapty-customer-user-id", "<YOUR_CUSTOMER_USER_ID>");
myHeaders.append("Content-Type", "application/json");
const requestOptions = {
method: "GET",
headers: myHeaders,
redirect: "follow"
};
fetch("https://api.adapty.io/api/v2/server-side-api/profile/", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
Placeholders:
<YOUR_CUSTOMER_USER_ID>
: The unique ID of the customer in your system.<YOUR_SECRET_API_KEY>
: Your secret API key for authorization.
Parameters
No parameters
Successful response: 200: OK
The request is successful. The response body contains the data
field, which encapsulates the user's profile and associated information.
Parameter | Type | Nullable | Description |
---|---|---|---|
data | Object | ➖ | Contains the Profile object with user details and metadata. |
data object structure
The data
field is the primary container for the user profile. It includes several fields:
Parameter | Type | Nullable | Description |
---|---|---|---|
app_id | String | ➖ | The internal ID of your app. You can see in the the Adapty Dashboard: App Settings -> General tab. |
profile_id | UUID | ➖ | Adapty profile ID. You can see it in the Adapty ID field on the Adapty Dashboard -> Profiles -> specific profile page. |
customer_user_id | String | ➕ | The ID of your user in your system. You can see it in the Customer user ID field on the Adapty Dashboard -> Profiles -> specific profile page. It will work only if you identify the users in your mobile app code via Adapty SDK. |
total_revenue_usd | Float | ➖ | A float value representing the total revenue in USD earned in the profile. |
segment_hash | String | ➖ | Internal parameter. |
timestamp | Integer | ➖ | Response time in milliseconds, needs for resolve a race condition. |
custom_attributes | Dictionary | ➖ | A maximum of 30 custom attributes to the profile are allowed to be set. If you provide the Key: The key must be a string with no more than 30 characters. Only letters, numbers, dashes, points, and underscores allowed Value: The attribute value must be no more than 30 characters. Only strings and floats are allowed as values, booleans will be converted to floats. Send an empty value or null to delete the attribute. |
access_levels | Dictionary | ➕ | Profile Paid Access Level objects. Dictionary where the keys are paid access level identifiers configured by a developer in the Adapty Dashboard. Values are Access level objects. Can be null if the customer has no access levels. |
subscriptions | Dictionary | ➕ | Dictionary where the keys are vendor product IDs. Values are Subscription objects. Can be null if the customer has no subscriptions. |
non_subscriptions | Dictionary | ➕ | Dictionary where the keys are vendor product ids. Values are an array of Non-Subscription objects. Can be null if the customer has no purchases. |
Successful response example
{
"data": {
"app_id": "14c3d333-2f3a-455a-aa86-ef83dff6913b",
"profile_id": "d8533a10-bcce-4e33-8c9d-88b05ac56559",
"customer_user_id": "77B14FB4-FD2A-4D38-AA3A-4C433F79863C",
"total_revenue_usd": 9.99,
"segment_hash": "fdaeef7f8aaa33c9",
"timestamp": 1733324566777,
"custom_attributes": [
{
"key": "favourite_sport",
"value": "yoga"
}
],
"access_levels": [
{
"access_level_id": "premium",
"store": "app_store",
"store_product_id": "unlimited.9999",
"store_base_plan_id": null,
"store_transaction_id": "2000000335013007",
"store_original_transaction_id": "2000000335013007",
"offer": null,
"starts_at": null,
"purchased_at": "2024-12-24T10:50:23+00:00",
"originally_purchased_at": "2024-12-24T10:50:23+00:00",
"expires_at": null,
"renewal_cancelled_at": "2025-01-05T13:27:47.461425+00:00",
"billing_issue_detected_at": null,
"is_in_grace_period": false,
"cancellation_reason": null
}
],
"subscriptions": [
{
"store": "app_store",
"store_product_id": "unlimited.9999",
"store_base_plan_id": null,
"store_transaction_id": "2000000815013007",
"store_original_transaction_id": "2000000815013007",
"offer": null,
"environment": "Sandbox",
"purchased_at": "2024-12-24T10:50:23+00:00",
"originally_purchased_at": "2024-12-24T10:50:23+00:00",
"expires_at": null,
"renewal_cancelled_at": null,
"billing_issue_detected_at": null,
"is_in_grace_period": false,
"cancellation_reason": null
},
{
"store": "app_store",
"store_product_id": "weekly.premium.599",
"store_base_plan_id": null,
"store_transaction_id": "2000000825768152",
"store_original_transaction_id": "2000000815033245",
"offer": null,
"environment": "Sandbox",
"purchased_at": "2024-12-24T11:13:04+00:00",
"originally_purchased_at": "2024-12-24T11:13:04+00:00",
"expires_at": "2025-01-10T11:34:40+00:00",
"renewal_cancelled_at": null,
"billing_issue_detected_at": null,
"is_in_grace_period": false,
"cancellation_reason": null
}
],
"non_subscriptions": [
{
"purchase_id": "7a5f9a7d-e236-33e6-96d8-53a3c59c5562",
"store": "app_store",
"store_product_id": "1year.premium",
"store_base_plan_id": null,
"store_transaction_id": "30002109551456",
"store_original_transaction_id": "30002109551456",
"purchased_at": "2022-10-12T09:42:50+00:00",
"environment": "Production",
"is_refund": false,
"is_consumable": false
}
]
}
}
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. Double-check the customer_user_id
or profile_id
for any typos.
Body
Parameter | Type | Description |
---|---|---|
errors | Object |
|
error_code | String | Short error name. Always profile_does_not_exist . |
status_code | Integer | HTTP status. Always 404 . |
Response example
{
"errors": [
{
"source": null,
"errors": [
"Profile not found"
]
}
],
"error_code": "profile_does_not_exist",
"status_code": 404
}
See also: