> For the complete documentation index, see [llms.txt](https://docs.moderncollections.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.moderncollections.io/getting-started/environments.md).

# Environments

Modern Collections exposes two environments to integrators.

## Base URLs

All API routes are versioned under `/v1`. Append `/v1` to the base URL to reach the API itself (`https://api.moderncollections.io/v1/placements`, etc.).

| Environment | Base URL                                | API root (`+ /v1`)                         | Notes                                                                   |
| ----------- | --------------------------------------- | ------------------------------------------ | ----------------------------------------------------------------------- |
| `prod`      | `https://api.moderncollections.io`      | `https://api.moderncollections.io/v1`      | Live API — real outreach, real money movement.                          |
| `demo`      | `https://app.demo.moderncollections.io` | `https://app.demo.moderncollections.io/v1` | Hosted demo environment with non-production data. See the caveat below. |

{% hint style="warning" %}
**Demo `/health` caveat.** On `demo`, the bare host (`https://app.demo.moderncollections.io`, including `/health`) is the **dashboard origin**, *not* the API. Authenticated `/v1/*` calls reach the API normally — point your reachability checks at a `/v1/*` route instead of `/health`.
{% endhint %}

### Selecting an environment with the `mc-api` client

The first-party Python client ships a typed `MCClient`, a `mc-api` CLI, and a `mc-api-mcp` MCP stdio server. All three read the target from the environment: set **`MC_API_ENV`** to `demo` or `prod`, or set **`MC_API_BASE_URL`** to override with an explicit URL. There is **no production default** — a target must be selected explicitly, so a forgotten flag can never silently aim a test key at production. The CLI also accepts `--env` / `--base-url` as global options (which precede the subcommand). See [the `mc-api` CLI reference](/sdks/cli.md) for the full reference.

## Switching environments

The base URL is the only thing that changes for your client code. Make it configurable:

{% tabs %}
{% tab title="Python" %}

```python
import os, httpx

BASE = os.environ["MC_API_BASE"]   # set per-deployment
KEY = os.environ["MC_API_KEY"]

client = httpx.Client(base_url=BASE, headers={"Authorization": f"Bearer {KEY}"})
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const BASE = process.env.MC_API_BASE;
const KEY = process.env.MC_API_KEY;
```

{% endtab %}

{% tab title="Shell" %}

```bash
export MC_API_BASE="https://api.moderncollections.io/v1"
export MC_API_KEY="ca_a3f8c0d1_..."
```

{% endtab %}
{% endtabs %}

Or, with the first-party `mc-api` client, select the environment by name instead of hand-assembling the URL:

{% tabs %}
{% tab title="CLI" %}

```bash
export MC_API_ENV=prod             # demo | prod
export MC_API_KEY="ca_a3f8c0d1_..."
mc-api health
mc-api placements list --status in_outreach
```

{% endtab %}

{% tab title="MCP" %}

```bash
# mc-api-mcp reads the same env vars (never from arguments, so the key
# stays out of MCP client config that may be logged):
export MC_API_ENV=demo
export MC_API_KEY="ca_a3f8c0d1_..."
mc-api-mcp                          # MCP stdio server
```

{% endtab %}
{% endtabs %}

## API keys are per-environment

Keys issued for one environment do not work in the other. Webhook signing secrets are also issued per environment — never share secrets across environments. See [Signature verification](/webhooks/signature-verification.md).

## See also

* [Authentication](/getting-started/authentication.md) — key issuance.
* [Your first API call](/getting-started/first-api-call.md).
* [Error handling](/getting-started/error-handling.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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.moderncollections.io/getting-started/environments.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
