Raw requests
cademi api sends an authenticated request to any API v3 endpoint and prints the response. Use it for operations added to the API after your CLI version, or when you want to control the method, path, query string, and headers directly.
Usage
cademi api [method] <path>- The path is relative to
/api/v3:/productscalls/api/v3/products. It can include a query string (/products?status=published). - The method defaults to
GET, or toPOSTwhen you pass--data. - For
GET,-fand-Fadd query parameters, and--datais rejected. For every other method, they build the JSON body, as in Commands. - Query parameter names are sent as written, and a repeated name is sent once per value:
cademi api /users -f 'tag_id[]=tag_01' -f 'tag_id[]=tag_02'sendstag_id[]twice. - The request is authenticated like any other command: with
CADEMI_API_KEYwhen it is set, and with the current profile otherwise.
cademi api /credentials/current
cademi api /products -f status=published --all --jq '.[].id'
cademi api POST /users -f name="Ana Souza" -f [email protected]
cademi api PATCH /products/prd_12 --if-match 'W/"product:prd_12:..."' -f name="New name"
cademi api POST /operations/batches -d @batch.json --waitThe body of a batch and the rules for its items are in Asynchronous operations, batches, and idempotency.
Validation before sending
When the method and path match an operation in the API contract built into the CLI, cademi api checks the request before sending it, as the generated commands do. The contract matches the API release that cademi version shows. The command stops with exit code 2, and nothing reaches the API, when the request has any of the following:
- a query parameter that the operation does not declare;
- a body field that the operation does not accept, including fields in
--dataand the keys of nested objects when the contract lists them; - a body for an operation that takes none.
The message names what was rejected and lists what the operation accepts:
cademi api '/products?offset=50'Error: unknown query parameter "offset" for GET /products; accepted: limit, cursor, sort, showcase_id, status, external_id, q, deleted. API v3 paginates with limit and cursor (page.next_cursor)Query parameter names are compared as written, so an array parameter needs its brackets (tag_id[], not tag_id). A path that matches no known operation is sent without this check.
--skip-validation sends the request as it is. Use it when the server runs a newer API release than your CLI and an operation gained a parameter or a field that your CLI does not know. The API still validates the request and rejects what it does not accept (Errors).
cademi api POST /users --skip-validation -f name="Ana Souza" -f [email protected] -f new_field=valueFlags
| Flag | Effect |
|---|---|
-d, --data | JSON body: a literal, @file, or @- for standard input. |
-f, --field / -F, --typed-field | Query parameters for GET, body fields otherwise. |
-H, --header 'Name: value' | Adds a request header. Repeat for several headers. An Idempotency-Key header works like --idempotency-key. |
--all | Follows next_cursor and prints every item as a single array. GET only. |
--idempotency-key | Sets the Idempotency-Key of a write. By default, a new key is sent with every POST, PATCH, PUT, and DELETE. |
--skip-validation | Skips the local check, so query parameters and body fields that the contract built into the CLI does not know are sent. See Validation before sending. |
--if-match | Sends If-Match with this ETag. |
--wait, --wait-timeout | When the API answers 202, waits for the operation to finish. |
--json, -o, --jq, --raw, -i | Output, as in Commands. |
You can set the idempotency key with --idempotency-key or with -H 'Idempotency-Key: <key>'. If you pass both, --idempotency-key wins. An Idempotency-Key header with an empty value is ignored, and the write carries a new key as usual. See Writes, retries, and idempotency.
cademi api POST /users -H 'Idempotency-Key: import-ana-2026-09-25' -f name="Ana Souza" -f [email protected]By default, cademi api prints the data of the response. --raw prints the whole envelope, and -i adds the status and headers.
Retries, exit codes, and error output are the same as for the generated commands: see Commands and Exit codes.
When to use it
- Operations newer than the CLI. When the server runs a newer release than your CLI,
cademi doctorwarns you, and the new operations have no command until you update.cademi apireaches them right away. If an existing operation gained a parameter or a field in that release, add--skip-validation. - Exploring the API. Pair
cademi apiwith-ito see the status and headers of a response, such asX-Cademi-Release,X-Request-Id, andETag. - Scripts that mirror HTTP. If a script already works with paths from the API reference,
cademi apihandles authentication, idempotency keys, and retries for it.
For every other case, the generated commands are shorter: they build the path from positional arguments, type the query flags, and list the body fields in --help.