api-key-header.http
@baseUrl = https://api.example.com
@apiKey = replace-with-api-key
### Send an API key in a custom header
GET {{baseUrl}}/reports/daily
Accept: application/json
X-API-Key: {{apiKey}}
Variables to replace
- baseUrl
- The service origin.
- apiKey
- The provider-issued key. Rename the header if its documentation uses another name.
Expected response
A valid key commonly returns 200 OK. A missing, revoked, or malformed key generally returns 401 Unauthorized or 403 Forbidden.
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