> ## Documentation Index
> Fetch the complete documentation index at: https://docs.thinkplatform.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Choose User guide for browser tasks, Developers for CLI, SDK and external agents, and Administration for organization management.
> Confirm identity and organization/project context before operations. Documentation access does not grant ThinkPlatform permissions.
> Review side effects, verify changes with a read, and do not blindly retry an operation with an uncertain outcome.
> Use documented UI steps for the web app and documented public CLI or SDK interfaces for automation. Follow each page’s prerequisites and authentication requirements.

# Discover and call an API operation

> Use the deployed OpenAPI schema to resolve a request before sending it.

Complete [installation](https://docs.thinkplatform.ai/cli/get-started/installation.md), [authentication](https://docs.thinkplatform.ai/cli/get-started/authentication.md), and [context selection](https://docs.thinkplatform.ai/cli/guides/context.md). API discovery reads the OpenAPI schema from your configured service, so it requires connectivity and may require authentication.

## Find the operation

```bash theme={"system"}
tp api operations
```

The result is an array of operation records. Add `--path-contains /jobs` to narrow the list, or `--fields operation_id,method,path,request_body_required` for a compact view. `--limit` and `--offset` slice the fetched records locally. Choose the exact `operation_id` from your deployment and inspect it before calling it. The following example uses `get_job`. Use that operation ID only if discovery returns it for your service; otherwise, substitute the operation ID and parameters shown by your service.

```bash theme={"system"}
tp api show get_job
```

The description includes `method`, `path`, `parameters` with their `in` and `required` fields, and `request_body_required`. The example below assumes a job read with a `job_id` path parameter and a required `org_id` query parameter.

## Resolve, then call

Replace `job-example` with a job ID obtained from your project. Supply every required path and query parameter. Organization/project parameters can be filled from effective CLI context when the operation defines them.

```bash theme={"system"}
tp api call get_job --path-param job_id=job-example --dry-run
```

Review the method, destination, query, and body. The CLI resolves the request against OpenAPI, but a preview is not a guarantee that the server will accept the payload. `--dry-run` still fetches the schema. Once the request is correct, perform the read:

```bash theme={"system"}
tp api call get_job --path-param job_id=job-example
```

The result is the backend response, not a universal CLI envelope. Confirm it describes your intended job. For operations requiring JSON, `--body` accepts a JSON string or `@request.json`; inspect the deployed schema for its required structure first. Missing required parameters or required bodies produce an error before the target request is sent.

> [accordion] Optional machine-readable request preview
>
> Add global `--json` when you need to capture or parse the preview:
>
> ```bash theme={"system"}
> tp --json api call get_job --path-param job_id=job-example --dry-run
> ```
>
> Example output:
>
> ```json theme={"system"}
> {"ok":true,"dry_run":true,"method":"GET","path":"/api/mlops/jobs/job-example","params":{"org_id":"ORG_ID_FROM_CONTEXT"},"body":null}
> ```

Authenticated CLI API and raw requests accept relative paths or absolute URLs only when the URL's HTTP(S) origin exactly matches the configured API origin (scheme, normalized host, and effective port). Explicitly configured HTTP deployments remain supported, but an HTTPS API cannot be downgraded per request. Invalid or ambiguous URLs and origin mismatches are rejected before credentials are acquired. Redirects are not followed.

## Keep the two query options distinct

```bash theme={"system"}
tp --json --query status api call get_job --path-param job_id=job-example
```

Before `api`, global `--query status` selects a field from the response. After `call`, command-local `--query name=value` adds an HTTP query parameter; use this to supply HTTP query values explicitly. Organization and project values can otherwise come from saved context when the operation defines them. The output selector supports field paths and list indices, not JMESPath filters or expressions. Only select `status` after verifying that field exists in the full response.

If discovery finds no match, broaden the path filter and inspect the available operation IDs. If a write times out, inspect server state before retrying; request previews do not make writes idempotent. See the [command reference](https://docs.thinkplatform.ai/cli/reference/commands.md), [SDK overview](https://docs.thinkplatform.ai/python-sdk/overview.md), and [SDK errors](https://docs.thinkplatform.ai/python-sdk/errors.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.