Some APIs use a custom header (like X-API-Key) instead of the standard Authorization: Bearer header. Factorly supports this with the header auth type.
# .factorly/factorly.yaml
tools:
weather.forecast:
type: rest
description: "Get weather forecast for a city"
base_url: https://api.weatherapi.com/v1
method: GET
path: /forecast.json
auth:
type: header
header: X-API-Key
value: "{{vault:WEATHER_API_KEY}}"
parameters:
- name: q
in: query
required: true
- name: days
in: queryFor comparison, bearer auth sends Authorization: Bearer <key>, while custom header auth sends X-API-Key: <key>. Use type: header when the API expects a non-standard header name.
# Store the API key
factorly vault set WEATHER_API_KEY wapi_xxxxxxxxxxxx
# Call the tool
factorly call weather.forecast --q "San Francisco" --days 3- Factorly decrypts
WEATHER_API_KEYfrom the vault. - It builds the request with the custom header:
X-API-Key: wapi_xxx... - The request goes to
https://api.weatherapi.com/v1/forecast.json?q=San+Francisco&days=3. - Your agent sees the forecast data. The API key never appears in output or logs.