Change Password
curl --request PUT \
--url https://api.bunship.com/api/v1/users/me/password \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"currentPassword": "<string>",
"newPassword": "<string>"
}
'import requests
url = "https://api.bunship.com/api/v1/users/me/password"
payload = {
"currentPassword": "<string>",
"newPassword": "<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({currentPassword: '<string>', newPassword: '<string>'})
};
fetch('https://api.bunship.com/api/v1/users/me/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://api.bunship.com/api/v1/users/me/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([
'currentPassword' => '<string>',
'newPassword' => '<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://api.bunship.com/api/v1/users/me/password"
payload := strings.NewReader("{\n \"currentPassword\": \"<string>\",\n \"newPassword\": \"<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://api.bunship.com/api/v1/users/me/password")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"currentPassword\": \"<string>\",\n \"newPassword\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bunship.com/api/v1/users/me/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 \"currentPassword\": \"<string>\",\n \"newPassword\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "Password changed successfully"
}
Users
Change Password
Change the authenticated user’s password
PUT
/
api
/
v1
/
users
/
me
/
password
Change Password
curl --request PUT \
--url https://api.bunship.com/api/v1/users/me/password \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"currentPassword": "<string>",
"newPassword": "<string>"
}
'import requests
url = "https://api.bunship.com/api/v1/users/me/password"
payload = {
"currentPassword": "<string>",
"newPassword": "<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({currentPassword: '<string>', newPassword: '<string>'})
};
fetch('https://api.bunship.com/api/v1/users/me/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://api.bunship.com/api/v1/users/me/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([
'currentPassword' => '<string>',
'newPassword' => '<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://api.bunship.com/api/v1/users/me/password"
payload := strings.NewReader("{\n \"currentPassword\": \"<string>\",\n \"newPassword\": \"<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://api.bunship.com/api/v1/users/me/password")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"currentPassword\": \"<string>\",\n \"newPassword\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bunship.com/api/v1/users/me/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 \"currentPassword\": \"<string>\",\n \"newPassword\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "Password changed successfully"
}
Changes the user’s password. Requires the current password for verification. After a successful change, all other sessions are invalidated — only the current session remains active.
Auth
Requires a valid Bearer token.
Request Body
The user’s current password. Minimum 8 characters.
The new password. Minimum 8 characters, maximum 128 characters. Must be different from the current
password.
Response
Confirmation message.
{
"message": "Password changed successfully"
}
Errors
| Status | Code | Description |
|---|---|---|
400 | VALIDATION_ERROR | New password does not meet requirements or matches the current password |
401 | AUTHENTICATION_ERROR | Current password is incorrect |
Example
curl -X PUT https://api.bunship.com/api/v1/users/me/password \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
-H "Content-Type: application/json" \
-d '{
"currentPassword": "OldP@ssw0rd",
"newPassword": "NewSecureP@ssw0rd"
}'
⌘I

