Environment Variables
Complete reference for all environment variables used by the SDK.
Scan API
| Variable | Required | Default | Description |
|---|---|---|---|
PANW_AI_SEC_API_KEY | One of key/token | — | API key for HMAC-SHA256 auth |
PANW_AI_SEC_API_TOKEN | One of key/token | — | Pre-obtained bearer token |
PANW_AI_SEC_API_ENDPOINT | No | https://service.api.aisecurity.paloaltonetworks.com | Scan API base URL |
Management API
| Variable | Required | Default | Description |
|---|---|---|---|
PANW_MGMT_CLIENT_ID | Yes | — | OAuth2 client ID |
PANW_MGMT_CLIENT_SECRET | Yes | — | OAuth2 client secret |
PANW_MGMT_TSG_ID | Yes | — | Tenant Service Group ID |
PANW_MGMT_ENDPOINT | No | https://api.apps.paloaltonetworks.com/aisec | Management API base URL |
PANW_MGMT_TOKEN_ENDPOINT | No | https://auth.apps.paloaltonetworks.com/oauth2/access_token | OAuth2 token endpoint |
client.dlp does not have a separate environment variable for its endpoint. It reuses PANW_MGMT_* OAuth credentials and accepts a constructor-only dlpEndpoint override on ManagementClient.
Model Security API
All fall back to the corresponding PANW_MGMT_* variable if not set.
| Variable | Fallback | Default | Description |
|---|---|---|---|
PANW_MODEL_SEC_CLIENT_ID | PANW_MGMT_CLIENT_ID | — | OAuth2 client ID |
PANW_MODEL_SEC_CLIENT_SECRET | PANW_MGMT_CLIENT_SECRET | — | OAuth2 client secret |
PANW_MODEL_SEC_TSG_ID | PANW_MGMT_TSG_ID | — | Tenant Service Group ID |
PANW_MODEL_SEC_DATA_ENDPOINT | — | https://api.apps.paloaltonetworks.com/aims/data | Data plane base URL |
PANW_MODEL_SEC_MGMT_ENDPOINT | — | https://api.apps.paloaltonetworks.com/aims/mgmt | Management plane base URL |
PANW_MODEL_SEC_TOKEN_ENDPOINT | PANW_MGMT_TOKEN_ENDPOINT | https://auth.apps.paloaltonetworks.com/oauth2/access_token | OAuth2 token endpoint |
Red Team API
All fall back to the corresponding PANW_MGMT_* variable if not set.
| Variable | Fallback | Default | Description |
|---|---|---|---|
PANW_RED_TEAM_CLIENT_ID | PANW_MGMT_CLIENT_ID | — | OAuth2 client ID |
PANW_RED_TEAM_CLIENT_SECRET | PANW_MGMT_CLIENT_SECRET | — | OAuth2 client secret |
PANW_RED_TEAM_TSG_ID | PANW_MGMT_TSG_ID | — | Tenant Service Group ID |
PANW_RED_TEAM_DATA_ENDPOINT | — | https://api.apps.paloaltonetworks.com/ai-red-teaming/data-plane | Data plane base URL |
PANW_RED_TEAM_MGMT_ENDPOINT | — | https://api.apps.paloaltonetworks.com/ai-red-teaming/mgmt-plane | Management plane base URL |
PANW_RED_TEAM_NETWORK_BROKER_ENDPOINT | — | https://api.apps.paloaltonetworks.com/ai-red-teaming/data-plane/network-broker | Network broker base URL |
PANW_RED_TEAM_TOKEN_ENDPOINT | PANW_MGMT_TOKEN_ENDPOINT | https://auth.apps.paloaltonetworks.com/oauth2/access_token | OAuth2 token endpoint |
AI Gateway API
All fall back to the corresponding PANW_MGMT_* variable if not set.
| Variable | Fallback | Default | Description |
|---|---|---|---|
PANW_AI_GW_CLIENT_ID | PANW_MGMT_CLIENT_ID | — | OAuth2 client ID |
PANW_AI_GW_CLIENT_SECRET | PANW_MGMT_CLIENT_SECRET | — | OAuth2 client secret |
PANW_AI_GW_TSG_ID | PANW_MGMT_TSG_ID | — | Tenant Service Group ID; also sent as the x-tsg-id header on every request |
PANW_AI_GW_DATA_ENDPOINT | — | https://api.apps.paloaltonetworks.com/ai_gw/v2 | Data plane base URL |
PANW_AI_GW_ADMIN_ENDPOINT | — | https://api.apps.paloaltonetworks.com/ai_gw/admin/v2 | Admin plane base URL |
PANW_AI_GW_TOKEN_ENDPOINT | PANW_MGMT_TOKEN_ENDPOINT | https://auth.apps.paloaltonetworks.com/oauth2/access_token | OAuth2 token endpoint |
Runtime inference is separate from those SCM settings:
| Variable | Required | Default | Purpose |
|---|---|---|---|
PANW_AI_GW_INFERENCE_ENDPOINT | Yes, unless passed to the constructor | None | Deployed runtime base URL including /v1 |
PANW_AI_GW_INFERENCE_API_KEY | Yes, unless passed to the constructor | None | Gateway runtime key; never management OAuth |
The SDK does not default a provider or model. The companion CLI additionally recognizes
PANW_AI_GW_INFERENCE_MODEL and PANW_AI_GW_EMBEDDING_MODEL as defaults for its inference
commands. Runtime inference guide.
Debugging
PANW_AI_SEC_TIMEOUT_MS sets the shared per-attempt deadline in milliseconds (default 60000;
must be a positive integer). Scanner per-call timeoutMs overrides it. OAuth token acquisition
also has its own fixed 30-second deadline across token headers and JSON-body reads. This token
deadline is not changed by PANW_AI_SEC_TIMEOUT_MS or tokenBufferMs (the latter controls
pre-expiry refresh timing). A caller's shorter service-request deadline stops that caller's wait
without cancelling a shared refresh for other callers.
| Variable | Required | Default | Description |
|---|---|---|---|
PANW_AI_SEC_DEBUG | No | — | Set to 1/true/yes/on to log every API call to stderr. |
PANW_AI_SEC_DEBUG_BODY | No | Off | Separately opt into redacted request/response bodies; requires debug enabled. Secret operations still omit bodies. |
When enabled, the SDK logs each HTTP request (method, sanitized URL, headers) and response (status and duration) to stderr for every domain — scan, management, model security, red teaming, and AI Gateway. It logs once per attempt, so retries and 401-driven token refreshes are visible.
Access-token header values (Authorization, x-pan-token) are replaced with a non-reversible
sha256:<prefix> hash, so you can still tell when a token rotates. Cookies, credential query
parameters, URL user information, and recognized secret fields are redacted. The raw token is
never written. Logs can still contain resource identifiers or customer content when body logging
is explicitly enabled; inspect them before sharing. Body logging is off by default.
[airs-sdk] → GET https://api.apps.paloaltonetworks.com/ai-red-teaming/mgmt-plane/v1/custom-attack/list-custom-prompt-sets?limit=1
[airs-sdk] headers {"User-Agent":"PAN-AIRS/0.20.1-typescript-sdk","service-name":"api","Authorization":"sha256:6ba877dddebe"}
[airs-sdk] ← 200 (1397ms)
Enable it inline for a single run:
PANW_AI_SEC_DEBUG=1 npx tsx your-script.ts
With
PANW_AI_SEC_DEBUG_BODY=1, unknown body fields may still contain customer content despite credential redaction. Keep body logging off in production and review captured output before sharing.
Example Scripts
The following variables are not consumed by the SDK itself. They are used only by the example scripts in docs-site/examples/.
| Variable | Used By | Description |
|---|---|---|
PANW_AI_SEC_PROFILE_NAME | basic-scan.ts, async-scan.ts | Security profile name passed to scan requests (e.g. AI Gateway - Strict) |
SCAN_IDS | query-results.ts | Comma-separated scan IDs to look up (from a previous sync/async scan) |
REPORT_IDS | query-results.ts | Comma-separated report IDs to look up (R + scan ID for sync scans) |