400 User cannot be added at this time.

Hello, im getting the following error when trying to create a user through the hubspot api. Couldnt find any documentation about it and the error is very unclear to whats wrong.

This error happens for every single user that i try to create through the api.

Ive already try deleting some users to see if there was some sort of limit applied but that didnt work.

Ive also tried some different email addresses and removing the sendWelcomeEmail field altogether.

curl --location ‘https://api.hubapi.com/ settings/v3/users/’ \--header ‘Content-Type: application/json’ \--header ‘Authorization: ****’ \--header ‘Cookie: ****’ \--data-raw ‘{ “email”: “faketesting@email.com”, “sendWelcomeEmail”: “true”}’

400 BAD REQUEST
{“status”:“error”,“message”:“User cannot be added at this time.”,“correlationId”:“eaa2b0b6-c627-4b37-99a4-18ce6bf3b066”,“category”:“VALIDATION_ERROR”}

Hey there! If I were troubleshooting I’d recommend the following steps: (1) Ensure you have the proper scope assigned. You need Standard Scopes settings.users.write and Granular Scopes crm.objects.users.write. (2) I would also go through your request with a fine tooth comb. Typically 400 errors mean that the request was malformed some how. I’d put my money on that especially given the VALIDATION_ERROR in the response.

If you haven’t read through it: here’s an article on user provisioning from hubspots API docs: Accounts Dashboard | HubSpot

Hopefully that helps! If so help the community by marking it as a solution.

Happy to help troubleshoot further.

Hey patrick!
Thanks for the response. I have the proper scopes assigned, The thing is that the request used to work and it sometimes does. Its just that one day it starts failing and then the other day it works again.
Ive already went through the documentation and my request is not malformed.

Hey, @EConnectors5 :waving_hand: Like @patrick_adams mentioned, tracking down 400 errors is tough as it is likely something on your end. I just ran a quick test using the Add a User endpoint and was successful:

Request:

POST https://api.hubapi.com/settings/v3/users

{
 "sendWelcomeEmail": true,
 "firstName": "Gene",
 "lastName": "stringBelcher",
 "email": "gene222@bobsburgers.com"
}

Response:

{
 "id": "77780005",
 "email": "gene222@bobsburgers.com",
 "firstName": "Gene",
 "lastName": "stringBelcher",
 "roleIds": [],
 "sendWelcomeEmail": true,
 "superAdmin": false
}

Best,

Jaycee

Hey jaycee.
I dont think its something on my end. The request is pretty straightforward and ive made it through postman multiple times to verify that im doing it correctly, checking back and forth with the hubspot documentation.

It will some days go forward and return a 201. But other days it will return a 400 for every user create request.
For example currently im not getting the error but it will happen again as it did many other times.

as you can see here the number of errors has gone down over the days. This may be related to the fact that we halted the number of requests being made

Thank you for the response.

Hi @EConnectors5

Please use the following documentation to determine the actions you want to take.

I hope this will help you out. Please mark it as Solution Accepted and upvote to help another Community member.
Thanks!