POST /api/v2/server-side-api/profile/

创建用户画像

在 Adapty 中创建应用的新终端用户。

Header parameters

adapty-customer-user-idstring

您系统中客户的唯一 ID。adapty-customer-user-idadapty-profile-id 二者必填其一。

adapty-profile-idstring

您系统中用户画像的唯一 ID。如果您正在处理匿名用户画像,这是最佳选择。adapty-customer-user-idadapty-profile-id 二者必填其一。

adapty-platformstring

安装了您应用的用户设备平台

Request body

first_namestring

您的终端用户的名字

last_namestring

您的终端用户的姓氏

genderstring

您的终端用户的性别

One of: "f", "m", "o"

emailstring

您的终端用户的电子邮件地址

phone_numberstring

您的终端用户的电话号码

birthdaystring

您的终端用户的生日

ip_countrystring

终端用户所在国家/地区,使用两位字母的 ISO 3166-1 alpha-2 代码,例如 FR

ip_v4_addressstring

终端用户的 IPv4 地址

store_countrystring

终端用户应用商店所在国家/地区,使用两位字母的 ISO 3166-1 alpha-2 代码,例如 US

storestring

用户在您的应用中进行购买所使用的平台

One of: "app_store", "play_store", "stripe", "adapty", "paddle"

store_account_tokenstring

商店账户令牌

att_statusinteger

Apple 应用跟踪透明度(ATT)状态(0=未确定,1=受限,2=已拒绝,3=已授权)

One of: 0, 1, 2, 3

analytics_disabledboolean

用于退出外部分析的选项

custom_attributesarray of object

允许为用户画像设置最多 30 个自定义属性

keystringrequired

键必须是不超过 30 个字符的字符串。只允许使用字母、数字、破折号、点和下划线

valuestring | numberrequired

属性值不得超过 50 个字符。值只允许使用字符串和浮点数

installation_metaobjectrequired
device_idstringrequired

唯一设备标识符

devicestring

设备信息

localestring

设备语言区域

osstring

操作系统信息

platformstring

平台(iOS、Android 等)

One of: "iOS", "macOS", "iPadOS", "Android", "visionOS", "web"

timezonestring

设备时区

user_agentstring

用户代理字符串

app_buildstring

应用构建版本

app_versionstring

应用版本

adapty_sdk_versionstring

Adapty SDK 版本

idfastring

iOS 广告主标识符

idfvstring

iOS 供应商标识符

advertising_idstring

Android 广告 ID

android_idstring

Android 设备 ID

android_app_set_idstring

Android 应用集 ID

Responses

用户画像创建成功

Schema
dataobjectrequired
app_idstringrequired

您的应用程序的内部 ID

profile_idstringrequired

Adapty 用户画像 ID

customer_user_idstringrequired

您的系统中该用户的 ID

total_revenue_usdnumberrequired

一个浮点数值,表示该用户画像所产生的以美元计算的总收入

segment_hashstringrequired

内部参数

timestampintegerrequired

响应时间(毫秒),用于解决竞态条件

custom_attributesarray of objectrequired

每个用户画像最多允许设置 30 个自定义属性

keystringrequired

键必须是不超过 30 个字符的字符串。只允许使用字母、数字、破折号、点和下划线

valuestring | numberrequired

属性值不得超过 50 个字符。值只允许使用字符串和浮点数

access_levelsarray of objectrequired

访问等级对象数组。如果用户没有任何访问等级,则为空数组

access_level_idstring

访问等级标识符

storestring

购买该访问等级的商店

store_product_idstring

商店中的产品 ID

store_base_plan_idstring

商店中的基础方案 ID

store_transaction_idstring

商店中的交易 ID

store_original_transaction_idstring

商店中的原始交易 ID

offerallOf

优惠详情(若应用了促销活动或新用户优惠)

categorystring

优惠类别

One of: "introductory", "promotional", "offer_code", "win_back"

typestring

优惠类型

One of: "free_trial", "pay_as_you_go", "pay_up_front"

idstring

优惠 ID

starts_atstring

访问等级的生效时间

purchased_atstring

访问等级的购买时间

originally_purchased_atstring

访问等级的最初购买时间

expires_atstring

访问等级的到期时间

renewal_cancelled_atstring

续订取消的时间

billing_issue_detected_atstring

检测到计费问题的时间

is_in_grace_periodboolean

该访问等级是否处于宽限期

cancellation_reasonstring

取消原因

subscriptionsarray of objectrequired

订阅对象数组。如果用户没有任何订阅,则为空数组

storestring

购买订阅的商店

store_product_idstring

商店中的产品 ID

store_base_plan_idstring

商店中的基础方案 ID

store_transaction_idstring

商店中的交易 ID

store_original_transaction_idstring

商店中的原始交易 ID

offerallOf

优惠详情(若已应用促销活动或新用户优惠)

categorystring

优惠类别

One of: "introductory", "promotional", "offer_code", "win_back"

typestring

优惠类型

One of: "free_trial", "pay_as_you_go", "pay_up_front"

idstring

优惠 ID

environmentstring

环境(沙盒、生产)

purchased_atstring

订阅的购买时间

originally_purchased_atstring

订阅的首次购买时间

expires_atstring

订阅的到期时间

renewal_cancelled_atstring

取消续订的时间

billing_issue_detected_atstring

检测到计费问题的时间

is_in_grace_periodboolean

订阅是否处于宽限期

cancellation_reasonstring

取消原因

non_subscriptionsarray of objectrequired

一次性购买对象数组。如果用户没有任何购买记录,则为空数组

purchase_idstring

唯一购买标识符

storestring

购买所在的商店

store_product_idstring

商店中的产品 ID

store_base_plan_idstring

商店中的基础方案 ID

store_transaction_idstring

商店中的交易 ID

store_original_transaction_idstring

商店中的原始交易 ID

purchased_atstring

购买时间

environmentstring

环境(沙盒、生产)

is_refundboolean

是否为退款

is_consumableboolean

是否为消耗型商品

Example
{
  "data": {
    "app_id": "14c3d623-2f3a-455a-aa86-ef83dff6913b",
    "profile_id": "3286abd3-48b0-4e9c-a5f6-ac0a006804a6",
    "customer_user_id": "jane.doe@example.com",
    "total_revenue_usd": 0,
    "segment_hash": "8f45947bad31ab0c",
    "timestamp": 1736425645861,
    "custom_attributes": [
      {
        "key": "favourite_sport",
        "value": "yoga"
      }
    ],
    "access_levels": [],
    "subscriptions": [],
    "non_subscriptions": []
  }
}

未授权

Schema
errorsarray of objectrequired
sourcestring

错误来源

errorsarray of string

错误消息数组

error_codestringrequired

简短错误名称

status_codeintegerrequired

HTTP 状态码

Example
{
  "errors": [
    {
      "source": "non_field_errors",
      "errors": [
        "Authentication credentials were not provided."
      ]
    }
  ],
  "error_code": "not_authenticated",
  "status_code": 401
}

服务器内部错误