Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions cli/checkly-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ The basic command takes an API endpoint path and optional flags.
npx checkly api <endpoint> [options]
```

Responses with a JSON content type (`application/json` or a `+json` media type) are formatted as JSON. Attachments and other response bodies are streamed unchanged, without adding a trailing newline. If you use `--jq`, the response is parsed as JSON regardless of its content type. A non-JSON body produces an error.

## Arguments

The command takes a single required argument.
Expand Down Expand Up @@ -134,6 +136,16 @@ Use `-H` to pass additional HTTP headers with the request. You can repeat the fl
npx checkly api /v1/checks -H "Accept: application/json" -H "X-Custom-Header: value"
```

### Download a file

Redirect the response to a file. Replace `/path/to/file` with the relative API endpoint that returns your file. The command follows redirects and preserves the bytes of ZIP archives and other downloads.

```bash Terminal
npx checkly api /path/to/file > report.zip
```

Use the endpoint path rather than an absolute URL. Avoid `--include` when saving a file because it adds HTTP headers to the output. Attachments, including JSON files, retain their original bytes unless you use `--jq`.

### Inspect response headers

Use `-i` to include the HTTP status and headers in the output:
Expand Down
Loading