{"_id":"57d9d6f03916800e003ddf61","parentDoc":null,"category":{"_id":"57d4a754899ab90e00105e5d","project":"5589ceae9883a40d00c433f3","__v":0,"version":"5589ceae9883a40d00c433f6","sync":{"url":"","isSync":false},"reference":true,"createdAt":"2016-09-11T00:37:40.706Z","from_sync":false,"order":2,"slug":"tutorials","title":"Server API"},"project":"5589ceae9883a40d00c433f3","__v":2,"githubsync":"","version":{"_id":"5589ceae9883a40d00c433f6","__v":10,"project":"5589ceae9883a40d00c433f3","createdAt":"2015-06-23T21:25:02.865Z","releaseDate":"2015-06-23T21:25:02.865Z","categories":["5589ceaf9883a40d00c433f7","559ab19d2100d117005f1269","57d4a754899ab90e00105e5d","5807813b6d24211900953b99","5819154bf62fee0f00949855","5841d27cae05ac2500ba2680","5846c4ee5d064323007b1774","589e29c72793e937001c15c5","5cf0460e272f2c0014a80d17","5cf047bde14258005d7a374e"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"user":"5542d87d795b590d001dc7ff","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-09-14T23:02:08.600Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[{"name":"","code":"{\n  \"id\": \"usr_TgTbetyiSvuiIw\",\n  \"name\": \"Jane Smith\",\n  \"username\": \"janes5\",\n  \"email\": \"jane.smith:::at:::example.com\",\n  \"verified_email\": null,\n  \"verified_phone\": \"+15552323353\",\n  \"auth_type\": \"two_factor\",\n  \"disabled\": false,\n  \"created\": 1473544359.3973701,\n  \"last_failed_login\": null,\n  \"last_login\": null\n}","language":"json","status":200},{"name":"","code":"{\n\t// Every error response contains an error property\n\t\"error\": {\n    \"type\": \"invalid_request_error\",\n    \"code\": \"invalid_username\",\n    \"param\": \"username\",\n    \"message\": \"Invalid username\"\n  },\n  \n  // But some error responses can contain multiple errors.\n  // In this case the \"errors\" property contains all of the errors.\n  \"errors\": [\n    {\n      \"type\": \"invalid_request_error\",\n      \"code\": \"invalid_username\",\n      \"param\": \"username\",\n      \"message\": \"Invalid username\"\n    },\n    {\n      \"type\": \"invalid_request_error\",\n      \"code\": \"invalid_email\",\n      \"param\": \"email\",\n      \"message\": \"Invalid email\"\n    }\n  ]\n}","language":"json","status":400}]},"settings":"","examples":{"codes":[{"language":"curl","code":"curl https://api.userkit.io/v1/users/{USER_ID} \\\n -u api:{YOUR_APP_SECRET_KEY} \\\n -H \"Content-Type: application/json\" \\\n -d '{\"name\": \"Jane Smith\", \"username\": \"jane5\"}'"},{"language":"python","code":"uk = userkit.UserKit(\"{YOUR_APP_SECRET_KEY}\")\n\nuser = uk.users.update_user(\"{USER_ID}\",\n                            name=\"Jane Smith\")"},{"language":"ruby","code":"def update_user(user_id, data)\n  \turl = 'https://api.userkit.io/v1/users/' +\n    \t\t\tuser_id\n    resource = RestClient::Resource.new(url,\n      \t'api', '{YOUR_APP_SECRET_KEY}')\n    response = resource.post(\n        data.to_json,\n        :content_type => 'application/json')\n    return JSON.parse(response.body)\nend\n\n\nuser = update_user({USER_ID}, {\n  \"name\"=>\"Jane Smith\",\n  \"username\"=>\"janes5\"\n})"},{"code":"package main\n\nimport (\n\t\"fmt\"\n\tuserkit \"github.com/workpail/userkit-go\"\n)\n\nfunc main() {\n  uk := userkit.NewUserKit(\n    \"{YOUR_APP_SECRET_KEY}\")\n  \n\tdata := map[string]string{\n    \"name\": \"Jane Smith\"}\n  \n  user, _ := uk.Users.Update(\"{USER_ID}\",\n                             data)\n\tfmt.Printf(\"%+v\", user)\n}","language":"go"},{"code":"<?php\n\n$uk = new UserKit('<YOUR_APP_SECRET_KEY>');\n\n$user = $uk->users->updateUser('<USER_ID>', ['name' => 'Jane Smith']);\n","language":"php"}]},"method":"post","auth":"required","params":[{"_id":"57d4aca7642d570e00ebd5b8","ref":"","in":"body","required":false,"desc":"The user's full name, e.g. \"Jane Smith\"","default":"","type":"string","name":"name"},{"_id":"57d4aca7642d570e00ebd5b7","ref":"","in":"body","required":false,"desc":"A username","default":"","type":"string","name":"username"},{"_id":"57d4aca7642d570e00ebd5b6","ref":"","in":"body","required":false,"desc":"An email address","default":"","type":"string","name":"email"},{"_id":"57d4aca7642d570e00ebd5b5","ref":"","in":"body","required":false,"desc":"The user's password","default":"","type":"string","name":"password"},{"_id":"57d4aca7642d570e00ebd5b4","ref":"","in":"body","required":false,"desc":"Can be one of \"password\", \"two_factor\", or \"one_time_password\"","default":"","type":"string","name":"auth_type"},{"_id":"57d4aca7642d570e00ebd5b3","ref":"","in":"body","required":false,"desc":"A phone number","default":"","type":"string","name":"phone"},{"_id":"57d4aca7642d570e00ebd5b2","ref":"","in":"body","required":false,"desc":"A token proving that the user owns the phone number","default":"","type":"string","name":"verified_phone_token"},{"_id":"57d9da2d5a2c4e0e00c306ee","ref":"","in":"path","required":false,"desc":"The ID of the user to update","default":"","type":"string","name":"user_id"}],"url":"/v1/users/:user_id"},"isReference":true,"order":2,"body":"","excerpt":"Your users can manage their own settings in the widget, but you can also update users with the API","slug":"update-a-user","type":"endpoint","title":"Update a user"}

postUpdate a user

Your users can manage their own settings in the widget, but you can also update users with the API

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Path Params

user_id:
string
The ID of the user to update

Body Params

name:
string
The user's full name, e.g. "Jane Smith"
username:
string
A username
email:
string
An email address
password:
string
The user's password
auth_type:
string
Can be one of "password", "two_factor", or "one_time_password"
phone:
string
A phone number
verified_phone_token:
string
A token proving that the user owns the phone number

Examples


Result Format


User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}