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-2 格式

ip_v4_addressstring

终端用户的 IPv4 地址

store_countrystring

终端用户应用商店所在国家

storestring

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

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

store_account_tokenstring

商店账户令牌

att_statusinteger

Apple App Tracking Transparency 状态(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

表示该用户画像在 USD 中获得的总收入的浮点值

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": "[email protected]",
    "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
}

服务器内部错误