> 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](/developers/api-reference/authentication.md)), so the same base URL serves every tenant.

| Environment    | Purpose                               | Base URL                                  |
| -------------- | ------------------------------------- | ----------------------------------------- |
| **Production** | Live customers and real transactions  | `https://peakcommerce.app/api/v1`         |
| **Sandbox**    | Integration testing, never real money | `https://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.com/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](/developers/api-reference/authentication.md)
* [Errors](/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 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.peakcommerce.com/developers/api-reference/base-url.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.
