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

# Authentication

The CLI reads the same environment the SDKs do. Export your control-plane URL and an API key (`orc_…`, minted in the console under **Access → API keys** or with `orchard key add`):

```bash
export ORCHARD_API_URL="https://orchard.example.com"
export ORCHARD_API_KEY="orc_live_xxx"
```

| Variable          | Flag      | Meaning                                                      |
| ----------------- | --------- | ------------------------------------------------------------ |
| `ORCHARD_API_URL` | `--url`   | Control-plane URL. (`ORCHARD_URL` is a legacy alias.)        |
| `ORCHARD_API_KEY` | `--token` | API key (`orc_…`) or a JWT access token.                     |
| `ORCHARD_ORG`     | `--org`   | Organization slug (ignored for API keys, they're org-bound). |
| `ORCHARD_WS`      | `--ws`    | Workspace slug.                                              |

A flag overrides the matching variable, so you can target another control plane for a single call:

```bash
orchard --url https://staging.orchard.example.com --token orc_staging sandbox list
```

Add `--json` to any command for scriptable output:

```bash
orchard --json sandbox list | jq '.[].name'
```

For CI and shared use, prefer a [scoped key](/cli/access/keys.md) limited to the sandboxes and capabilities that job needs.

Next: [sandbox](/cli/managing-sandboxes/sandbox.md).


---

# 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://docs.orchard.airoverflow.com/cli/auth.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.
