# 500 when creating user via API

**URL:** <https://meta.discourse.org/t/500-when-creating-user-via-api/82309>\
**Category:** Product Support\
**Created:** [March 6, 2018, 1:57pm UTC](https://meta.discourse.org/t/500-when-creating-user-via-api/82309 "2018-03-06T13:57:08Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Juraj\_Matejcic](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/juraj_matejcic/32/120015_2.png) [@Juraj\_Matejcic](https://meta.discourse.org/u/Juraj_Matejcic)\
**Post date:** [March 6, 2018, 1:57pm UTC](https://meta.discourse.org/t/500-when-creating-user-via-api/82309/1 "2018-03-06T13:57:08Z")

</div>

We’re getting a 500 internal server error when trying to create a user via the API, here’s what I get from production.log:

```plaintext
Started POST "/users" for 127.0.0.1 at 2018-03-06 13:28:04 +0000
Processing by UsersController#create as */*
  Parameters: {"email"=>"removed", "api_key"=>"[FILTERED]", "api_username"=>"removed", "username"=>"removed", "name"=>"removed", "password"=>"[FILTERED]"}
  Rendering text template
  Rendered text template (0.0ms)
Completed 500 Internal Server Error in 42ms (Views: 1.7ms | ActiveRecord: 9.6ms)

```

I’m just using curl on the machine itself, so via:

```plaintext
curl -k -v -X POST -F 'email=removed' -F 'api_key=removed' -F 'api_username=removed' -F 'username=removed' -F 'name=removed' -F 'password=removed' https://foo.bar/users

```

Worth noting that getting the list of users via the API works just fine. Same api\_key and api\_username.

New user registration is enabled, and invite only is enabled.

We’re using the LDAP plugin, but I can’t see what that’d have to do with the API.

Our version’s at `v2.0.0.beta3 +292`, which might also be a problem, since this stopped working after an upgrade.

Doing a rebuild app doesn’t fix the issue.

If needed, I can provide the verbose curl out as well, but the only important bit there is:

```plaintext
< HTTP/1.1 100 Continue
< HTTP/1.1 500 Internal Server Error
< Server: nginx
< Date: Tue, 06 Mar 2018 13:52:25 GMT
< Content-Type: text/plain; charset=utf-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< X-Frame-Options: SAMEORIGIN
< X-XSS-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< X-Discourse-Username: removed
< X-Discourse-Route: users/create
< Cache-Control: no-store, must-revalidate, no-cache, private
< X-Request-Id: d8dfb524-26b7-4a76-a4a8-96f70cb9e244
< Set-Cookie: __profilin=p%3Dt%2Ca%3D5b595ba25bbff59a6b51f6d39f6ace45%7C0b364c7fb766ced5be17866e10020175; path=/
< X-Runtime: 0.027306
* HTTP error before end of send, stop sending

```

We’ve also got some older backups, so restoring to a previous version can be done. We’ve not gone live with this yet, so we can break it (further) to some extent.

Cheers,  
Juraj

---

_[View the full topic](https://meta.discourse.org/t/500-when-creating-user-via-api/82309)._
