Authenticate with a Bearer Token
ZhiFlo API uses Bearer authentication. Send the Token in the Authorization header on every request, never in the URL, request body, or application logs.
Header format
Section titled “Header format”| Item | Value |
|---|---|
| Authentication scheme | Bearer Token |
| Header name | Authorization |
| Header value | Bearer <YOUR_ZHIFLO_TOKEN> |
| Content type for POST | application/json |
The authentication section of a raw HTTP request looks like this:
Authorization: Bearer <YOUR_ZHIFLO_TOKEN>Content-Type: application/jsonThere is one space after Bearer. <YOUR_ZHIFLO_TOKEN> is a placeholder; use an environment variable or the client’s credential store for the real value.
Reference a temporary environment variable
Section titled “Reference a temporary environment variable”Bash or zsh
Section titled “Bash or zsh”Load the Token through hidden input:
read -s ZHIFLO_API_TOKENexport ZHIFLO_API_TOKENSend the request header to curl through standard input:
curl --silent --show-error \ --config - \ "https://api.zhiflo.com/v1/models" <<CURL_CONFIGheader = "Authorization: Bearer ${ZHIFLO_API_TOKEN}"CURL_CONFIGThe expanded Token stays out of the curl process arguments.
PowerShell
Section titled “PowerShell”Load the Token through a secure prompt:
$secureToken = Read-Host "Paste your ZhiFlo Token" -AsSecureString$env:ZHIFLO_API_TOKEN = [System.Net.NetworkCredential]::new("", $secureToken).PasswordThen create the header:
$headers = @{ Authorization = "Bearer $env:ZHIFLO_API_TOKEN" }Closing the terminal removes these temporary variables.
Choose the right storage location
Section titled “Choose the right storage location”- Command-line clients: use a process environment variable or the client’s own credential store.
- Desktop clients: paste the value only into API Key, API Token, or Token credential fields.
- Server applications: use the hosting platform’s secret manager instead of source code or ordinary configuration files.
Never place the Token in a URL query string. URLs can enter browser history, proxy records, and access logs.
Check these items for 401
Section titled “Check these items for 401”- The Token is complete and has no surrounding whitespace or newline.
- The header is exactly
Authorization: Bearer .... - The Token is active and has not expired or been revoked.
- The client did not place it in a different authentication field.
If exposure is possible, revoke the Token first and create a replacement with Token management. Next: Review the complete error map.