# prb api command reference

Make an authenticated GraphQL request. This page documents **1 command** under `prb api`.

Flags and examples below come from the command definitions. A **Required** flag is explicitly marked required by Cobra; an unmarked flag can still be needed by runtime validation or a non-interactive workflow. Empty strings and empty lists are registered defaults, not sample values.

Every command also inherits the [global flags](/docs/developers/cli/commands#global-flags). Run `prb <command> --help` to check your installed version. Replace placeholder IDs and names in source examples before running them. Return to the [complete CLI command reference](/docs/developers/cli/commands) to browse another command.

## Commands

| Command               | Description                            | Usage             | Source                                                                                    |
| --------------------- | -------------------------------------- | ----------------- | ----------------------------------------------------------------------------------------- |
| [`prb api`](#prb-api) | Make an authenticated GraphQL request. | `prb api <query>` | [View implementation](https://github.com/getprobo/probo/blob/main/pkg/cmd/api/api.go#L48) |

## prb api

Make an authenticated GraphQL request.

### Usage

```text
prb api <query>
```

Accepts at most 1 positional argument.

### Additional help

```text
Send a GraphQL query or mutation to the Probo API and print the response.
```

### Flags

| Flag            | Type         | Default     | Required | Description                                  |
| --------------- | ------------ | ----------- | -------- | -------------------------------------------- |
| `--field`, `-f` | string array | `[]`        | —        | GraphQL variable in key=value format         |
| `--schema`      | string       | `"console"` | —        | GraphQL schema to query (console or connect) |

### Examples

```bash
# Run a query against the console schema (default)
prb api 'query { viewer { id email } }'

# Run a mutation with variables
prb api 'mutation($input: CreateRiskInput!) { createRisk(input: $input) { riskEdge { node { id } } } }' \
  -f input='{"organizationId":"...","name":"Test","category":"Operational"}'

# Query the connect schema
prb api --schema connect 'query { viewer { id email } }'

# Read query from stdin
echo '{ viewer { id } }' | prb api -
```

[View command implementation](https://github.com/getprobo/probo/blob/main/pkg/cmd/api/api.go#L48).
