# getstream api

The universal command. Every Stream API endpoint is callable by name.

```bash
getstream api <EndpointName> [flags]
```

Endpoint names are SDK client methods, also the OpenAPI operation ids. They are case-sensitive. Each call uses the initialized project's credentials by default; pass `--app-id` to target another app you own.

## Discovery

Endpoints are grouped by product. Browse them with `--help`:

```bash
getstream api --help              # all endpoints, grouped by product
getstream api chat --help         # Chat endpoints
getstream api QueryChannels --schema   # the full request body schema
```

A few endpoint names exist in more than one product (for example `CastPollVote` in both Chat and Feeds). The bare name errors instead of picking one; add the product prefix:

```bash
getstream api chat CastPollVote --request '{...}'
getstream api feeds CastPollVote --request '{...}'
```

## Parameters

| Form                 | Use                                                                      |
| -------------------- | ------------------------------------------------------------------------ |
| `--<name>`           | Path parameters, shown as required flags (for example `--id`, `--type`). |
| `--request '<json>'` | The request body, as a JSON string.                                      |

Path parameters and the body are separate. `--help` on any endpoint lists its path-parameter flags; `--schema` prints the body it accepts.

```bash
getstream api QueryChannels --request '{"filter_conditions":{"member_count":{"$gte":50}},"limit":10}'
getstream api GetMessage --id 8f3a2c1e-...
getstream api DeleteChannel --type messaging --id general --request '{"hard_delete":true}'
```

## Flags

| Flag               | Effect                                                                    |
| ------------------ | ------------------------------------------------------------------------- |
| `--request <json>` | The request body as JSON.                                                 |
| `--jq <expr>`      | Apply a `jq` expression to the parsed response before output.             |
| `--schema`         | Print the full request body schema and exit, without making a call.       |
| `--app-id <id>`    | Target an app you own instead of the initialized project. Requires login. |
| `--verbose`        | Print the API request and full error details. Works on every command.     |

## Environment variables

| Variable              | Effect                                                    |
| --------------------- | --------------------------------------------------------- |
| `STREAM_BASE_URL`     | Target a non-production API host, such as staging.        |
| `STREAM_HTTP_TIMEOUT` | HTTP timeout for API calls, as a whole number of seconds. |

## Output

Responses are formatted JSON on stdout. Errors are written to stderr with a non-zero exit. There are no table or id output modes.

When stdin is a terminal the response prints in full - pipes and redirects included. When stdin is not a terminal (CI steps, agent calls, anything detached), or `NONINTERACTIVE` is set, long arrays are shortened to 25 items, with a `Long arrays truncated` notice on stderr. `--jq` results always print in full, so scripts should select values with `--jq` rather than parse the raw response.

## See also

- [Endpoint catalog](https://getstream.io/cli/docs/reference/endpoints/): finding the right endpoint name
- [Filter operators](https://getstream.io/cli/docs/reference/filter-operators/): building `filter_conditions` bodies
- [jq expressions](https://getstream.io/cli/docs/reference/jq/): what to pass to `--jq`
- [Projects and credentials](https://getstream.io/cli/docs/concepts/projects-and-credentials/): how `--app-id` resolves

---

For the most recent version of this documentation, visit [https://getstream.io/cli/docs/commands/api/](https://getstream.io/cli/docs/commands/api/).