# api

> The Shoplazza CLI api rest command sends a raw HTTP request to any Shoplazza API endpoint, for cases the shortcut and API command layers do not cover.

Raw HTTP escape hatch for any Shoplazza API endpoint. Use this when you need to call an endpoint not covered by other commands.

## rest

Send a raw HTTP request to any Shoplazza API endpoint.

```shell
shoplazza api rest <METHOD> <PATH> [flags]
```

### Positional arguments

1. `<method>` — HTTP method (`GET`, `POST`, `PUT`, `DELETE`, `PATCH`)
2. `<path>` — API path (e.g. `/openapi/2026-01/products`)

### Flags

| Flag | Type | Description |
|------|------|-------------|
| `--params <json>` | string | Query parameters as JSON (supports `-` for stdin or `@file`) |
| `--data <json>` | string | Request body as JSON (supports `-` for stdin or `@file`) |
| `--jq, -q <expr>` | string | jq expression to filter JSON output; applies to the whole `{"ok": true, "data": …}` envelope and needs `--format json` (the default only when output is piped) |
| `--dry-run` | bool | Print the request that would be sent without executing it |

### Examples

```shell
# GET request
shoplazza api rest GET /openapi/2026-01/products
shoplazza api rest GET /openapi/2026-01/products --params '{"page_size":10}'

# POST with inline JSON
shoplazza api rest POST /openapi/2026-01/products --data '{"product":{"title":"Test"}}'

# POST with file
shoplazza api rest POST /openapi/2026-01/products --data @product.json

# POST with stdin
echo '{"product":{"title":"Test"}}' | shoplazza api rest POST /openapi/2026-01/products --data -

# PUT request
shoplazza api rest PUT /openapi/2026-01/products/123 --data '{"product":{"title":"Updated"}}'

# DELETE request
shoplazza api rest DELETE /openapi/2026-01/products/123

# With jq filtering
shoplazza api rest GET /openapi/2026-01/products --format json --jq '.data.products[].title'

# Dry run (preview request without executing)
shoplazza api rest GET /openapi/2026-01/orders --dry-run
```

### When to use raw API

Use `api rest` when:

* You need to call an endpoint not yet covered by API commands
* You want full control over request parameters
* You are experimenting with new API features

For most use cases, prefer [shortcuts](../guides/shortcuts) or [API commands](./products) which provide type checking and smart defaults.
