User Profile API¶
Using our User Profile API, you can register user attribute information that is kept the database of your own service with User Profile in Repro.
You can segment the group of users with these registered profiles when sending push notifications or in-app messages.
For example, you can realize the following marketing practices.
Sending push notifications announcing the information of benefits for Gold member users
Delivering in-app message that inviting to a special page only for high LTV Royal customers
Registered user profile keys and data types can not be changed or deleted after. For more details, see User Profile.
Note
Standard User Profile cannot be updated via User Profile API.
Get Started¶
To use the User Profile API, you need to set the Repro API token
Get the Repro API token¶
You can find the
Repro API Token
at SETTINGS > PRODUCT SETTINGS
Warning
"REGISTER API TOKEN" makes the current API token unavailable. Once you do this operation, You never use the key again and revert to the previous state.
Update User Profile via API¶
User Profile API is associated to a single endpoint which accepts POST
HTTP method.
POST https://api.reproio.com/v2/user_profiles
Authentication¶
Set Repro API Token in HTTP header X-Repro-Token
.
Access limit per unit time¶
Access is limited per time for User Profile API.
The limit is set to 1000 accesses for every 1 minutes per API token.
When the request is completed, there will be a notification at the
X-RateLimit-Limit
header showing the maximum number of requests per time.When the request count exceeds the maximum access number, the following response
HTTP Status 429 (Too Many Requests)
will appear.
For more information on response headers, please see User Profile API responses.
Warning
The maximum access number may fluctuate without warning.
- The access limit setting value is per API token per function.For example, the push API and the user profile API use the same API token, but they are different functions, so even if they are requested at the same time, each is counted as one request.
API format¶
Set the message to HTTP body as JSON format.
user_id
: Specify the User ID that are set with the User ID API from your app.the API will return
HTTP Status 400 (Bad Request)
. For more details, see User Profile API responses.
user_profiles
: You can set multiple user profiles with one payload. (Stored in array format)key
: Set the User Profile key. String is allowed as the key for the profile. Nil or empty string are not allowed, and the maximum key length is 255 characters.type
: Set the User Profile type. (string
,int
(integer),decimal
anddatetime
)value
: Set the User Profile value. You specify the value according to the type.
String¶
Maximum value length is 255 characters.
{
"key": "Job",
"type": "string",
"value": "Developer"
}
Integer¶
{
"key": "Age",
"type": "int",
"value": 25
}
Decimal¶
{
"key": "Height",
"type": "decimal",
"value": 176.5
}
Date¶
Value can be string in ISO8601
{
"key": "LastLogin",
"type": "datetime",
"value": "2017-08-01T12:34:56.789+09:00"
}
Example of a payload for User Profile API¶
To update the profile of a single user¶
{
"user_id": "user-123",
"user_profiles": [
{
"key": "Job",
"type": "string",
"value": "Developer"
},
{
"key": "Age",
"type": "int",
"value": 25
}
]
}
Note
If there are duplicates of the same profile key, the latest profile will be updated.
Warning
Registered user profile keys and data types can not be changed or deleted after. For more details, see User Profile.
User Profile API requests¶
Request header
The response header contains the following values.
Header |
Description |
Required |
---|---|---|
Content-Type | Set application/json |
Required |
X-Repro-Token | Set the token retrieved with Get the Repro API token |
Required |
Request body
Set the message to JSON format.
User Profile API responses¶
Response header
The response header contains the following values.
Status |
Header |
Description |
---|---|---|
Success |
X-RateLimit-Limit |
Access limit per unit time |
Success |
X-RateLimit-Remaining |
The number of requests remaining in the current rate limit window. |
Success |
X-RateLimit-Reset |
The time at which the current rate limit window resets in UTC epoch seconds. (Unix UTC timestamp) |
Request limited |
Retry-After |
The time how long the user agent should wait before making a follow-up request. |
Response body
The list below contains all status codes and error messages of User Profile API responses.
202 Accepted¶
The request was successful. Please check the response body regarding the updated user ID and profile.
Response body
{
"user_id": "user-123",
"user_profiles": [
{
"key": "Job",
"type": "string",
"value": "Developer"
},
{
"key": "Age",
"type": "int",
"value": 25
},
{
"key": "LastLogin",
"type": "datetime",
"value": "2017-08-01 03:34:56.789"
}
]
}
Note
Date type profile values will be converted to UTC on the server side.
400 Bad Request¶
You have an error in your request. Please check the error message.
1001 The format of your payload is incorrect¶
Please check the format of user_id
and user_profiles
.
Response body
{
"error": {
"code": 1001,
"messages": [
"user_id is missing"
]
}
}
1002 User ID is not registered¶
The user_id in the payload has not been registered from your app yet
Response body
{
"error": {
"code": 1002,
"messages": [
"'user-123' is not registered"
]
}
}
The key, type or value in user_profiles in the payload is not properly set¶
In addition to the error message, please check API format also.
Response body
{
"error": {
"code": 1003,
"messages": [
"Job does not have a valid value"
]
}
}
Warning
If there is a profile that is not set appropriately, all profiles in the same payload will not be updated.
401 Unauthorized¶
You don't have Repro API Token set.
Response body
{
"status": "unauthorized",
"error": {
"messages": [
"Please include your Repro API Token as \"X-Repro-Token\" HTTP header."
]
}
}
403 Forbidden¶
The specified Repro API Token is invalid.
Response body
{
"status": "forbidden",
"error": {
"messages": [
"Please check your Repro API Token as \"X-Repro-Token\" HTTP header."
]
}
}
404 Not Found¶
The endpoint does not exist.
Response body
{
"status": "not_found",
"error": {
"messages": [
"Not found."
]
}
}
429 Too Many Requests¶
Too many requests. Please wait the seconds indicated in the Retry-After
header and make a follow-up request.
Response body
{
"status": "too_many_requests",
"error": {
"messages": [
"Too many requests hit the API too quickly."
]
}
}