> For the complete documentation index, see [llms.txt](https://developer.celigo.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.celigo.com/cli/commands/apis.md).

# apis

Celigo APIs are custom HTTP endpoints that let external systems push data into, or query data through, Celigo integrations synchronously — the caller gets a structured response back in the same request.

**REST API**: [APIs](https://developer.celigo.com/api/api-reference/api-management/apis)

```
celigo apis <subcommand> [args] [flags]
```

Supports all [global flags](https://developer.celigo.com/cli/getting-started/global-flags.md).

***

## Subcommands

| Subcommand                                                 | Purpose                                                                                                                    |
| ---------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| `list`                                                     | List all APIs, with optional `--name`, `--disabled`, and `--method` server-side filters, and `--sort-by`.                  |
| `get <id>`                                                 | Fetch one API by ID.                                                                                                       |
| `create`                                                   | Create an API from a JSON body (`--file <path>` or stdin).                                                                 |
| `update <id>`                                              | Full-replace an API from a JSON body (`--file <path>` or stdin); destructive `PUT`.                                        |
| `set <id> key=value …`                                     | Safe field edit: whitelisted fields via atomic PATCH, others GET → modify → PUT. Supports `key=file://<path>`.             |
| `delete <id>`                                              | Delete an API.                                                                                                             |
| `dependencies <id>` (alias `used-by`)                      | List resources that depend on this API.                                                                                    |
| `audit <id>`                                               | Show the API's audit log (change history).                                                                                 |
| `graph [ref]`                                              | Render the API's Flow Builder graph from the local tree, offline — as JSON, Mermaid, or DOT. Added in celigo-cli 2026.9.1. |
| `connections <id>`                                         | List the connections referenced by a builder-mode API's export and import steps. Added in celigo-cli 2026.9.6.             |
| `replace-connection <id> <connectionId> <newConnectionId>` | Repoint every step in `builder.routers` that uses one connection to another, in one call. Added in celigo-cli 2026.9.6.    |
| `logs <id>`                                                | List recent inbound request logs for an API.                                                                               |
| `log-detail <id> <key>`                                    | Fetch full request/response detail for one log entry.                                                                      |
| `request-history <id>`                                     | List the API's logged request executions — the run index.                                                                  |
| `execution-logs <apiId> <executionId>`                     | Print one request execution's log (the trace view); `--details` assembles the full picture.                                |
| `delete-execution-logs <id>`                               | Queue deletion of stored execution logs in a date range.                                                                   |
| `clone <id>`                                               | Clone a builder-mode API (and its copied export/import resources). `--dry-run` checks the target route only.               |
| `download <id>`                                            | Download a builder-mode API and everything it references as a template ZIP.                                                |
| `add-processor <id> <exportOrImportId>`                    | Add a page processor (export or import) to a builder-mode API branch.                                                      |
| `remove-processor <id> <exportOrImportId>`                 | Remove a page processor from a builder-mode API branch.                                                                    |
| `set-group <apiGroupingId> <apiIds...>`                    | Assign one or more APIs to an API group.                                                                                   |
| `unset-group <apiIds...>`                                  | Remove one or more APIs from their group.                                                                                  |
| `test-run <id>`                                            | Start a test run and return stage-by-stage results.                                                                        |
| `test-run-step-results <id> <runId> <exportOrImportId>`    | Get stage-by-stage results for a single test-run step.                                                                     |
| `test-run-step-logs <id> <runId> <exportOrImportId>`       | List HTTP request/response logs for a test-run step.                                                                       |
| `debug-requests <id> <exportOrImportId>`                   | List debug request log entries for an export or import inside the API.                                                     |
| `debug-request-detail <id> <exportOrImportId> <key>`       | Fetch full request/response detail for a debug log entry.                                                                  |

***

## `celigo apis list`

List all APIs visible to the current profile, with optional server-side filters.

**Signature**

```bash
celigo apis list [--name <substring>] [--disabled] [--method <method>] [--sort-by <field>] [--order <dir>]
```

**Arguments**

None.

**Flags**

| Flag                 | Type    | Default   | Description                                                                                                                                                                                                                                                     |
| -------------------- | ------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--name <substring>` | string  | —         | Filter by name — a server-side substring match, not exact. Added in celigo-cli 2026.8.7.                                                                                                                                                                        |
| `--disabled`         | boolean | `false`   | Only APIs with `disabled: true`. Added in celigo-cli 2026.8.7.                                                                                                                                                                                                  |
| `--method <method>`  | string  | —         | Only builder-mode APIs whose request method (`builder.request.method`) is this one: `GET`, `POST`, `PUT`, `PATCH`, or `DELETE`, in upper case. Added in celigo-cli 2026.11.2.                                                                                   |
| `--sort-by <field>`  | string  | `name`    | Sort order: `name`, `lastModified`, or `builder.request.relativeURI` (a builder-mode API's route). Added in celigo-cli 2026.11.2.                                                                                                                               |
| `--order <dir>`      | string  | —         | Direction of the sort: `asc` or `desc`. The default is the sort key's own. Added in celigo-cli 2026.11.2.                                                                                                                                                       |
| `--fields <spec>`    | string  | `default` | Fields to request per row. `default` returns `_id`, `name`, and the table columns; `all` returns complete documents; a comma-separated list requests specific fields. See [field projection](https://developer.celigo.com/cli/getting-started/global-flags.md). |
| `--limit <n>`        | integer | —         | Return at most `<n>` rows, fetching a single page.                                                                                                                                                                                                              |

Default table columns: `_id`, `name`, `type`, `disabled`, `lastModified`. Since celigo-cli 2026.10.1, `--fields a,b,…` with `--format table` draws `_id`, `name`, and the fields you name instead.

Since celigo-cli 2026.11.2, a blank filter value (an unset shell variable), such as `--name ""`, is refused before any request; earlier releases sent it as an empty filter.

**Example**

```bash
celigo apis list --format table

# Disabled order-related APIs
celigo apis list --name order --disabled

# Builder-mode POST APIs, most recently modified first
celigo apis list --method POST --sort-by lastModified --order desc
```

**Corresponds to**: [`GET /v1/apis`](https://developer.celigo.com/api/api-reference/api-management/apis#get-v1-apis) (operationId: `listApis`)

***

## `celigo apis get <id>`

Fetch one API by ID.

**Signature**

```bash
celigo apis get <id>
```

**Arguments**

| Argument | Type   | Required | Description      |
| -------- | ------ | -------- | ---------------- |
| `<id>`   | string | Yes      | API resource ID. |

**Flags**

Uses [global flags](https://developer.celigo.com/cli/getting-started/global-flags.md) only.

**Example**

```bash
celigo apis get 5f83a9b2c7d3e8f1a2b3c4d5 --format json
```

**Corresponds to**: [`GET /v1/apis/{_id}`](https://developer.celigo.com/api/api-reference/api-management/apis#get-v1-apis-_id) (operationId: `getApiById`)

***

## `celigo apis create`

Create a new API from a JSON body. Read the body from a file with `-f, --file` (recommended), or pipe it on stdin.

Since celigo-cli 2026.10.1, the body is checked before it is sent. It is validated against the published API schemas — the pack [`celigo lint`](https://developer.celigo.com/cli/local-tree/lint-and-resolve.md#celigo-lint) uses: a field the spec does not document, a wrong JSON type, or a value outside an enum prints a `warning` line on stderr, and the API is still created. Refused before any request, with no override: a body that is not a JSON object, masked `"******"` credential placeholders, a value that is not a string in a field the platform encrypts (`shipworks.password`), and a responseMapping object wrapper (or `null`, or the `[null]`/`[{}]` it leaves behind) in a step's `responseMapping` — the platform accepts those and erases the step's mappings.

Since celigo-cli 2026.10.2, a router in `builder.routers` whose `script` is `null` is refused too, with no override. The platform stores it, but Flow Builder crashes when it opens that router. A router with no script leaves the `script` key out.

**Signature**

```bash
celigo apis create --file <path>
celigo apis create < api.json     # or pipe on stdin
```

**Arguments**

None.

**Flags**

| Flag                | Type   | Default | Description                                                                                                  |
| ------------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------ |
| `-f, --file <path>` | string | —       | Read the JSON body from a file instead of stdin (`--file -` also means stdin). Added in celigo-cli 2026.6.1. |

**Request body**

A JSON object matching the `POST /v1/apis` request schema (builder vs. script mode, routers, page processors, etc.).

**Example**

```bash
celigo apis create --file ./api.json
```

**Corresponds to**: [`POST /v1/apis`](https://developer.celigo.com/api/api-reference/api-management/apis#post-v1-apis) (operationId: `createApi`)

***

## `celigo apis update <id>`

Full-replace an API from a JSON body (`--file <path>` or stdin).

> ⚠️ **`update` erases omitted fields.** It sends a `PUT`, not a `PATCH`, so any field missing from the body is cleared. `GET` the API first, edit it, then send back the complete object — or use `set` for partial edits.

Since celigo-cli 2026.10.1, the body is checked against the published API schemas before the PUT (when it has findings, the current API is read first, so only what the update adds or changes is reported); findings are stderr warnings and never block. Refused with no override — `--force` included: a body that is not a JSON object, a value that is not a string in a field the platform encrypts (`shipworks.password`), and a responseMapping object wrapper or `null` in a step's `responseMapping`. On an Integration App's API (`_connectorId` set), the platform answers `200` and keeps its own value for every field the app locks: each field the update changed whose reply still holds the previous value is named on stderr, and the command exits `1`.

Since celigo-cli 2026.10.2, a router in `builder.routers` whose `script` is `null` is refused the same way, with no override, even one copied from a `GET`. Flow Builder crashes when it opens that router, so leave the key out.

**Signature**

```bash
celigo apis update <id> --file <path>
celigo apis update <id> < api.json     # or pipe on stdin
```

**Arguments**

| Argument | Type   | Required | Description      |
| -------- | ------ | -------- | ---------------- |
| `<id>`   | string | Yes      | API resource ID. |

**Flags**

| Flag                | Type    | Default | Description                                                                                                                                                                                                                                                |
| ------------------- | ------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `-f, --file <path>` | string  | —       | Read the JSON body from a file instead of stdin (`--file -` also means stdin). Added in celigo-cli 2026.6.1.                                                                                                                                               |
| `--force`           | boolean | `false` | Submit even if the body contains masked credential values (`"******"`) copied from a `GET`. Since celigo-cli 2026.10.1, a masked value is four or more asterisks and nothing else: a lone `*` (a wildcard, for example) is a value and needs no `--force`. |

**Request body**

The full API JSON, matching the `PUT /v1/apis/{_id}` request schema.

**Example**

```bash
celigo apis get 5f83a9b2c7d3e8f1a2b3c4d5 --format json \
  | jq '.name = "Renamed API"' \
  | celigo apis update 5f83a9b2c7d3e8f1a2b3c4d5
```

**Corresponds to**: [`PUT /v1/apis/{_id}`](https://developer.celigo.com/api/api-reference/api-management/apis#put-v1-apis-_id) (operationId: `updateApi`)

***

## `celigo apis set <id> [assignments...]`

Safe field edit. Whitelisted fields — `name`, `description`, `disabled`, `pagination.enabled`, `timeoutPeriod`, since celigo-cli 2026.8.7 `logging.mode`, `logging.debugUntil`, and `traceKeyTemplate`, and since celigo-cli 2026.11.2 `failOnOfflineConnection` and `isSchemaValidationActive` — are applied via an atomic `PATCH`; other fields go through GET → modify → PUT so omitted fields survive. Accepts one or more `key=value` pairs with dot + bracket path support; `key=null` removes the field. A `key=file://<path>` value loads that field's value from a file instead of the command line (a leading `~` and relative paths are supported).

The PATCH route for the logging fields is a correctness fix, not just fewer round trips: the server **silently ignores `logging` changes on a full PUT** — every mode value revert-persists as `basic`, without an error — so `set` is the only CLI path that can actually change an API's logging level.

A `set` sent as one PATCH prints the PATCH's answer. When that answer has no body, stdout stays empty, stderr says `Updated api <id>.`, and the exit code is `0`. Earlier releases sent `failOnOfflineConnection` and `isSchemaValidationActive` through the GET + PUT, which prints the PUT's answer, so read the API with `apis get <id>` where a script needs the document.

Since celigo-cli 2026.10.1:

* `key=null` on a whitelisted field other than `logging.debugUntil` clears it through a GET + PUT: the API PATCH removes only `logging.debugUntil`, and the `remove` the CLI used to send for the others was refused.
* In `operate` mode, `set` takes only `disabled` and `logging.debugUntil`, each as one PATCH. Another operational field name is refused instead of opening a GET + PUT, and so is a `null` the PATCH cannot carry, such as `disabled=null`. See [permission modes](https://developer.celigo.com/cli/getting-started/profiles.md#permission-modes).
* A value that is not a string in a field the platform encrypts (`shipworks.password`) is refused before any request. `key=value` reads `123` and `true` as a number and a boolean, so quote such a secret as a JSON string: `shipworks.password='"123"'`.
* The assigned values (PATCH) or the document a GET + PUT would send are checked against the published API schemas; findings are stderr warnings and never block.
* After a GET + PUT, a field the server's reply still holds at its previous value prints `not stored <field> the server answered the PUT but still holds its previous value …` on stderr, and the command exits `1`. On an Integration App's API (`_connectorId` set), one stderr line names the fields the app kept instead — `celigo: apis set: the platform kept its own value for <fields> — the Integration App locks them` — and the command exits `1`.

Since celigo-cli 2026.10.2, a GET + PUT that would send back a router whose `script` is `null` is refused, because Flow Builder crashes when it opens that router. An API's routers sit under `builder`, so add `'builder.routers[<n>].script=null'` to the same `set`: assigning `null` removes the key. That assignment on its own repairs an API that already holds one. A `set` of whitelisted fields only is a `PATCH`, which never sends the routers.

**Signature**

```bash
celigo apis set <id> key=value [key2=value2 ...]
```

**Arguments**

| Argument           | Type                | Required | Description                                                                                                                                                                                                                                   |
| ------------------ | ------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `<id>`             | string              | Yes      | API resource ID.                                                                                                                                                                                                                              |
| `[assignments...]` | `key=value` strings | Yes (≥1) | Field assignments. Dot notation (`a.b.c`) and array indexing (`builder.routers[0].branches[0].name=Primary`) supported. JSON-parsed values: `disabled=false`, `logging.debugUntil=null`. Use `key=file://<path>` to load a value from a file. |

**Flags**

Uses [global flags](https://developer.celigo.com/cli/getting-started/global-flags.md) only.

**Example**

```bash
celigo apis set 5f83a9b2c7d3e8f1a2b3c4d5 disabled=false logging.debugUntil=null

# Turn on detailed request logging (feeds request-history / execution-logs)
celigo apis set 5f83a9b2c7d3e8f1a2b3c4d5 logging.mode=detailed

# Remove the first router's null script — Flow Builder crashes opening that router
celigo apis set 5f83a9b2c7d3e8f1a2b3c4d5 'builder.routers[0].script=null'
```

**Corresponds to**: [`PUT /v1/apis/{_id}`](https://developer.celigo.com/api/api-reference/api-management/apis#put-v1-apis-_id) (operationId: `updateApi`) — issued after an internal [`GET /v1/apis/{_id}`](https://developer.celigo.com/api/api-reference/api-management/apis#get-v1-apis-_id) — or an atomic `PATCH /v1/apis/{_id}` when every assigned field is whitelisted.

***

## `celigo apis delete <id>`

Delete an API. Prompts for confirmation unless `-y` is passed.

> ⚠️ **`delete` is immediate.** Callers of the API's endpoint start receiving errors. Run `dependencies` first to see what relies on it.

**Signature**

```bash
celigo apis delete <id> [-y]
```

**Arguments**

| Argument | Type   | Required | Description      |
| -------- | ------ | -------- | ---------------- |
| `<id>`   | string | Yes      | API resource ID. |

**Flags**

| Flag          | Type    | Default | Description               |
| ------------- | ------- | ------- | ------------------------- |
| `-y`, `--yes` | boolean | `false` | Skip confirmation prompt. |

**Example**

```bash
celigo apis delete 5f83a9b2c7d3e8f1a2b3c4d5 -y
```

**Corresponds to**: [`DELETE /v1/apis/{_id}`](https://developer.celigo.com/api/api-reference/api-management/apis#delete-v1-apis-_id) (operationId: `deleteApi`)

***

## `celigo apis dependencies <id>`

List resources that depend on this API (alias: `used-by`). Use it to check whether an API is safe to delete — an empty result means nothing references it. Since celigo-cli 2026.10.1, an id that matches no API answers with the API's `404` instead of an empty result, so a typo never reads as safe to delete.

**Signature**

```bash
celigo apis dependencies <id>
```

**Arguments**

| Argument | Type   | Required | Description      |
| -------- | ------ | -------- | ---------------- |
| `<id>`   | string | Yes      | API resource ID. |

**Flags**

Uses [global flags](https://developer.celigo.com/cli/getting-started/global-flags.md) only.

**Example**

```bash
celigo apis dependencies 5f83a9b2c7d3e8f1a2b3c4d5
```

**Corresponds to**: `GET /v1/apis/{_id}/dependencies` (operationId: `listApiDependencies`)

***

## `celigo apis audit <id>`

Show the audit log (change history) for one API. Since celigo-cli 2026.10.1, every page of the log is read (the endpoint pages at 1,000 entries), and the table columns are `_id`, `resourceType`, `event`, `source`, `byUser.email`, and `time`.

**Signature**

```bash
celigo apis audit <id>
```

**Arguments**

| Argument | Type   | Required | Description      |
| -------- | ------ | -------- | ---------------- |
| `<id>`   | string | Yes      | API resource ID. |

**Flags**

Uses [global flags](https://developer.celigo.com/cli/getting-started/global-flags.md) only.

**Example**

```bash
celigo apis audit 5f83a9b2c7d3e8f1a2b3c4d5
```

**Corresponds to**: `GET /v1/apis/{_id}/audit`

***

## `celigo apis graph [ref]`

Render an API's Flow Builder graph from the local tree, offline — the request as the one source, the steps and branchings, and the response router with its responses as the terminals, as the canvas draws them. Each step carries its name, category, application, and step components (filters, mappings, hooks, response mapping, error handling), resolved through the tree that `celigo pull` wrote. See [The local tree](https://developer.celigo.com/cli/local-tree.md). Added in celigo-cli 2026.9.1.

The graph is rendered from the documents on disk, so no profile or token is needed and the command is never mode-gated. `[ref]` is a tree path, a link, a resource folder, `type:id`, or a bare id. Any `api.json` on disk works through `--file` (`-` for stdin), but its references stay unresolved unless the file sits in a pulled tree. A `flow:`, `api:`, or `tool:` ref renders with its own builder's shape from any of the three groups, and a `--file` document whose shape names no builder renders as an API. The JSON output is the graph the Celigo VS Code extension's Flow Canvas consumes ([VS Code extension](https://developer.celigo.com/cli/vscode-extension.md)); `--as mermaid` renders natively in GitHub pull requests, and `--as dot` is Graphviz input. The full contract is the same as [`flows graph`](https://developer.celigo.com/cli/commands/flows.md#celigo-flows-graph). Since celigo-cli 2026.11.2, a `[ref]` given beside `--file` is refused; earlier releases read the file and ignored the ref.

Since celigo-cli 2026.10.1, an API with no `builder` renders the request alone instead of an edge to a node that is never drawn, and an API whose builder has no `responseRouter` renders with its response router under the `apiRouter` id the platform writes on every other API, instead of failing.

**Signature**

```bash
celigo apis graph [ref] [--dir <path>] [--as json|mermaid|dot] [--file <path>] [--status] [--no-components]
```

**Arguments**

| Argument | Type   | Required | Description                                                                                                                                                                                                                                                           |
| -------- | ------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `[ref]`  | string | No       | The API to render: a tree path, a link, a resource folder, `api:<id>` (or `flow:`/`tool:`), or a bare id. Required unless `--file` is given; with neither, the command exits `1` with `Provide a ref (a tree path, type:id, or id) or --file <path> ('-' for stdin).` |

**Flags**

| Flag              | Type                         | Default | Description                                                                                                                                                                                    |
| ----------------- | ---------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--dir <path>`    | string                       | `.`     | Tree root directory.                                                                                                                                                                           |
| `--as <format>`   | `json` \| `mermaid` \| `dot` | `json`  | Output format. `json` is the graph the VS Code canvas consumes; `mermaid` renders natively in GitHub pull requests; `dot` is for Graphviz.                                                     |
| `--file <path>`   | string                       | —       | Read the document from a file instead of the tree (`-` for stdin). References render unresolved unless the file sits in a pulled tree.                                                         |
| `--status`        | boolean                      | `false` | Add the tree's `celigo status` state (`clean`, `modified`, `missing`, or `untracked`) for the document and each step's resource. In `mermaid`/`dot` output the states appear as comment lines. |
| `--no-components` | boolean                      | `false` | Leave the step component chips out of `mermaid`/`dot` output.                                                                                                                                  |

**Example**

```bash
# From inside a pulled tree
celigo apis graph api:5f83a9b2c7d3e8f1a2b3c4d5

# Mermaid for a pull request description
celigo apis graph "integrations/Shop/apis/Public Lookup API/api.json" --as mermaid
```

**Corresponds to**: no API call — the graph is built from the local tree.

***

## `celigo apis connections <id>`

List the connections referenced by the export and import steps in a builder-mode API's `builder.routers` — the candidates for `replace-connection`. Added in celigo-cli 2026.9.6.

**Signature**

```bash
celigo apis connections <id>
```

**Arguments**

| Argument | Type   | Required | Description                   |
| -------- | ------ | -------- | ----------------------------- |
| `<id>`   | string | Yes      | Builder-mode API resource ID. |

**Flags**

Uses [global flags](https://developer.celigo.com/cli/getting-started/global-flags.md) only.

Default table columns: `_id`, `name`, `type`.

**Example**

```bash
celigo apis connections 5f83a9b2c7d3e8f1a2b3c4d5 --format table
```

**Corresponds to**: [`GET /v1/apis/{_id}/connections`](https://developer.celigo.com/api/api-reference/api-management/apis)

***

## `celigo apis replace-connection <id> <connectionId> <newConnectionId>`

Repoint every export and import step in a builder-mode API's `builder.routers` that uses one connection to another, in one call, and return `{replacedNodeCount}` — the `tools replace-connection` twin. `apis connections <id>` lists the candidates. Requires `full` mode. Added in celigo-cli 2026.9.6.

**Signature**

```bash
celigo apis replace-connection <id> <connectionId> <newConnectionId>
```

**Arguments**

| Argument            | Type   | Required | Description                         |
| ------------------- | ------ | -------- | ----------------------------------- |
| `<id>`              | string | Yes      | Builder-mode API resource ID.       |
| `<connectionId>`    | string | Yes      | The connection the steps use today. |
| `<newConnectionId>` | string | Yes      | The connection to point them at.    |

**Flags**

Uses [global flags](https://developer.celigo.com/cli/getting-started/global-flags.md) only.

**Example**

```bash
celigo apis replace-connection 5f83a9b2c7d3e8f1a2b3c4d5 6a1b2c3d4e5f6a7b8c9d0e1f 7b2c3d4e5f6a7b8c9d0e1f2a
```

**Corresponds to**: [`PUT /v1/apis/{_id}/replaceConnection`](https://developer.celigo.com/api/api-reference/api-management/apis) with `{"_connectionId": "...", "_newConnectionId": "..."}`; the response is `{replacedNodeCount}`.

***

## `celigo apis logs <id>`

List recent inbound request logs for an API. JSON output is the API's envelope (`requests`). Since celigo-cli 2026.10.1, `--format table` lists one request per row — `key` (never cut, for `log-detail`), `time`, `method`, `statusCode` — instead of the whole envelope in one cell.

**Signature**

```bash
celigo apis logs <id>
```

**Arguments**

| Argument | Type   | Required | Description      |
| -------- | ------ | -------- | ---------------- |
| `<id>`   | string | Yes      | API resource ID. |

**Flags**

Uses [global flags](https://developer.celigo.com/cli/getting-started/global-flags.md) only.

**Example**

```bash
celigo apis logs 5f83a9b2c7d3e8f1a2b3c4d5 --format json
```

**Corresponds to**: [`GET /v1/apis/{_id}/logs`](https://developer.celigo.com/api/api-reference/api-management/apis) (operationId: `listApiLogs`)

***

## `celigo apis log-detail <id> <key>`

Fetch full request/response detail for a single API log entry. The `key` comes from `apis logs`.

**Signature**

```bash
celigo apis log-detail <id> <key>
```

**Arguments**

| Argument | Type   | Required | Description                     |
| -------- | ------ | -------- | ------------------------------- |
| `<id>`   | string | Yes      | API resource ID.                |
| `<key>`  | string | Yes      | Log entry key from `apis logs`. |

**Flags**

Uses [global flags](https://developer.celigo.com/cli/getting-started/global-flags.md) only.

**Example**

```bash
celigo apis log-detail 5f83a9b2c7d3e8f1a2b3c4d5 01H9XK7M...
```

**Corresponds to**: [`GET /v1/apis/{_id}/logs/{key}`](https://developer.celigo.com/api/api-reference/api-management/apis) (operationId: `getApiLogByKey`)

***

## `celigo apis request-history <id>`

List an API's logged request executions — the run index behind the UI's Request history panel: one entry per inbound request processed while the API's `logging.mode` was anything other than `noLogging`. Defaults to the last 5 minutes; widen the window with `--time-gte`/`--time-lte`.

This is [jobs](https://developer.celigo.com/cli/commands/jobs.md)' analog for APIs: pick an entry's `executionId` here, then drill into that run with `apis execution-logs`. Distinct from `apis logs`, which returns the legacy file-backed request/response envelopes — use `request-history` for run history, `apis logs` for the raw decoded request and response of a single call.

JSON output is the API's envelope (`requests`, `nextPageUrl`), as before. Since celigo-cli 2026.10.1, `--format table` lists one request per row — `executionId`, `time`, `method`, `relativeURI`, `statusCode`, `timeTaken` — instead of the envelope with the runs in one cell, and when more runs exist it names the next page on stderr: `Note: more runs exist; for the next page, repeat the command with --next <time> --cursor-execution-id <id>.` Pass both values, with the same filters, to read that page.

Since celigo-cli 2026.11.2, the filters are checked before the request. A blank filter value (an unset shell variable) is refused, and so are a `--time-gte` later than `--time-lte`, a `--page-size` that is not a positive whole number, and a `--sort-order` other than `asc` or `desc`.

**Signature**

```bash
celigo apis request-history <id> [filters] [--next <time> --cursor-execution-id <id>]
```

**Arguments**

| Argument | Type   | Required | Description      |
| -------- | ------ | -------- | ---------------- |
| `<id>`   | string | Yes      | API resource ID. |

**Flags**

| Flag                          | Type          | Default       | Description                                                                                                                                                                           |
| ----------------------------- | ------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--time-gte <iso>`            | ISO 8601      | 5 minutes ago | Include requests at or after this timestamp.                                                                                                                                          |
| `--time-lte <iso>`            | ISO 8601      | now           | Include requests at or before this timestamp.                                                                                                                                         |
| `--status-code <code>`        | string        | —             | Filter by HTTP response status code (single value or comma-separated list).                                                                                                           |
| `--method <method>`           | string        | —             | Filter by HTTP method (case-insensitive). Since celigo-cli 2026.10.1 the CLI sends it upper-cased, so `--method post` matches; the filter used to match only the upper-case spelling. |
| `--trace-key-prefix <prefix>` | string        | —             | Filter on `traceKey` (prefix match; the API's `traceKey` param).                                                                                                                      |
| `--remote-ip <prefix>`        | string        | —             | Filter on the client IP address (prefix match).                                                                                                                                       |
| `--relative-uri <prefix>`     | string        | —             | Filter on the request relative URI (prefix match).                                                                                                                                    |
| `--search-key <text>`         | string        | —             | Free-text search, OR-matched across `traceKey` (prefix), `remoteIP` (prefix), and `relativeURI` (substring); at least 3 characters. Overrides those three filters.                    |
| `--page-size <n>`             | integer       | —             | Entries per page.                                                                                                                                                                     |
| `--sort-order <dir>`          | `asc \| desc` | —             | Sort direction by request time.                                                                                                                                                       |
| `--next <time>`               | string        | —             | Read the page after this cursor: the `next` value of the previous page's `nextPageUrl` (a table names it on stderr). Needs `--cursor-execution-id`. Added in celigo-cli 2026.10.1.    |
| `--cursor-execution-id <id>`  | string        | —             | The page cursor's tie-breaker: the `cursorExecutionId` value of the previous page's `nextPageUrl`. Needs `--next`. Added in celigo-cli 2026.10.1.                                     |

**Example**

```bash
# Failed requests in the last hour
celigo apis request-history 5f83a9b2c7d3e8f1a2b3c4d5 \
  --time-gte "$(date -u -v-1H +%FT%TZ)" --status-code 500

# Pick a run to drill into
celigo apis request-history 5f83a9b2c7d3e8f1a2b3c4d5 --jq '.[0].executionId'

# The next page, with the two values the table named on stderr
celigo apis request-history 5f83a9b2c7d3e8f1a2b3c4d5 --format table \
  --next 2026-10-17T09:15:02.418Z --cursor-execution-id exec_01J9XK7M
```

**Corresponds to**: [`GET /v1/apis/{_id}/requests`](https://developer.celigo.com/api/api-reference/api-management/apis)

***

## `celigo apis execution-logs <apiId> <executionId>`

Print one request execution's log: the trace view with one record per step/stage event, recorded for runs logged in `detailed` or `debug` mode. The per-run layer under `request-history`, exactly as [`flows execution-logs <flowId> <jobId>`](https://developer.celigo.com/cli/commands/flows.md#celigo-flows-execution-logs) is the per-run layer under `jobs`. Get the `executionId` from `apis request-history`.

**Signature**

```bash
celigo apis execution-logs <apiId> <executionId> [--details]
```

**Arguments**

| Argument        | Type   | Required | Description                               |
| --------------- | ------ | -------- | ----------------------------------------- |
| `<apiId>`       | string | Yes      | API resource ID.                          |
| `<executionId>` | string | Yes      | Execution ID from `apis request-history`. |

**Flags**

| Flag        | Type    | Default | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ----------- | ------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--details` | boolean | `false` | Assemble the run's complete picture in one command. Each step record gains `data`, its decoded payload: the answer for the record's own `stage` or, for a record that names none (most do), one answer per stage its step runs, keyed by stage — `mapping`, `apiCall`, and `responseMapping` for an export or import; `schemaValidation` for a nested tool's input and output, `tool` and `responseMapping` for the nested tool step. The API's own request step and its responses get none. Records that fanned out gain `children` (first page only, each child with its own `data`), and payloads too large to inline gain a short-lived `downloadUrl` on their S3 reference. A failed sub-fetch is reported in place as `{"error": ...}` instead of failing the command. |

Since celigo-cli 2026.10.1, `--details` attaches each step's payloads: trace records rarely name a `stage`, and the command used to query only the records that did, so it attached none. At most eight detail requests run at once, each failure reported in place, and no children listing is requested under the API's own request or response step, which the platform refuses.

**Example**

```bash
celigo apis execution-logs 5f83a9b2c7d3e8f1a2b3c4d5 exec_01J9XK7M --details
```

**Corresponds to**: [`GET /v1/apis/{_id}/requests/{executionId}`](https://developer.celigo.com/api/api-reference/api-management/apis)

***

## `celigo apis delete-execution-logs <id>`

Queue deletion of stored API execution logs within an inclusive date range. Irreversible. Both bounds are required, and the end must not be in the future. Prompts for confirmation unless `-y` is passed.

Since celigo-cli 2026.11.2, the window is checked before the prompt and the request: each bound must be a timestamp, `--time-gte` must be earlier than `--time-lte` (equal bounds are refused), and `--time-lte` must not be in the future.

**Signature**

```bash
celigo apis delete-execution-logs <id> --time-gte <iso> --time-lte <iso> [-y]
```

**Arguments**

| Argument | Type   | Required | Description      |
| -------- | ------ | -------- | ---------------- |
| `<id>`   | string | Yes      | API resource ID. |

**Flags**

| Flag               | Type     | Default | Description                                                           |
| ------------------ | -------- | ------- | --------------------------------------------------------------------- |
| `--time-gte <iso>` | ISO 8601 | —       | **Required.** Start of the deletion window, inclusive.                |
| `--time-lte <iso>` | ISO 8601 | —       | **Required.** End of the deletion window (must not be in the future). |
| `-y, --yes`        | boolean  | `false` | Skip the confirmation prompt.                                         |

**Example**

```bash
celigo apis delete-execution-logs 5f83a9b2c7d3e8f1a2b3c4d5 \
  --time-gte 2026-07-01T00:00:00Z --time-lte 2026-07-31T23:59:59Z -y
```

**Corresponds to**: [`DELETE /v1/apis/{_id}/requests?startedAt=<iso>&endAt=<iso>`](https://developer.celigo.com/api/api-reference/api-management/apis) — the API names the range params `startedAt`/`endAt`; the flags keep the CLI-wide `--time-gte`/`--time-lte` names.

***

## `celigo apis clone <id>`

Clone a builder-mode API into a new API plus copied export/import resources. Returns an array of `{ model, _id }` tuples — not a single resource — so pipe through `--jq` to flatten.

Script-mode APIs are rejected with `Clone is only supported for builder-mode APIs.`

Since celigo-cli 2026.10.1:

* `--integration <id>` creates the clone inside that integration; without it the clone is standalone, even when the source API belongs to an integration.
* `--environment` sends the target environment as `envId`, the field the clone endpoint reads. It used to send `environmentId`, which the platform ignores, so the clone landed in the token's own environment.
* The platform creates the clone of a disabled API enabled, so the command says so on stderr and names the `set` that keeps it offline: `note: the source API is disabled, but the platform creates its clone enabled (disabled: false); celigo apis set <cloneId> disabled=true keeps it offline.`
* A clone is never resent after a timeout or a `5xx`, so a slow clone that landed is not created twice. Since celigo-cli 2026.11.1, it is not resent after a `429` either; earlier releases retried it.

Since celigo-cli 2026.11.2, a blank `--environment`, `--integration`, `--api-version`, or `--name` (an unset shell variable) is refused before any request. A blank `--environment` used to clone the API into the token's own environment, and a blank `--integration` used to create a standalone clone.

**Signature**

```bash
celigo apis clone <id> --api-version <version> [--name <name>] [--description <description>] [--integration <integrationId>] [--environment <environmentId>] [--dry-run]
```

**Arguments**

| Argument | Type   | Required | Description                 |
| -------- | ------ | -------- | --------------------------- |
| `<id>`   | string | Yes      | Source builder-mode API ID. |

**Flags**

| Flag                            | Type    | Default | Description                                                                                                                                                                             |
| ------------------------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--api-version <version>`       | string  | —       | **Required.** Version for the cloned API (e.g. `v2`).                                                                                                                                   |
| `--name <name>`                 | string  | —       | Name for the cloned API.                                                                                                                                                                |
| `--description <description>`   | string  | —       | Description for the cloned API.                                                                                                                                                         |
| `--integration <integrationId>` | string  | —       | Create the clone in this integration (sent as `_integrationId`). Without it the clone is standalone, even when the source API belongs to an integration. Added in celigo-cli 2026.10.1. |
| `--environment <environmentId>` | string  | —       | Clone into a target environment (sent as `envId`; before celigo-cli 2026.10.1 it was sent as `environmentId`, which the platform ignores).                                              |
| `--dry-run`                     | boolean | `false` | Check whether the target route is free and create nothing. Returns `{ canClone }`.                                                                                                      |

`--dry-run` validates that the combination of target version, method, and `relativeURI` is not already taken in this profile's environment. Use it before a real clone to catch a route conflict without leaving a partial API behind. The check takes no environment. Since celigo-cli 2026.11.2, `--dry-run` with `--environment` is refused before any request; earlier releases answered `canClone: true` even for an environment that does not exist.

**Example**

```bash
celigo apis clone 5f83a9b2c7d3e8f1a2b3c4d5 \
  --api-version v2 \
  --name "My API (v2)" \
  --jq '.[] | {model, id: ._id}'

# Check the route first
celigo apis clone 5f83a9b2c7d3e8f1a2b3c4d5 --api-version v2 --dry-run

# Into an integration in another environment
celigo apis clone 5f83a9b2c7d3e8f1a2b3c4d5 --api-version v2 \
  --integration 60a1b2c3d4e5f6a7b8c9d0e1 --environment 60a1b2c3d4e5f6a7b8c9d0e2
```

**Corresponds to**: `POST /v1/apis/{_id}/clone` (with `version`, `name`, `description`, `_integrationId`, and `envId` in the body), or [`POST /v1/apis/{_id}/clone/validate`](https://developer.celigo.com/api/api-reference/api-management/apis) with `--dry-run`.

***

## `celigo apis download <id>`

Download a builder-mode API as a template ZIP file. The archive holds the API plus every resource it references: imports, exports, connections, and scripts. Use it to version an API in git, or to hand it to another account.

The CLI requests the template, follows the signed URL, and writes the file locally.

Since celigo-cli 2026.10.1, an existing destination file is refused unless you pass `--force`, and so are a directory and a path whose directory does not exist — before the template is requested: `./templates/orders-api.zip already exists; refusing to overwrite it. Pass --force to replace it, or choose another destination.` A leading `~` in `-o` means your home directory, and the archive is staged in a temporary file beside the target and renamed into place, so a failure mid-write never leaves a truncated archive.

**Signature**

```bash
celigo apis download <id> [-o <path>] [--force]
```

**Arguments**

| Argument | Type   | Required | Description                                               |
| -------- | ------ | -------- | --------------------------------------------------------- |
| `<id>`   | string | Yes      | Builder-mode API ID. Script-mode APIs cannot be exported. |

**Flags**

| Flag                  | Type    | Default          | Description                                                                                                             |
| --------------------- | ------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------- |
| `-o, --output <path>` | string  | `<api-name>.zip` | Output file path. Without it, the CLI writes `<api-name>.zip` in the current directory, falling back to `api-<id>.zip`. |
| `--force`             | boolean | `false`          | Replace the destination file if it already exists. Added in celigo-cli 2026.10.1.                                       |

**Example**

```bash
celigo apis download 5f83a9b2c7d3e8f1a2b3c4d5

# A stable path for a git-tracked export
celigo apis download 5f83a9b2c7d3e8f1a2b3c4d5 -o ./templates/orders-api.zip
```

**Corresponds to**: [`GET /v1/apis/{_id}/template`](https://developer.celigo.com/api/api-reference/api-management/apis), which returns a short-lived signed URL. The CLI then downloads the archive from that URL.

***

## `celigo apis add-processor <id> <exportOrImportId>`

Add a page processor to a builder-mode API branch. Auto-detects whether the supplied ID is an export or an import. The CLI issues a `GET` on the API, mutates the branch's `pageProcessors[]`, and writes back with a full `PUT`.

Since celigo-cli 2026.10.1, the first step of an API with no router yet (a new API's `builder.routers` is empty) goes into a pass-through router — one branch, no routing — whose branch ends at the response router, as `tools add-processor` does for a tool. `add-processor` also says why it could not look the step up (a `401`, a `403`, the network) instead of calling the id invalid, never writes when that lookup did not succeed, and refuses a `--branch` name that two branches of the router share.

Since celigo-cli 2026.10.2, an API whose `builder.routers` holds a router with a `null` `script` is refused before the confirmation prompt, and nothing is sent. The command PUTs back the copy it read, so the refusal names the `set` to run first: `celigo apis set <id> 'builder.routers[<n>].script=null'`.

**Signature**

```bash
celigo apis add-processor <id> <exportOrImportId> [--router <routerId>] [--branch <branchName>] [-y]
```

**Arguments**

| Argument             | Type   | Required | Description                                     |
| -------------------- | ------ | -------- | ----------------------------------------------- |
| `<id>`               | string | Yes      | API resource ID (must be builder-mode).         |
| `<exportOrImportId>` | string | Yes      | Export or import ID to add as a page processor. |

**Flags**

| Flag                    | Type    | Default | Description               |
| ----------------------- | ------- | ------- | ------------------------- |
| `--router <routerId>`   | string  | —       | Target a specific router. |
| `--branch <branchName>` | string  | —       | Target a specific branch. |
| `-y`, `--yes`           | boolean | `false` | Skip confirmation prompt. |

**Example**

```bash
celigo apis add-processor 5f83a9b2c7d3e8f1a2b3c4d5 6a1b2c3d4e5f6a7b8c9d0e1f --router r1 -y
```

**Corresponds to**: [`PUT /v1/apis/{_id}`](https://developer.celigo.com/api/api-reference/api-management/apis#put-v1-apis-_id) (operationId: `updateApi`) — issued after an internal [`GET /v1/apis/{_id}`](https://developer.celigo.com/api/api-reference/api-management/apis#get-v1-apis-_id).

***

## `celigo apis remove-processor <id> <exportOrImportId>`

Remove a page processor from a builder-mode API branch by its export or import ID. GET → splice the processor → PUT. Since celigo-cli 2026.10.1, a step that sits in more than one branch is refused unless `--router` and `--branch` say which one (it used to be removed from the first); `--branch` alone removes it from the named branch, and `--router` alone finds the branch of that router that holds it.

Since celigo-cli 2026.10.2, an API whose `builder.routers` holds a router with a `null` `script` is refused before the confirmation prompt, as `add-processor` refuses it, and nothing is sent. Run the `set` the refusal names first: `celigo apis set <id> 'builder.routers[<n>].script=null'`.

**Signature**

```bash
celigo apis remove-processor <id> <exportOrImportId> [--router <routerId>] [--branch <branchName>] [-y]
```

**Arguments**

| Argument             | Type   | Required | Description                    |
| -------------------- | ------ | -------- | ------------------------------ |
| `<id>`               | string | Yes      | API resource ID.               |
| `<exportOrImportId>` | string | Yes      | Export or import ID to remove. |

**Flags**

| Flag                    | Type    | Default | Description               |
| ----------------------- | ------- | ------- | ------------------------- |
| `--router <routerId>`   | string  | —       | Target a specific router. |
| `--branch <branchName>` | string  | —       | Target a specific branch. |
| `-y`, `--yes`           | boolean | `false` | Skip confirmation prompt. |

**Example**

```bash
celigo apis remove-processor 5f83a9b2c7d3e8f1a2b3c4d5 6a1b2c3d4e5f6a7b8c9d0e1f -y
```

**Corresponds to**: [`PUT /v1/apis/{_id}`](https://developer.celigo.com/api/api-reference/api-management/apis#put-v1-apis-_id) (operationId: `updateApi`) — issued after an internal [`GET /v1/apis/{_id}`](https://developer.celigo.com/api/api-reference/api-management/apis#get-v1-apis-_id).

***

## `celigo apis set-group` / `unset-group`

Assign APIs to an API group, or remove them from their group. Mirrors `flows set-group`/`unset-group` — pass the API IDs as positional arguments; no stdin body. Requires `full` mode.

Since celigo-cli 2026.10.1, every id is checked first, and an id that names no API is refused before anything is sent — the platform skips an id it does not know and answers success, so the command used to report it as assigned: `No API has the id 5f8d43a1b9e5a80011a35f2e — nothing was sent: the platform skips an id it does not know and answers success anyway. List the ids with: celigo apis list`

**Signature**

```bash
celigo apis set-group <apiGroupingId> <apiIds...>
celigo apis unset-group <apiIds...>
```

**Arguments**

| Argument          | Type   | Required          | Description                          |
| ----------------- | ------ | ----------------- | ------------------------------------ |
| `<apiGroupingId>` | string | Yes (`set-group`) | The API group to assign the APIs to. |
| `<apiIds...>`     | string | Yes               | One or more API resource IDs.        |

**Example**

```bash
celigo apis set-group 60a1b2c3d4e5f60012345678 5f8d43a1b9e5a80011a35f2c 5f8d43a1b9e5a80011a35f2d
celigo apis unset-group 5f8d43a1b9e5a80011a35f2c
```

**Corresponds to**: one [`GET /v1/apis/{_id}`](https://developer.celigo.com/api/api-reference/api-management/apis) per id, then [`PUT /v1/apis/updateApiGrouping`](https://developer.celigo.com/api/api-reference/api-management/apis#put-v1-apis-updateapigrouping) (operationId: `updateApiGrouping`). `unset-group` sends `_apiGroupingId: null` to ungroup.

***

## `celigo apis test-run <id>`

Start a test run of an API and return stage-by-stage results, including metadata, `flowJob`, and `childJobs`. Requires `operate` mode.

Since celigo-cli 2026.10.1, `--file` supplies the test request: `{"mockRequest": {"body", "pathParams", "queryParams", "headers"}}`, sent with the run. A body that is not a JSON object is refused: `The test input must be a JSON object.`

Without `--file`, the run replays the API's saved `builder.request.mockRequest`, or starts from an empty record when the API has none. The CLI sends no `mockRequest` then (only `triggeredAt`, plus `_exportId` with `--export`). Pass another request to test with `--file`.

A test run saves each lookup step's response on its export as `mockOutput`. Later test runs answer that lookup from it, whatever their input, so a stale lookup result comes from the export, not the API. Remove the export's `mockOutput` to test against the live system again.

The reply holds counts only. A failed run's errors, each with its `code`, `message`, and `classification`, are in the step's results: read them with [`test-run-step-results <id> <flowJob._id> <childJobs[]._expOrImpId>`](#celigo-apis-test-run-step-results-less-than-id-greater-than-less-than-runid-greater-than-less-than-exportorimportid-greater-than). Since celigo-cli 2026.11.2, after a run with an error, a note on stderr names that command for each failed step that recorded a stage. A failed step that the metadata lists no stage for has no results to read: its step results answer `404`. For such a step, the note says to check the step's connection with [`connections ping`](https://developer.celigo.com/cli/commands/connections.md#celigo-connections-ping-less-than-id-greater-than). A run that comes back `canceled` with no error gets a note that says so.

**Signature**

```bash
celigo apis test-run <id> [--export <exportId>] [--file <path>]
```

**Arguments**

| Argument | Type   | Required | Description      |
| -------- | ------ | -------- | ---------------- |
| `<id>`   | string | Yes      | API resource ID. |

**Flags**

| Flag                  | Type   | Default | Description                                                                                                                                                         |
| --------------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--export <exportId>` | string | —       | Export ID (page generator). Sent as `_exportId` in the request body.                                                                                                |
| `-f, --file <path>`   | string | —       | Read the test input (JSON) from a file (`-` reads stdin): `{"mockRequest": {...}}`. Without it, the saved `mockRequest` is replayed. Added in celigo-cli 2026.10.1. |

**Example**

```bash
celigo apis test-run 5f83a9b2c7d3e8f1a2b3c4d5 --format json

# With a mock request
cat > mock-request.json <<'EOF'
{"mockRequest": {"body": {"orderId": "SO-1001"}, "pathParams": {}, "queryParams": {}, "headers": {}}}
EOF
celigo apis test-run 5f83a9b2c7d3e8f1a2b3c4d5 --file mock-request.json
```

**Corresponds to**: [`POST /v1/apis/{_id}/test/run`](https://developer.celigo.com/api/api-reference/api-management/apis) (internal to the CLI; not published in `api.yml`).

***

## `celigo apis test-run-step-results <id> <runId> <exportOrImportId>`

Get stage-by-stage results for a single step within a test run. `runId` and step IDs come from the `test-run` response. Base64-encoded responses are automatically decoded.

**Signature**

```bash
celigo apis test-run-step-results <id> <runId> <exportOrImportId>
```

**Arguments**

| Argument             | Type   | Required | Description                                     |
| -------------------- | ------ | -------- | ----------------------------------------------- |
| `<id>`               | string | Yes      | API resource ID.                                |
| `<runId>`            | string | Yes      | Test-run ID returned from `apis test-run`.      |
| `<exportOrImportId>` | string | Yes      | Step ID (export or import) within the test run. |

**Flags**

Uses [global flags](https://developer.celigo.com/cli/getting-started/global-flags.md) only.

**Example**

```bash
celigo apis test-run-step-results 5f83a9b2c7d3e8f1a2b3c4d5 run_01H9X... 6a1b2c3d4e5f6a7b8c9d0e1f
```

**Corresponds to**: [`GET /v1/apis/{_id}/test/run/{runId}/{exportOrImportId}`](https://developer.celigo.com/api/api-reference/api-management/apis) (internal to the CLI; not published in `api.yml`).

***

## `celigo apis test-run-step-logs <id> <runId> <exportOrImportId>`

List HTTP request/response logs for a single test-run step. Logs are only recorded for steps that issued outbound HTTP calls (exports, imports, lookups). Routers and stages that didn't make HTTP requests return `404 Not Found` by design; the CLI rewrites that error into a clearer message — since celigo-cli 2026.10.1 for every such `404`, whose message used to hide the code the rewrite looked for: `No request/response logs for step <exportOrImportId> in run <runId>. Logs are only recorded for steps that issued outbound HTTP calls. Check the test-run metadata for a step with a 'lookup' or 'request' stage.`

**Signature**

```bash
celigo apis test-run-step-logs <id> <runId> <exportOrImportId>
```

**Arguments**

| Argument             | Type   | Required | Description                                     |
| -------------------- | ------ | -------- | ----------------------------------------------- |
| `<id>`               | string | Yes      | API resource ID.                                |
| `<runId>`            | string | Yes      | Test-run ID from `apis test-run`.               |
| `<exportOrImportId>` | string | Yes      | Step ID (export or import) within the test run. |

**Flags**

Uses [global flags](https://developer.celigo.com/cli/getting-started/global-flags.md) only.

**Example**

```bash
celigo apis test-run-step-logs 5f83a9b2c7d3e8f1a2b3c4d5 run_01H9X... 6a1b2c3d4e5f6a7b8c9d0e1f
```

**Corresponds to**: [`GET /v1/apis/{_id}/test/run/{runId}/{exportOrImportId}/logs/requestAndResponse`](https://developer.celigo.com/api/api-reference/api-management/apis) (internal to the CLI; not published in `api.yml`).

***

## `celigo apis debug-requests <id> <exportOrImportId>`

List debug request log entries for a specific export or import invoked by the API. Requires `debugUntil` to be set on that step (use `exports set` or `imports set` to enable debug first).

JSON output is the API's envelope, unchanged. Since celigo-cli 2026.10.1, `--format table` lists one request per row — `key` (never cut, for `debug-request-detail`), `time`, `method`, `statusCode` — instead of the envelope in one cell, and `--since` must be a positive whole number of minutes (`0` and `abc` used to become 60, and a negative value a window in the future). The listing does not page.

**Signature**

```bash
celigo apis debug-requests <id> <exportOrImportId> [--since <minutes>]
```

**Arguments**

| Argument             | Type   | Required | Description                              |
| -------------------- | ------ | -------- | ---------------------------------------- |
| `<id>`               | string | Yes      | API resource ID.                         |
| `<exportOrImportId>` | string | Yes      | Export or import step ID inside the API. |

**Flags**

| Flag                | Type    | Default | Description                                                                |
| ------------------- | ------- | ------- | -------------------------------------------------------------------------- |
| `--since <minutes>` | integer | `60`    | Show requests from the last N minutes. Translated to `time_gt` (epoch ms). |

**Example**

```bash
celigo apis debug-requests 5f83a9b2c7d3e8f1a2b3c4d5 6a1b2c3d4e5f6a7b8c9d0e1f --since 15
```

**Corresponds to**: [`GET /v1/apis/{_id}/{exportOrImportId}/requests?time_gt=<epochMs>`](https://developer.celigo.com/api/api-reference/api-management/apis) (internal to the CLI; not published in `api.yml`).

***

## `celigo apis debug-request-detail <id> <exportOrImportId> <key>`

Fetch full request/response detail for one debug log entry. The `key` comes from `apis debug-requests`.

**Signature**

```bash
celigo apis debug-request-detail <id> <exportOrImportId> <key>
```

**Arguments**

| Argument             | Type   | Required | Description                                     |
| -------------------- | ------ | -------- | ----------------------------------------------- |
| `<id>`               | string | Yes      | API resource ID.                                |
| `<exportOrImportId>` | string | Yes      | Export or import step ID inside the API.        |
| `<key>`              | string | Yes      | Debug log entry key from `apis debug-requests`. |

**Flags**

Uses [global flags](https://developer.celigo.com/cli/getting-started/global-flags.md) only.

**Example**

```bash
celigo apis debug-request-detail 5f83a9b2c7d3e8f1a2b3c4d5 6a1b2c3d4e5f6a7b8c9d0e1f 01H9X...
```

**Corresponds to**: [`GET /v1/apis/{_id}/{exportOrImportId}/requests/{key}`](https://developer.celigo.com/api/api-reference/api-management/apis) (internal to the CLI; not published in `api.yml`).

***

## Gotchas

* **No `apis test` subcommand.** For end-to-end testing against a live inbound URL, `curl` the API's published endpoint directly. `test-run` is a synthetic, stage-by-stage test harness — not a real HTTP invocation.
* **`test-run` without `--file` replays the saved `mockRequest`.** The run replays the API's saved `builder.request.mockRequest`, or starts from an empty record when the API has none. Pass another request to test in `{"mockRequest": {...}}`.
* **`test-run` answers lookups from `mockOutput`.** A test run saves each lookup step's response on its export as `mockOutput`, and later test runs answer that lookup from it, whatever their input. Remove the export's `mockOutput` to test against the live system again.
* **`clone` only works on builder-mode APIs.** Script-mode APIs throw immediately. `--api-version` is required.
* **`clone` returns an array**, not a single resource. Pipe with `--jq '.[] | {model, id: ._id}'` to flatten.
* **`clone --dry-run` creates nothing.** It returns `{ canClone }` after checking the target version, method, and `relativeURI` for a conflict in this profile's environment. Run it first when scripting a clone, so a route collision fails before any resource is copied. Since celigo-cli 2026.11.2, it is refused with `--environment`: the check takes no environment.
* **A clone of a disabled API is enabled.** The platform creates the copy with `disabled: false`; since celigo-cli 2026.10.1 the command says so on stderr. Run `celigo apis set <cloneId> disabled=true` to keep it offline.
* **`download` covers builder-mode APIs only.** Script-mode APIs cannot be exported as a template. The archive includes referenced imports, exports, connections, and scripts, so it is a complete installable unit rather than the API document alone.
* **`add-processor` / `remove-processor` rewrite the whole API.** They do GET → mutate → PUT, so any concurrent edits made through the UI between those calls are clobbered.
* **A router with no script leaves the `script` key out.** The platform stores `"script": null` on a router in `builder.routers`, but Flow Builder crashes when it opens that router. Since celigo-cli 2026.10.2, `create`, `update`, `set`, `add-processor`, and `remove-processor` refuse an API that holds one, with no override. Repair an API that already holds one with `celigo apis set <id> 'builder.routers[<n>].script=null'`. [`celigo lint`](https://developer.celigo.com/cli/local-tree/lint-and-resolve.md#celigo-lint) reports one as an error, and [`celigo push`](https://developer.celigo.com/cli/local-tree/push.md) refuses one at plan time.
* **`test-run-step-logs` returns `404 Not Found` by design** for steps that didn't issue outbound HTTP calls (e.g., routers, pure transforms). The CLI rewrites the error, but the absence of logs is normal.
* **`debug-requests` requires `debugUntil`** to be set on the target export or import. Without it the endpoint returns an empty array, not an error.
* **A run's result prints its credentials as `********`.** Since celigo-cli 2026.11.1, `log-detail`, `execution-logs`, `test-run`, `test-run-step-results`, `test-run-step-logs`, and `debug-request-detail` mask the value of each credential header, and a captured URL's userinfo and credential query parameters. `get` prints the API as stored. Since celigo-cli 2026.11.2, the credential parameters of a captured request's parsed `queryParams` are masked too, and `request-history` masks the credentials in a run's `relativeURI`. See [Credentials in a run's result](https://developer.celigo.com/cli/using-the-cli/output-formats.md#credentials-in-a-runs-result).
* **`logs` (inbound) and `debug-requests` (outbound) are different surfaces.** `logs` captures callers hitting the API; `debug-requests` captures the API's own outbound calls to exports/imports.
* **`request-history` only shows logged runs.** An entry is recorded per inbound request only while `logging.mode` is anything other than `noLogging`, and the per-step trace that `execution-logs` prints is recorded only for `detailed`/`debug` runs. Turn logging on first: `celigo apis set <id> logging.mode=detailed`.
* **A full PUT cannot change `logging`.** The server silently ignores `logging` edits on `update` — the mode revert-persists as `basic` without an error. Use `apis set`, which routes `logging.mode`, `logging.debugUntil`, and `traceKeyTemplate` through an atomic PATCH.
* **Permission modes.** `test-run` and `delete-execution-logs` run in `operate` mode; since celigo-cli 2026.10.1 `read` mode refuses them before any request. `clone`, `add-processor`, `remove-processor`, `replace-connection`, `set-group`, and `unset-group` need `full` mode, as do `create`, `update`, and `delete`. See [Profiles & regions](https://developer.celigo.com/cli/getting-started/profiles.md#permission-modes).

### When to use a Celigo API vs. a Flow

| Concern                                        | Flow    | API                     |
| ---------------------------------------------- | ------- | ----------------------- |
| Caller needs an immediate response             | No      | **Yes**                 |
| Work can be async (queue for batch processing) | **Yes** | No                      |
| Caller can't authenticate to the target        | No      | **Yes** (proxy pattern) |
| High-volume, throughput-focused batch          | **Yes** | No                      |

## Related

* [flows](https://developer.celigo.com/cli/commands/flows.md) — async, scheduled pipelines; the counterpart to synchronous APIs.
* [tools](https://developer.celigo.com/cli/commands/tools.md) — APIs often orchestrate tools under the hood.
* [mcp-servers](https://developer.celigo.com/cli/commands/mcp-servers.md) — builder-mode APIs can be exposed as MCP endpoints.
* [connections](https://developer.celigo.com/cli/commands/connections.md) — `apis connections` lists the ones a builder-mode API's steps use; `replace-connection` repoints them.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developer.celigo.com/cli/commands/apis.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
