# Update or create user

You can create or update users based on the "custom_id" key value. If a user with the provided value exists, we will update his profile with provided data, otherwise, a new user will be created. You can also set up any custom attribute of your choice. Custom attributes have to be created in the User.com app before sending them within requests.

POST /users/update_or_create/

Attributes Type Required Description
custom_id string no The unique identifier for the user which is provided by the client.
company_custom_id string no A unique identifier for the company which is provided by the client.
custom_attr string no An example value of your custom attribute.
email string no A user email address.
first_name string no A first name for a user (the maximum number of characters is 40).
last_name string no A last name for a user (the maximum number of characters is 40).
tags list(strings) no A list of tag names.

# Request

  • CURL
  • JavaScript
  • PHP
  • Python
 curl -X POST -H "Authorization: Token <your_64_char_api_key>"
     -H "Accept: */*; version=2" -H "Content-Type: application/json" -d '{
  "custom_id": "my_custom_id",
  "first_name": "John",
  "last_name": "Doe",
  "tags": ["updated", "verified"]
}' "https://<your_app_subdomain>.user.com/api/public/users/update_or_create/"

# Response

{
  "created": true,
  "id": 5577
}