core.http_request, core.http_poll, and
core.http_paginate actions.
Authentication
API keys
Store API keys and static tokens as Secrets, then add the secret toheaders.
Pass a secret as a bearer token:
OAuth
Connect an OAuth integration, then pass its managed access token as a bearer token. OAuth expressions use the provider’s exact ID, not its display name.- Built-in providers use stable lowercase IDs assigned by Tracecat, with
underscores between words, such as
slack,google_drive, andmicrosoft_sentinel. - Custom providers use an ID derived from the provider name, or from the
requested ID when you create one through the API. Tracecat slugifies it with
underscores and prepends
custom_.My Security APIbecomescustom_my_security_api. If that ID is already used for the same grant type, Tracecat appends_1,_2, and so on.
_oauth to the exact provider ID for the secret name. For the key,
uppercase the complete provider ID, preserve its underscores and any numeric
suffix, then append _USER_TOKEN for authorization_code or _SERVICE_TOKEN
for client_credentials.
google_drive authorization-code provider and a custom
custom_my_security_api client-credentials provider resolve as:
Tracecat refreshes expiring authorization-code tokens when the provider
issued a refresh token, and reacquires client-credentials tokens with the
stored client credentials. The expression resolves only to the current
access-token string, which may be a JWT or an opaque token, not the refresh
token.
core.http_request
Perform a HTTP request to a given URL.
Secrets
Optional secrets:mtls: required valuesTLS_CERTIFICATE,TLS_PRIVATE_KEY.ca_cert: required valuesCA_CERTIFICATE.
Inputs
string
required
HTTP request methodAllowed values:
GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS.string
required
The destination of the HTTP request
map[string, string] | null
Basic auth credentials with
username and password keysDefault: null.boolean
Base64 encode the raw response body before returning. Use this for binary downloads to prevent corruption from text decoding.Default:
false.string | null
Raw string content to send as the request body (POST, PUT, and PATCH). Cannot be combined with payload, form_data, or files.Default:
null.map[string, string | FileUploadData] | null
Files to upload using multipart/form-data. The dictionary key is the form field name. The value can be a simple base64 encoded string (filename defaults to form field name), or a dictionary with ‘filename’, ‘content_base64’, and optional ‘content_type’.Default:
null.boolean
Follow HTTP redirectsDefault:
false.object | null
Form encoded data in request body (POST, PUT, and PATCH)Default:
null.map[string, string | null] | null
HTTP request headersDefault:
null.array[integer] | null
If specified, these status codes will not be treated as errors. Defaults to None.Default:
null.integer
Maximum number of redirectsDefault:
20.object | null
URL query parametersDefault:
null.object | array[any] | null
JSON serializable data in request body (POST, PUT, and PATCH)Default:
null.number
Timeout in secondsDefault:
10.0.boolean
Verify SSL certificates. Defaults to True, disable at own risk.Default:
true.Examples
Basic requestcore.http_poll
Perform a HTTP request to a given URL with optional polling.
Poll condition examples
poll_condition receives a response with data, status_code, and
headers. The action stops polling when the lambda returns True.
When the API has exactly one nonterminal state, != against it stops
on every terminal state, and the .get default treats a missing
status as that state:
queued or pending,
list its terminal states with in:
poll_max_attempts: 0, polling never stops if the condition never
matches.
Stop on an HTTP status code:
Secrets
Optional secrets:mtls: required valuesTLS_CERTIFICATE,TLS_PRIVATE_KEY.ca_cert: required valuesCA_CERTIFICATE.
Inputs
string
required
HTTP request methodAllowed values:
GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS.string
required
The destination of the HTTP request
map[string, string] | null
Basic auth credentials with
username and password keysDefault: null.boolean
Follow HTTP redirectsDefault:
false.object | null
Form encoded data in request body (POST, PUT, and PATCH)Default:
null.map[string, string | null] | null
HTTP request headersDefault:
null.integer
Maximum number of redirectsDefault:
20.object | null
URL query parametersDefault:
null.object | array[any] | null
JSON serializable data in request body (POST, PUT, and PATCH)Default:
null.string | null
Python lambda function when evaluated to True, stops polling. The function receives a dict with
headers, data, and status_code fields.Default: null.number | null
Interval in seconds between polling attempts. If not specified, defaults to polling with exponential wait.Default:
null.integer
Maximum number of polling attempts. If set to 0, the action will poll indefinitely (until timeout).Default:
10.integer | array[integer] | null
Status codes on which the action will retry. Ignored if
poll_condition is provided. If neither are specified, an error will be raised.Default: null.number
Timeout in secondsDefault:
10.0.boolean
Verify SSL certificates. Defaults to True, disable at own risk.Default:
true.Examples
Poll until terminal statuscore.http_paginate
Paginate through a HTTP response.
Inputs
string
required
HTTP request methodAllowed values:
GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS.string
required
Python lambda function that returns the next request as a JSON of
url, method, headers, params, payload, form_data to paginate to. The function receives a dict with headers, data, and status_code fields.string
required
Python lambda function that determines when pagination should STOP. The function receives a dict with
headers, data, and status_code fields.string
required
The destination of the HTTP request
map[string, string] | null
Basic auth credentials with
username and password keysDefault: null.boolean
Follow HTTP redirectsDefault:
false.object | null
Form encoded data in request body (POST, PUT, and PATCH)Default:
null.map[string, string | null] | null
HTTP request headersDefault:
null.string | null
JSONPath expression that evaluates to the items to paginate through.Default:
null.integer
Maximum number of items to paginate through. Defaults to 1000.Default:
1000.integer
Maximum number of redirectsDefault:
20.object | null
URL query parametersDefault:
null.object | array[any] | null
JSON serializable data in request body (POST, PUT, and PATCH)Default:
null.number
Timeout in secondsDefault:
10.0.boolean
Verify SSL certificates. Defaults to True, disable at own risk.Default:
true.