# How to update profile information via API

**URL:** https://meta.discourse.org/t/how-to-update-profile-information-via-api/29001
**Category:** Development
**Tags:** rest-api
**Created:** [May 19, 2015, 6:51pm UTC](https://meta.discourse.org/t/how-to-update-profile-information-via-api/29001 "2015-05-19T18:51:00Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![kennym](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kennym/32/115557_2.png) [@kennym](https://meta.discourse.org/u/kennym)
#### Post date: [May 19, 2015, 6:51pm UTC](https://meta.discourse.org/t/how-to-update-profile-information-via-api/29001/1 "2015-05-19T18:51:00Z")

</div>

I would like to sync profile information like the bio, and website URL from my website to the discourse user forum. Users are currently all logging in via an SSO endpoint on the main website. Is there any way to update the discourse user profile via an API call?

I have tried doing something like this, unsuccessfully:

```
require 'single_sign_on'
class DiscourseSsoController < ApplicationController
  before_filter :authenticate_user! # ensures user must login

  def sso
    secret = ENV["DISCUSSIONS_SSO_KEY"]
    sso = SingleSignOn.parse(request.query_string, secret)
    sso.email = current_user.email # from devise
    sso.name = current_user.name # this is a custom method on the User class
    sso.username = current_user.name # from devise
    sso.external_id = current_user.id # from devise
    sso.sso_secret = secret
    sso.avatar_url = current_user.image_url
    sso.bio = current_user.bio
    sso.custom_fields["profile_url"] = SOME_URL

    redirect_to sso.to_url(ENV["DISCUSSIONS_SSO_LOGIN_PATH"])
  end
end

```

---

<div class="post-metadata">

### Author: ![kennym](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kennym/32/115557_2.png) [@kennym](https://meta.discourse.org/u/kennym)
#### Post date: [May 20, 2015, 1:54am UTC](https://meta.discourse.org/t/how-to-update-profile-information-via-api/29001/2 "2015-05-20T01:54:11Z")

</div>

No help? I wonder if my question is clear enough…

---

<div class="post-metadata">

### Author: ![OnceWas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/oncewas/32/40734_2.png) [@OnceWas](https://meta.discourse.org/u/OnceWas)
#### Post date: [September 4, 2015, 8:38pm UTC](https://meta.discourse.org/t/how-to-update-profile-information-via-api/29001/3 "2015-09-04T20:38:18Z")

</div>

Using the API:

```
curl -X PUT -d 'name=BOB TEST' http://your.discourse.instance/users/<DISCOURSE_USERNAME>.json?api_key=<API_KEY>&api_username=<API_USER>

```

Take a look [at the Discourse API](https://meta.discourse.org/t/discourse-api-documentation/22706).

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [May 4, 2024, 8:04am UTC](https://meta.discourse.org/t/how-to-update-profile-information-via-api/29001/4 "2024-05-04T08:04:30Z")

</div>


