xtract.bot
POST /api/yq-filter

Apply jq filter expressions to YAML over HTTP. Same expression language as jq-filter — the input is YAML and the result is reformatted as YAML by default.

Same expression language as `jq-filter`, but the input is YAML and the result is reformatted as YAML by default. Set `outputFormat: "json"` to keep the raw filter output verbatim. Examples: - `.users[].name` — list all user names. - `.services | keys` — keys of a top-level mapping. - `.config.port = 9000` — return the doc with one field changed.

Inputs

NameTypeDefaultDescription
filter*string"."filter expression applied to the YAML-decoded value.
yaml*fileYAML input. UTF-8.
outputFormatenum (yaml | json)"yaml"Output format. yaml (default) re-serializes; json passes stdout through.
rawOutputbooleanfalse-r: raw strings without quoting. Only honored when outputFormat is "json".
compactbooleanfalse-c: compact output. Only honored when outputFormat is "json".
indentnumber (1…8)2Indent width for the YAML output. Ignored when outputFormat is "json".

Response

Modes: text, json. Cache: yes (24h TTL).

Code samples

Built from the list-features example.

# Download or substitute the example input:
#   curl -O https://xtract.bot/examples/yq-filter/config.yaml
YAML=$(base64 -w0 < config.yaml)

curl -X POST https://api.xtract.bot/api/yq-filter \
  -H "Content-Type: application/json" \
  -H "Accept: text/plain" \
  -H "X-Account-Id: $XTRACT_ACCOUNT_ID" \
  -H "X-Api-Key: $XTRACT_API_KEY" \
  -d '{
  "filter": ".service.features[]",
  "yaml": "'"$YAML"'"
}'