> For the complete documentation index, see [llms.txt](https://docs.peakcommerce.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.peakcommerce.com/developers/api-reference/base-url.md).

# Base URL & environments

## Base URL

The PeakCommerce Agent API is mounted at `/api/v1`. The tenant a request operates on is determined by your API key (see [Authentication](https://docs.peakcommerce.com/developers/api-reference/authentication.md)), so the same base URL serves every tenant.

| Environment    | Purpose                               | Base URL                                      |
| -------------- | ------------------------------------- | --------------------------------------------- |
| **Production** | Live customers and real transactions  | `https://api.peakcommerce.app/api/v1`         |
| **Sandbox**    | Integration testing, never real money | `https://api.sandbox.peakcommerce.app/api/v1` |

API keys are environment-specific — a sandbox key cannot call production and vice versa.

## OpenAPI specification

The machine-readable spec is published at:

* `https://api.peakcommerce.app/api/v1/openapi.json` — canonical spec URL
* `GET /api/v1/openapi.json` on either environment — the same spec
* `GET /.well-known/agent-tools.json` — the same spec, exposed for AI-agent discovery

These endpoints are unauthenticated and allow cross-origin `GET`, so documentation tools and AI agents can load them directly.

## Versioning

`/api/v1` is the first stable, public version. Breaking changes will ship under `/api/v2` — not by silently changing `v1`. Additive, non-breaking changes (new fields, new endpoints, new optional params, new event types) ship continuously into `v1`.

## Content type

Always send `Content-Type: application/json` on requests with a body. All responses are `application/json`.

## CORS

The spec endpoints above allow cross-origin `GET`. The data endpoints (`/api/v1/*`) are designed for server-to-server use; if you need browser access, proxy through your own backend.

## Related

* [Authentication](https://docs.peakcommerce.com/developers/api-reference/authentication.md)
* [Errors](https://docs.peakcommerce.com/developers/api-reference/errors.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.peakcommerce.com/developers/api-reference/base-url.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.
