Change Password
Endpoint
To resend the email verification link to the user, make a POST
request to the following endpoint:
https://api.betatel.com/api/auth/change-password
Request Headers
The request must include an Authorization header with a valid JWT token for authentication:
Header | Value | Required | Description |
---|---|---|---|
Authorization | {{access_token}} | Yes | The authentication token to verify the user's identity |
Request Body
Your request should contain the password for the user:
{
"password": "NewPassword123456!"
}
Param | Value | Type | Required | Description |
---|---|---|---|---|
password | NewPassword123456! | String | Yes | The user's new password |
Let’s Dive Into the Code!
Choose your preferred programming language and use the provided examples to integrate the login
- cUrl
- Python
- Node.js
- PHP
- Java
- C#
Example - cURL
curl --location 'https://api.betatel.com/api/auth/change-password' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3ZWE2MjJiMDU1MjkzNWZhYzVjZDFhZCIsImVtYWlsIjoicG92aWQ2ODFAbm9rZG90LmNvbSIsInJvbGUiOiJ1c2VyIiwiaWF0IjoxNzQzNDI4Mjk3LCJleHAiOjE3NDM0MzE4OTd9.dS4w_GEw4jVoMm5pvv6uoYnC9TYGO3rAbUeRMxK1iow' \
--header 'Content-Type: application/json' \
--data '{
"password": "NewPassword123456!"
}'
Example - Python
import http.client
import json
conn = http.client.HTTPSConnection("api.betatel.com")
payload = json.dumps({
"password": "NewPassword123456!"
})
headers = {
'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3ZWE2MjJiMDU1MjkzNWZhYzVjZDFhZCIsImVtYWlsIjoicG92aWQ2ODFAbm9rZG90LmNvbSIsInJvbGUiOiJ1c2VyIiwiaWF0IjoxNzQzNDI4Mjk3LCJleHAiOjE3NDM0MzE4OTd9.dS4w_GEw4jVoMm5pvv6uoYnC9TYGO3rAbUeRMxK1iow',
'Content-Type': 'application/json'
}
conn.request("POST", "/api/auth/change-password", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Example - Node.js
const axios = require('axios');
let data = JSON.stringify({
"password": "NewPassword123456!"
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api.betatel.com/api/auth/change-password',
headers: {
'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3ZWE2MjJiMDU1MjkzNWZhYzVjZDFhZCIsImVtYWlsIjoicG92aWQ2ODFAbm9rZG90LmNvbSIsInJvbGUiOiJ1c2VyIiwiaWF0IjoxNzQzNDI4Mjk3LCJleHAiOjE3NDM0MzE4OTd9.dS4w_GEw4jVoMm5pvv6uoYnC9TYGO3rAbUeRMxK1iow',
'Content-Type': 'application/json'
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
Example - PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.betatel.com/api/auth/change-password',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"password": "NewPassword123456!"
}',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3ZWE2MjJiMDU1MjkzNWZhYzVjZDFhZCIsImVtYWlsIjoicG92aWQ2ODFAbm9rZG90LmNvbSIsInJvbGUiOiJ1c2VyIiwiaWF0IjoxNzQzNDI4Mjk3LCJleHAiOjE3NDM0MzE4OTd9.dS4w_GEw4jVoMm5pvv6uoYnC9TYGO3rAbUeRMxK1iow',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Example - Java
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://api.betatel.com/api/auth/change-password")
.header("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3ZWE2MjJiMDU1MjkzNWZhYzVjZDFhZCIsImVtYWlsIjoicG92aWQ2ODFAbm9rZG90LmNvbSIsInJvbGUiOiJ1c2VyIiwiaWF0IjoxNzQzNDI4Mjk3LCJleHAiOjE3NDM0MzE4OTd9.dS4w_GEw4jVoMm5pvv6uoYnC9TYGO3rAbUeRMxK1iow")
.header("Content-Type", "application/json")
.body("{\n \"password\": \"NewPassword123456!\"\n}")
.asString();
Example - C#
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.betatel.com/api/auth/change-password");
request.Headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3ZWE2MjJiMDU1MjkzNWZhYzVjZDFhZCIsImVtYWlsIjoicG92aWQ2ODFAbm9rZG90LmNvbSIsInJvbGUiOiJ1c2VyIiwiaWF0IjoxNzQzNDI4Mjk3LCJleHAiOjE3NDM0MzE4OTd9.dS4w_GEw4jVoMm5pvv6uoYnC9TYGO3rAbUeRMxK1iow");
var content = new StringContent("{\n \"password\": \"NewPassword123456!\"\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
Response
JSON Schema:
{
"message": "Password changed successfully"
}
🎉 Success – The Password Has Been Changed!
🔜 What’s Next? The user's password has now been successfully updated. You can proceed with other user management functionalities such as updating the user profile, handling login sessions with the new password, or securing the account with additional security measures like multi-factor authentication.