# How to add more custom fields to response of okta API

**URL:** <https://devforum.okta.com/t/how-to-add-more-custom-fields-to-response-of-okta-api/14284>\
**Category:** Questions\
**Created:** [May 18, 2021, 10:54am UTC](https://devforum.okta.com/t/how-to-add-more-custom-fields-to-response-of-okta-api/14284 "2021-05-18T10:54:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![amadhu](https://avatars.discourse-cdn.com/v4/letter/a/b5a626/32.png) [@amadhu](https://devforum.okta.com/u/amadhu)\
**Post date:** [May 18, 2021, 10:54am UTC](https://devforum.okta.com/t/how-to-add-more-custom-fields-to-response-of-okta-api/14284/1 "2021-05-18T10:54:49Z")

</div>

I am using okta o login and here is the api end point I am calling.

[https://xxxxxx.okta.com/api/v1/authn](https://xxxxxx.okta.com/api/v1/authn)

On the Body

```auto
    {
      "username": "xxxxx.merchops.user@gmail.com",
      "password": "Y8m78wZ4",
      "options": {
        "multiOptionalFactorEnroll": true,
        "warnBeforePasswordExpired": true
      }  
    }

I am getting this response.

{
    "stateToken": "00Son-f5Lqr7DxW7cssyVXpLvrqk8Nk8EUPtNP8jpF3m",
    "expiresAt": "2021-05-18T07:21:21.000Z",
    "status": "PASSWORD_EXPIRED",
    "_embedded": {
        "user": {
            "id": "xxurml4yuzhZe5h2A5d6",
            "passwordChanged": "2021-05-18T06:01:57.000Z",
            "profile": {
                "login": "xxxxx.merchops.user@gmail.com",
                "firstName": "chewy",
                "lastName": "Merchops",
                "locale": "en",
                "timeZone": "America/Los_Angeles"
            }
        },
        "policy": {
            "complexity": {
                "minLength": 8,
                "minLowerCase": 1,
                "minUpperCase": 1,
                "minNumber": 1,
                "minSymbol": 0,
                "excludeUsername": true
            },
            "age": {
                "minAgeMinutes": 0,
                "historyCount": 4
            }
        }
    },
    "_links": {
        "next": {
            "name": "changePassword",
            "href": "https://xxxxxxx.okta.com/api/v1/authn/credentials/change_password",
            "hints": {
                "allow": [
                    "POST"
                ]
            }
        },
        "cancel": {
            "href": "https://xxxxxxxx.okta.com/api/v1/authn/cancel",
            "hints": {
                "allow": [
                    "POST"
                ]
            }
        }
    }
}

```

If I want to add phone number also to the response json what I have to do?

I am expecting something like this. Note that the phone number field on the response json which I am expecting from okta api.

```auto
        "profile": {
            "login": "xxxxx.merchops.user@gmail.com",
            "firstName": "chewy",
            "lastName": "Merchops",
            "locale": "en",
            "timeZone": "America/Los_Angeles"
            "Ph":"814744444xx"
        }

```

How can I do that?

---

<div class="post-metadata">

**Author:** ![Lijia](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/lijia/32/2295_2.png) [@Lijia](https://devforum.okta.com/u/Lijia)\
**Post date:** [May 18, 2021, 6:30pm UTC](https://devforum.okta.com/t/how-to-add-more-custom-fields-to-response-of-okta-api/14284/2 "2021-05-18T18:30:11Z")

</div>

@amadhu Hi, are you trying to add a phone number for the user?  
Did you try to add it via profile editor?  
Alternatively, you can try PUT method with your attribute. Please see the below API doc.  
[https://developer.okta.com/docs/reference/api/users/#update-user](https://developer.okta.com/docs/reference/api/users/#update-user)

---

<div class="post-metadata">

**Author:** ![amadhu](https://avatars.discourse-cdn.com/v4/letter/a/b5a626/32.png) [@amadhu](https://devforum.okta.com/u/amadhu)\
**Post date:** [May 19, 2021, 3:18am UTC](https://devforum.okta.com/t/how-to-add-more-custom-fields-to-response-of-okta-api/14284/3 "2021-05-19T03:18:23Z")

</div>

I have added etc columns using profile editor but those columns are not coming on result json object.

---

<div class="post-metadata">

**Author:** ![Lijia](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/lijia/32/2295_2.png) [@Lijia](https://devforum.okta.com/u/Lijia)\
**Post date:** [May 20, 2021, 4:57pm UTC](https://devforum.okta.com/t/how-to-add-more-custom-fields-to-response-of-okta-api/14284/4 "2021-05-20T16:57:55Z")

</div>

@amadhu You can do a request to `/api/v1/users/:userId` The response will contain phone info in profile.

 ![image](https://global.discourse-cdn.com/oktadev/original/2X/7/792096e07a6b481af6de95cf8a780e8e54c2b1fb.png)

---

<div class="post-metadata">

**Author:** ![amadhu](https://avatars.discourse-cdn.com/v4/letter/a/b5a626/32.png) [@amadhu](https://devforum.okta.com/u/amadhu)\
**Post date:** [May 21, 2021, 3:58am UTC](https://devforum.okta.com/t/how-to-add-more-custom-fields-to-response-of-okta-api/14284/5 "2021-05-21T03:58:18Z")

</div>

What could be the request json Which i have to put on body?

---

<div class="post-metadata">

**Author:** ![Lijia](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/lijia/32/2295_2.png) [@Lijia](https://devforum.okta.com/u/Lijia)\
**Post date:** [May 21, 2021, 5:03am UTC](https://devforum.okta.com/t/how-to-add-more-custom-fields-to-response-of-okta-api/14284/6 "2021-05-21T05:03:47Z")

</div>

@amadhu You can do a second call with GET user. The api sample is in the below link.  
[https://developer.okta.com/docs/reference/api/users/#get-user-with-id](https://developer.okta.com/docs/reference/api/users/#get-user-with-id)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [February 8, 2024, 6:14pm UTC](https://devforum.okta.com/t/how-to-add-more-custom-fields-to-response-of-okta-api/14284/7 "2024-02-08T18:14:17Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
