POST /api/v1/profile/save/

保存用户画像

在 Adapty Mail 中创建或更新用户画像。用户画像包含用户的电子邮件及属性, Adapty Mail 使用这些信息来识别收件人并构建市场细分

请使用稳定的 external_profile_id 标识每位用户。再次发送相同的 external_profile_id 将更新现有用户画像,而不会创建重复记录。

Request body

external_profile_idstringrequired

用户的稳定标识符,由您的应用或后端持有。在所有请求中复用相同的值, 以便 Adapty Mail 将电子邮件、点击和购买关联到同一个用户画像。请勿使用匿名标识符或按安装生成的标识符。

external_created_atstringrequired

用户创建时间,采用 ISO 8601 格式(例如 "2026-06-01T10:30:00Z")。 您可以在市场细分中使用此日期。

emailstringrequired

用户的电子邮件地址。Adapty Mail 将营销活动投递至该地址。 该地址为一次性写入:在用户画像创建时设置,后续保存不会覆盖。

customer_user_idstring

用户在您自有系统中的标识符(如果 Adapty 也能识别该标识符)。Adapty Mail 使用它来识别同时通过 Adapty SDK 触达的用户,从而使两个来源共享同一个用户画像, 而不是产生重复记录并向同一用户发送两封邮件。

first_namestring

用户的名字。

last_namestring

用户的姓氏。

genderstring

用户的性别。

birthdaystring

用户的出生日期,采用 ISO 8601 格式(例如 "1990-05-21")。

countrystring

用户所在国家/地区,采用两位大写字母的 ISO 3166-1 alpha-2 代码(例如 US)。

store_countrystring

用户的商店区域,采用两位大写字母的 ISO 3166-1 alpha-2 代码(例如 US)。

custom_attributesobject

附加到用户画像的任意键值对(字符串或数字类型的值)。可用于构建市场细分—— 例如 plansignup_sourcetrial_days

device_infoobject
platformstringrequired

用户所在的平台,例如 iOSAndroid

devicestring

设备型号,例如 iPhone15,2

osstring

操作系统版本,例如 17.5

localestring

用户的语言区域设置,例如 en-US

timezonestring

用户的时区,例如 America/New_York

app_versionstring

用户正在运行的应用版本,例如 3.1.0

Responses

用户画像保存成功。响应正文为空对象。

Schema
object
Example
{}

验证失败——必填字段缺失或无效。field_name 字段指明了具体是哪个字段。

Schema

标准错误响应。每次失败都会返回一个包含此结构的 4XX 状态。

errorsarray of object
messagestring

人类可读的错误描述。

error_codestring

机器可读的错误标识符。

status_codeinteger

此错误的 HTTP 状态码。

field_namestring

导致错误的请求字段,如果错误与字段无关则为 null

Example
{
  "errors": [
    {
      "message": "Field required",
      "error_code": "base_error",
      "status_code": 400,
      "field_name": "email"
    }
  ]
}

缺少 Secret API 密钥或密钥无效。

Schema

标准错误响应。每次失败都会返回一个包含此结构的 4XX 状态。

errorsarray of object
messagestring

人类可读的错误描述。

error_codestring

机器可读的错误标识符。

status_codeinteger

此错误的 HTTP 状态码。

field_namestring

导致错误的请求字段,如果错误与字段无关则为 null

Example
{
  "errors": [
    {
      "message": "Secret key doesn't exist",
      "error_code": "secret_key_does_not_exist_error",
      "status_code": 403,
      "field_name": null
    }
  ]
}