# 500 Internal Server Error When Creating New Users

**URL:** <https://community.hubspot.com/t/500-internal-server-error-when-creating-new-users/98070>\
**Category:** APIs & Integrations\
**Created:** [January 17, 2024, 11:00pm UTC](https://community.hubspot.com/t/500-internal-server-error-when-creating-new-users/98070 "2024-01-17T23:00:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![TWallen](https://avatars.discourse-cdn.com/v4/letter/t/73ab20/32.png) [@TWallen](https://community.hubspot.com/u/TWallen)\
**Post date:** [January 17, 2024, 11:00pm UTC](https://community.hubspot.com/t/500-internal-server-error-when-creating-new-users/98070/1 "2024-01-17T23:00:25Z")

</div>

Workato is our integration platform to connect HubSpot with our ERP system.

For the last year, we’ve had an integration to create HubSpot users from the ERP system employees. We’ve created a custom action to Create the User following this documentation: [https://developers.hubspot.com/docs/api/settings/user-provisioning](https://developers.hubspot.com/docs/api/settings/user-provisioning).

Everything has worked well until the last few weeks. Recently, we started to receive the following error: 500 Internal Server Error: {“status”:“error”,“message”:“internal error”,“correlationId”:“a71f1330-7e98-4a15-a0e6-dacf53ba3d17”}.

Please let me know what more information you need to help us identify why we get this issue.

---

<div class="post-metadata">

**Author:** ![zach\_threadint](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/zach_threadint/32/46318_2.png) [@zach\_threadint](https://community.hubspot.com/u/zach_threadint)\
**Post date:** [January 18, 2024, 1:43am UTC](https://community.hubspot.com/t/500-internal-server-error-when-creating-new-users/98070/2 "2024-01-18T01:43:45Z")

</div>

Hi @TWallen 👋

Some additional information relating to the API request that is resulting in this error might be helpful. For example:

- Request method (e.g. POST, GET)
- Request headers
- Request URL (incl. any query string params)
- Request body

Also, when you say “custom action”, is that a [HubSpot custom code workflow action](https://developers.hubspot.com/docs/api/workflows/custom-code-actions)?

I hope this proves useful. Please let me know if you have any follow-up questions.

---

<div class="post-metadata">

**Author:** ![TWallen](https://avatars.discourse-cdn.com/v4/letter/t/73ab20/32.png) [@TWallen](https://community.hubspot.com/u/TWallen)\
**Post date:** [January 18, 2024, 4:23pm UTC](https://community.hubspot.com/t/500-internal-server-error-when-creating-new-users/98070/3 "2024-01-18T16:23:23Z")

</div>

[@zach\_threadint](https://community.hubspot.com/t5/user/viewprofilepage/user-id/324811) Thank you for your response. We are using the POST method. Our path is **[https://api.hubapi.com/settings/v3/users/](https://api.hubapi.com/settings/v3/users/)**. The custom action is an option in Workato to build our own HubSpot action with a HTTP request.  
Screenshot of the request type and body parameters. Also below is a screenshot of our response body.

 ![TWallen_0-1705594843057.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/4/4/44596943ce5524b1b3bfe46ce93d754ecc9252a9.png)

 ![TWallen_1-1705594853808.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/b/a/ba0b25778f48065de15b6193633eb958d529f169.png)

---

<div class="post-metadata">

**Author:** ![TWallen](https://avatars.discourse-cdn.com/v4/letter/t/73ab20/32.png) [@TWallen](https://community.hubspot.com/u/TWallen)\
**Post date:** [January 18, 2024, 4:24pm UTC](https://community.hubspot.com/t/500-internal-server-error-when-creating-new-users/98070/4 "2024-01-18T16:24:32Z")

</div>

```lia-code-sample
{
	"mnemonic": "Create User",
	"verb": "post",
	"response_type": "json",
	"path": "https://api.hubapi.com/settings/v3/users/",
	"input": {
		"schema": "[{\"name\":\"email\",\"type\":\"string\",\"optional\":true,\"label\":\"email\",\"control_type\":\"text\"},{\"name\":\"roleId\",\"type\":\"string\",\"optional\":true,\"label\":\"roleid\",\"control_type\":\"text\"},{\"name\":\"sendWelcomeEmail\",\"type\":\"boolean\",\"optional\":true},{\"name\":\"primaryTeamId\",\"type\":\"string\",\"optional\":false,\"hint\":\"Primary Team ID\",\"control_type\":\"text\",\"label\":\"Primary team ID\"}]",
		"data": {
			"email": "example@waremalcomb.com",
			"sendWelcomeEmail": "false",
			"primaryTeamId": "",
			"roleId": "311438"
		}
	},
	"request_type": "json",
	"output": "[{\"name\":\"id\",\"type\":\"string\",\"optional\":false,\"hint\":\"Owner ID\",\"control_type\":\"text\",\"label\":\"ID\"},{\"name\":\"userId\",\"type\":\"integer\",\"optional\":false,\"control_type\":\"integer\",\"label\":\"User ID\",\"parse_output\":\"integer_conversion\"}]"
}

```

Above is our raw JSON for the input.

---

<div class="post-metadata">

**Author:** ![zach\_threadint](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/zach_threadint/32/46318_2.png) [@zach\_threadint](https://community.hubspot.com/u/zach_threadint)\
**Post date:** [January 19, 2024, 2:33am UTC](https://community.hubspot.com/t/500-internal-server-error-when-creating-new-users/98070/5 "2024-01-19T02:33:44Z")

</div>

Hi @TWallen 👋

I’ve just managed to replicate the issue you’ve described. Seems to be related to the empty “primaryTeamId” key-value pair. When the User you’re trying to create isn’t being added to a Team, I’d suggest omitting the “primaryTeamId” key from your request. For example:

```lia-code-sample
{
 "email": "example@waremalcomb.com",
 "sendWelcomeEmail": "false",
 "roleId": "311438"
}

```

I hope this proves useful. Please let me know if you have any follow-up questions.
