basic-auth.http
@baseUrl = https://api.example.com
@username = demo-user
@password = replace-with-password
### Read an account protected by Basic auth
GET {{baseUrl}}/account
Accept: application/json
Authorization: Basic {{username}}:{{password}}
Variables to replace
- baseUrl
- The API origin.
- username
- The Basic-auth user name.
- password
- A placeholder password; move the real value to a git-ignored .env file.
Expected response
Matching credentials commonly return 200 OK. Missing or rejected credentials normally return 401 Unauthorized with a WWW-Authenticate response header.
Related examples and guides
Learn the full syntax in the .http file format guide, manage secrets with variables and environments, or see how to run .http files on Windows.
Launch Summer Sale
Run this request without leaving Windows.
Karve opens .http files as a native workspace: edit the plain text, press Run, inspect the response, and keep the file in Git.
15-day free trial · No account · No subscription · No metered requests
25% off until Sep 1