How do I add custom fields to a user?

Hi, i’m trying to create a new user with custom fields and I have this code:

const chatUser = await axios.post('https://' + process.env.CHAT_URL + '/api/v1/users.create', {
        username,
        name,
        email,
        password,
        customFields: {
          crm,
          genre,
          cpf,  
        }
      }, {
        headers: {
          'X-Auth-Token': process.env.CHAT_AUTH_TOKEB,
          'X-User-Id': process.env.CHAT_USER_ID,
        }
      })

The users were created, but when I click to view their fields, the custom fields don’t appear. I also checked the documentation and I need to put the custom fields in “Administration > Accounts > Registration > Custom fields”, but the “Accounts” tab does not exist in Administration.

Hi! Welcome to our Community :hugs:

First you need to set the custom field you want in ADMIN > SETTINGS > ACCOUNTS > REGISTRATION > CUSTOM FIELDS

This is the payload you need:

{
	"name": "name here",
	"email": "email@user.tld",
	"password": "anypassyouwant",
	"username": "uniqueusername",
	"customFields": {
      "cpf": "cpfhere",
      "genre": "female",
      "crm": 12345
    }
}

let me know if this helps :slight_smile: