To send a bearer token in an HTTP header, you’ll need to include it in the Authorization header with the format Bearer <token>.
JavaScript (using fetch):
fetch("https://api.example.com/data", {
  method: "GET",
  headers: {
    "Authorization": "Bearer YOUR_TOKEN_HERE"
  }
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error("Error:", error));
Python (using requests library):
import requests
headers = {
    "Authorization": "Bearer YOUR_TOKEN_HERE"
}
response = requests.get("https://api.example.com/data", headers=headers)
print(response.json())
PHP (using curl):
$ch = curl_init("https://api.example.com/data");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Authorization: Bearer YOUR_TOKEN_HERE"
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
- Replace "YOUR_TOKEN_HERE" with your actual token.
 
- In all the above examples, the Authorization header is set to Bearer followed by the token.