# Incorrect user\_field information - API docs

**URL:** https://meta.discourse.org/t/incorrect-user-field-information-api-docs/161413
**Category:** Development
**Tags:** rest-api
**Created:** [August 19, 2020, 7:44pm UTC](https://meta.discourse.org/t/incorrect-user-field-information-api-docs/161413 "2020-08-19T19:44:15Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![zsan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zsan/32/190906_2.png) [@zsan](https://meta.discourse.org/u/zsan)
#### Post date: [August 19, 2020, 7:44pm UTC](https://meta.discourse.org/t/incorrect-user-field-information-api-docs/161413/1 "2020-08-19T19:44:15Z")

</div>

[create user field](https://docs.discourse.org/#tag/User-Fields/paths/~1admin~1customize~1user_fields.json/post)

I see

```plaintext
{
  "user_field[name]": "string",
  "user_field[description]": "string",
  "user_field[field_type": "string",
  "user_field[required]": true
}

```

Are you sure ?

I think it should be something like

```plaintext
{
  "user_field: {
     "name": "asdf",
     "description": "asdf",
     "field_type": "confirm",
     "required": true
  }
}

```

---

<div class="post-metadata">

### Author: ![HAWK](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hawk/32/86627_2.png) [@HAWK](https://meta.discourse.org/u/HAWK)
#### Post date: [August 19, 2020, 11:54pm UTC](https://meta.discourse.org/t/incorrect-user-field-information-api-docs/161413/2 "2020-08-19T23:54:16Z")

</div>

I believe that @blake wrote that documentation so let’s see what he reckons here.

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [August 20, 2020, 12:43am UTC](https://meta.discourse.org/t/incorrect-user-field-information-api-docs/161413/3 "2020-08-20T00:43:29Z")

</div>

Yes, if you are using `Content-Type: application/json` you should send it in like

> [@zsan](#):
>
> ```plaintext
> {
> "user_field: {
> "name": "asdf",
> "description": "asdf",
> "field_type": "confirm",
> "required": true
> }
> }
> 
> ```

The example in the api docs is using `Content-Type: multipart/form-data`, but I’ll be sure to update it to the json example.

---

<div class="post-metadata">

### Author: ![zsan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zsan/32/190906_2.png) [@zsan](https://meta.discourse.org/u/zsan)
#### Post date: [August 20, 2020, 8:51am UTC](https://meta.discourse.org/t/incorrect-user-field-information-api-docs/161413/4 "2020-08-20T08:51:56Z")

</div>

![Screen Shot 2020-08-20 at 15.48.17](https://global.discourse-cdn.com/meta/original/3X/6/9/69a83f473463591d58ed63aa9820220dc78f4a43.png)

Thank you @blake

Note:  
The problem is .. i see `application/json` in the example (so that’s why my partner spent all hours to figure it out how to use this call)

---

<div class="post-metadata">

### Author: ![JamesNorth](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jamesnorth/32/283740_2.png) [@JamesNorth](https://meta.discourse.org/u/JamesNorth)
#### Post date: [January 21, 2024, 5:23am UTC](https://meta.discourse.org/t/incorrect-user-field-information-api-docs/161413/5 "2024-01-21T05:23:49Z")

</div>

I also struggled for about 24 hours solid with this as the docs example suggests `application/json` formatted requests for creating a new user be boolean for `user_field` …

I was being told I hadn’t finished all the required user fields … but in my case I have an **existing required** `user_field` I need to enter data into that field and it should be formatted like this:

```plaintext
{
  "name": "Full Name",
  "email": "email@address.com",
  "password": "348hqpwfaed",
  "username": "UserName",
  "user_fields": {
    "1": "Required User Field Data"
  }
}

```

The above formatting worked for me.

Are the docs correct in this case for creating a new user?

 ![Screenshot 2024-01-21 at 3.22.10 pm](https://global.discourse-cdn.com/meta/original/4X/4/c/5/4c5d777032526e6dce334c617834c7db3fe7023f.png)

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [December 5, 2024, 7:32pm UTC](https://meta.discourse.org/t/incorrect-user-field-information-api-docs/161413/7 "2024-12-05T19:32:34Z")

</div>

> [@JamesNorth](#):
>
> Are the docs correct in this case for creating a new user?

Nope that was still the form-data format. I updated it to use json so that the example matches the format. Thank you for bringing this up!

[https://github.com/discourse/discourse/pull/30133](https://github.com/discourse/discourse/pull/30133)
