Skip to main content

Environment Variables

Complete reference for all environment variables used by the SDK.

Scan API​

VariableRequiredDefaultDescription
PANW_AI_SEC_API_KEYOne of key/token—API key for HMAC-SHA256 auth
PANW_AI_SEC_API_TOKENOne of key/token—Pre-obtained bearer token
PANW_AI_SEC_API_ENDPOINTNohttps://service.api.aisecurity.paloaltonetworks.comScan API base URL

Management API​

VariableRequiredDefaultDescription
PANW_MGMT_CLIENT_IDYes—OAuth2 client ID
PANW_MGMT_CLIENT_SECRETYes—OAuth2 client secret
PANW_MGMT_TSG_IDYes—Tenant Service Group ID
PANW_MGMT_ENDPOINTNohttps://api.apps.paloaltonetworks.com/aisecManagement API base URL
PANW_MGMT_TOKEN_ENDPOINTNohttps://auth.apps.paloaltonetworks.com/oauth2/access_tokenOAuth2 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.

VariableFallbackDefaultDescription
PANW_MODEL_SEC_CLIENT_IDPANW_MGMT_CLIENT_ID—OAuth2 client ID
PANW_MODEL_SEC_CLIENT_SECRETPANW_MGMT_CLIENT_SECRET—OAuth2 client secret
PANW_MODEL_SEC_TSG_IDPANW_MGMT_TSG_ID—Tenant Service Group ID
PANW_MODEL_SEC_DATA_ENDPOINT—https://api.apps.paloaltonetworks.com/aims/dataData plane base URL
PANW_MODEL_SEC_MGMT_ENDPOINT—https://api.apps.paloaltonetworks.com/aims/mgmtManagement plane base URL
PANW_MODEL_SEC_TOKEN_ENDPOINTPANW_MGMT_TOKEN_ENDPOINThttps://auth.apps.paloaltonetworks.com/oauth2/access_tokenOAuth2 token endpoint

Red Team API​

All fall back to the corresponding PANW_MGMT_* variable if not set.

VariableFallbackDefaultDescription
PANW_RED_TEAM_CLIENT_IDPANW_MGMT_CLIENT_ID—OAuth2 client ID
PANW_RED_TEAM_CLIENT_SECRETPANW_MGMT_CLIENT_SECRET—OAuth2 client secret
PANW_RED_TEAM_TSG_IDPANW_MGMT_TSG_ID—Tenant Service Group ID
PANW_RED_TEAM_DATA_ENDPOINT—https://api.apps.paloaltonetworks.com/ai-red-teaming/data-planeData plane base URL
PANW_RED_TEAM_MGMT_ENDPOINT—https://api.apps.paloaltonetworks.com/ai-red-teaming/mgmt-planeManagement plane base URL
PANW_RED_TEAM_NETWORK_BROKER_ENDPOINT—https://api.apps.paloaltonetworks.com/ai-red-teaming/data-plane/network-brokerNetwork broker base URL
PANW_RED_TEAM_TOKEN_ENDPOINTPANW_MGMT_TOKEN_ENDPOINThttps://auth.apps.paloaltonetworks.com/oauth2/access_tokenOAuth2 token endpoint

AI Gateway API​

All fall back to the corresponding PANW_MGMT_* variable if not set.

VariableFallbackDefaultDescription
PANW_AI_GW_CLIENT_IDPANW_MGMT_CLIENT_ID—OAuth2 client ID
PANW_AI_GW_CLIENT_SECRETPANW_MGMT_CLIENT_SECRET—OAuth2 client secret
PANW_AI_GW_TSG_IDPANW_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/v2Data plane base URL
PANW_AI_GW_ADMIN_ENDPOINT—https://api.apps.paloaltonetworks.com/ai_gw/admin/v2Admin plane base URL
PANW_AI_GW_TOKEN_ENDPOINTPANW_MGMT_TOKEN_ENDPOINThttps://auth.apps.paloaltonetworks.com/oauth2/access_tokenOAuth2 token endpoint

Runtime inference is separate from those SCM settings:

VariableRequiredDefaultPurpose
PANW_AI_GW_INFERENCE_ENDPOINTYes, unless passed to the constructorNoneDeployed runtime base URL including /v1
PANW_AI_GW_INFERENCE_API_KEYYes, unless passed to the constructorNoneGateway 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.

VariableRequiredDefaultDescription
PANW_AI_SEC_DEBUGNo—Set to 1/true/yes/on to log every API call to stderr.
PANW_AI_SEC_DEBUG_BODYNoOffSeparately 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/.

VariableUsed ByDescription
PANW_AI_SEC_PROFILE_NAMEbasic-scan.ts, async-scan.tsSecurity profile name passed to scan requests (e.g. AI Gateway - Strict)
SCAN_IDSquery-results.tsComma-separated scan IDs to look up (from a previous sync/async scan)
REPORT_IDSquery-results.tsComma-separated report IDs to look up (R + scan ID for sync scans)