Query data

Query your app's data with getstream api. Responses are JSON and can be processed using jq syntax, in the terminal, a script, or by your agent.

For example, the channels user alice belongs to, most recently active first:

getstream api QueryChannels --request '{
  "filter_conditions": {
    "members": { "$in": ["alice"] }
  },
  "sort": [{ "field": "last_message_at", "direction": -1 }],
  "limit": 10
}'

Like every app-scoped command, api acts on the current project's app unless --app-id or the STREAM_API_KEY and STREAM_API_SECRET environment variables override it.

Most query endpoints support filtering with filter_conditions (see Query syntax) and sorting with sort. Pagination is handled by offset or next cursors. Refer to the help page for each endpoint:

getstream api QueryChannels --help

Add --jq to process a response with a jq expression before it is printed:

getstream api QueryUsers --request '{
  "filter_conditions": { "role": "admin" },
  "limit": 100
}' --jq '.users[] | {id, name}'

In non-interactive terminals, long arrays are truncated in responses to keep logs readable and avoid excessive context usage in agents. A --jq result is never shortened and it should be preferred in automated usage.

When working with an agent, just ask:

  • Which channels had no messages in the last 30 days?
  • How many users signed up this week?
  • List the calls that are live right now.
  • Show me the flagged messages nobody has reviewed yet.