- 07 Aug 2023
- 2 Minutes to read
Update Identifiers
- Updated on 07 Aug 2023
- 2 Minutes to read
Overview
This API enables you to update the value of the identifiers that are already associated with users.
Take, for example, an existing user that is already a known user to Insider. This user may have updated their email address in your system. Accordingly, you may need to change the identifier(s) of this user. With this API, you can change the value of an existing identifier to a new value.
Endpoint and Headers
PATCH https://unification.useinsider.com/api/user/v1/identity
Headers
Header | Sample Value | Description |
---|---|---|
X-PARTNER-NAME | mybrand | This is your partner name. Navigate to Inone > Inone Settings > Account Preferences to copy your partner name. The partner name should be lowercase. |
X-REQUEST-TOKEN | 1a2b3c4e5d6f | This key is required to authorize your request. Refer to API Authentication Tokens to generate your token. |
Content-Type | application/json | This header specifies the media type of the resource. |
Body Parameters
Each PATCH request must have an identifier type, old value, and new value specified in it. You can use either one of the default identifiers which are uuid, email, and phone_number, or any one of the custom identifiers you are using.
Parameter | Description | Data Type | Required |
---|---|---|---|
old_identifier | User’s current identifier value | Object | Yes |
new_identifier | User’s next identifier value | Object | Yes |
custom | User’s custom identifiers information | Object | No |
User's email address | String | No | |
phone_number | User's phone number in E.164 format (e.g. +6598765432) | String | No |
uuid | User's unique user identifier | String | No |
Sample Example
Sample Request
Request with default identifiers
curl --location --request PATCH 'https://unification.useinsider.com/api/user/v1/identity' \
--header 'X-PARTNER-NAME: mybrand' \
--header 'X-REQUEST-TOKEN: 1a2b3c4e5d6f' \
--header 'Content-Type: application/json' \
--header 'Cookie: __cfduid=d1a0bc0c8335c7fecbd3485839787329b1615112066' \
--data-raw '{
"old_identifier": {
"email": "sample@mail.com"
},
"new_identifier": {
"email": "sample2@mail.com"
}
}'
Request with custom identifiers
curl --location --request PATCH 'https://unification.useinsider.com/api/user/v1/identity' \
--header 'X-PARTNER-NAME: mybrand' \
--header 'X-REQUEST-TOKEN: 1a2b3c4e5d6f' \
--header 'Content-Type: application/json' \
--header 'Cookie: __cfduid=d1a0bc0c8335c7fecbd3485839787329b1615112066' \
--data-raw '{
"old_identifier": {
"custom": {
"user_loyalty_id": "xyz123"
}
},
"new_identifier": {
"custom": {
"user_loyalty_id": "xyz123"
}
}
}'
Sample Responses
- 200 OK
- 400 Bad Request
{
"error": "identifier values are the same: bad request"
}
- 400 Bad Request
{
"error": "there must be exactly 1 entry for both new and old identifiers: bad request"
}
- 400 Bad Request
{
"error": "new identifier already has a user assigned to it: bad request"
}
- 400 Bad Request
{
"error": "no valid identifier: bad request"
}
- 429 Too Many Requests: If you exceed the rate limits, you receive an error shown below:
{
"error": "rejected: too many requests"
}
Limitations
- All functions must be executed with a simple HTTPS PATCH request.
- The request token should be provided on the request header. If the token is incorrect, no operation will be executed.
- A single HTTPS PATCH request can pass only 1 record (user).
- Maximum 25,000 requests can be sent per minute.
- Identifiers that are to be replaced should be in the same type.
- The entire request must not exceed 5 MB.
- The value of X-PARTNER-NAME header should be lowercase.