Skip to main content
PUT
/
users
/
{id}
/
password
Update the password for a user
curl --request PUT \
  --url https://{tenant_id}.hanko.io/admin/users/{id}/password \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "password": "<string>"
}
'
import requests

url = "https://{tenant_id}.hanko.io/admin/users/{id}/password"

payload = { "password": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({password: '<string>'})
};

fetch('https://{tenant_id}.hanko.io/admin/users/{id}/password', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://{tenant_id}.hanko.io/admin/users/{id}/password",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'password' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://{tenant_id}.hanko.io/admin/users/{id}/password"

payload := strings.NewReader("{\n \"password\": \"<string>\"\n}")

req, _ := http.NewRequest("PUT", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.put("https://{tenant_id}.hanko.io/admin/users/{id}/password")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"password\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://{tenant_id}.hanko.io/admin/users/{id}/password")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"password\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": "28a7206b-e789-435a-b87c-108e034135c2",
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z"
}
{
"code": 400,
"message": "Bad Request"
}
{
"code": 404,
"message": "Not found"
}
{
"code": 500,
"message": "Internal Server Error"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your API key. Must only be used when using Hanko Cloud.

Path Parameters

id
string<uuid>
required

UUID of the requested object

Body

application/json
password
string

Response

OK

The password credential of a user

id
string<uuid4>

The ID of the password credential

Example:

"28a7206b-e789-435a-b87c-108e034135c2"

created_at
string<date-time>

Time of creation of the password credential

updated_at
string<date-time>

Time of last update of the password credential