Set user password.
curl --request POST \
--url https://{tenant}/api/users/{userId}/actions/reset \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"api_model": {},
"current_password": "minimum6charactersPassword",
"new_password": "newMinimum6CharactersPassword"
}
'import requests
url = "https://{tenant}/api/users/{userId}/actions/reset"
payload = {
"api_model": {},
"current_password": "minimum6charactersPassword",
"new_password": "newMinimum6CharactersPassword"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
api_model: {},
current_password: 'minimum6charactersPassword',
new_password: 'newMinimum6CharactersPassword'
})
};
fetch('https://{tenant}/api/users/{userId}/actions/reset', 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}/api/users/{userId}/actions/reset",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'api_model' => [
],
'current_password' => 'minimum6charactersPassword',
'new_password' => 'newMinimum6CharactersPassword'
]),
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}/api/users/{userId}/actions/reset"
payload := strings.NewReader("{\n \"api_model\": {},\n \"current_password\": \"minimum6charactersPassword\",\n \"new_password\": \"newMinimum6CharactersPassword\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://{tenant}/api/users/{userId}/actions/reset")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"api_model\": {},\n \"current_password\": \"minimum6charactersPassword\",\n \"new_password\": \"newMinimum6CharactersPassword\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}/api/users/{userId}/actions/reset")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"api_model\": {},\n \"current_password\": \"minimum6charactersPassword\",\n \"new_password\": \"newMinimum6CharactersPassword\"\n}"
response = http.request(request)
puts response.read_body{
"Message": "User password updated",
"Meta": null,
"Status": "OK"
}{
"Message": "Not authorised",
"Meta": null,
"Status": "Error"
}{
"Message": "Request body malformed.",
"Meta": null,
"Status": "Error"
}{
"Message": "Attempted unauthorised access.",
"Meta": null,
"Status": "Error"
}Users
Set user password.
Set a user’s password. The password need to be 6 character long. If you are trying to update another users password you also need to have permission to update they password or you need to be a super-admin. You cannot also reuse a password.
POST
/
api
/
users
/
{userId}
/
actions
/
reset
Set user password.
curl --request POST \
--url https://{tenant}/api/users/{userId}/actions/reset \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"api_model": {},
"current_password": "minimum6charactersPassword",
"new_password": "newMinimum6CharactersPassword"
}
'import requests
url = "https://{tenant}/api/users/{userId}/actions/reset"
payload = {
"api_model": {},
"current_password": "minimum6charactersPassword",
"new_password": "newMinimum6CharactersPassword"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
api_model: {},
current_password: 'minimum6charactersPassword',
new_password: 'newMinimum6CharactersPassword'
})
};
fetch('https://{tenant}/api/users/{userId}/actions/reset', 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}/api/users/{userId}/actions/reset",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'api_model' => [
],
'current_password' => 'minimum6charactersPassword',
'new_password' => 'newMinimum6CharactersPassword'
]),
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}/api/users/{userId}/actions/reset"
payload := strings.NewReader("{\n \"api_model\": {},\n \"current_password\": \"minimum6charactersPassword\",\n \"new_password\": \"newMinimum6CharactersPassword\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://{tenant}/api/users/{userId}/actions/reset")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"api_model\": {},\n \"current_password\": \"minimum6charactersPassword\",\n \"new_password\": \"newMinimum6CharactersPassword\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}/api/users/{userId}/actions/reset")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"api_model\": {},\n \"current_password\": \"minimum6charactersPassword\",\n \"new_password\": \"newMinimum6CharactersPassword\"\n}"
response = http.request(request)
puts response.read_body{
"Message": "User password updated",
"Meta": null,
"Status": "OK"
}{
"Message": "Not authorised",
"Meta": null,
"Status": "Error"
}{
"Message": "Request body malformed.",
"Meta": null,
"Status": "Error"
}{
"Message": "Attempted unauthorised access.",
"Meta": null,
"Status": "Error"
}Authorizations
The Tyk Dashboard API Access Credentials
Path Parameters
User ID of the user whose password is being reset.
Body
application/json
Was this page helpful?
⌘I