> 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/reference-pages/discovery.md).

# Discovery

Discovery endpoints describe what is available in your tenant. They are the recommended entry points for AI agents and integrations.

* [`GET /api/v1/openapi.json`](#get-apiv1openapijson)
* [`GET /api/v1/manifest`](#get-apiv1manifest)
* [`GET /api/v1/catalog`](#get-apiv1catalog)
* [`GET /api/v1/capabilities`](#get-apiv1capabilities)

***

## `GET /api/v1/openapi.json`

Return the OpenAPI 3.1 spec for `/api/v1`. **Unauthenticated.**

A second alias serves the same payload at `GET /.well-known/agent-tools.json`.

### Response

```json
{ "openapi": "3.1.0", "info": { "title": "Peak Commerce Agent API v1", ... }, "paths": { ... } }
```

### cURL

```bash
curl https://api.example.com/api/v1/openapi.json
```

***

## `GET /api/v1/manifest`

Return a tenant-level capability manifest: every operation the API supports, every published payment page, and the tenant's enabled capabilities (payment methods, currencies, billing integrations, catalog sizes).

* **Auth scope:** `read`
* **Path params:** none
* **Query params:** none
* **Request body:** none

### Response `200`

```json
{
  "version": "1.0",
  "generatedAt": "2026-05-02T14:00:00Z",
  "operations": [
    {
      "operationId": "createOrder",
      "method": "POST",
      "path": "/api/v1/orders",
      "scope": "commerce",
      "description": "Create order"
    }
  ],
  "paymentPages": [
    {
      "id": "pg_01H...",
      "name": "Default Checkout",
      "slug": "checkout",
      "paymentMethods": ["card", "ach"],
      "commerceManifest": { "status": "published" }
    }
  ],
  "capabilities": {
    "paymentMethods": ["card", "ach"],
    "supportedCurrencies": ["USD"],
    "integrations": [
      { "type": "stripe", "name": "Production", "isActive": true }
    ],
    "catalogStats": { "products": 12, "offers": 3 },
    "merchantPaymentCapabilities": ["card", "ach"]
  },
  "nextActions": [
    { "rel": "catalog", "method": "GET", "href": "/api/v1/catalog" },
    { "rel": "capabilities", "method": "GET", "href": "/api/v1/capabilities" }
  ]
}
```

### Errors

| Status | When                       |
| ------ | -------------------------- |
| `401`  | Missing or invalid API key |
| `403`  | Key lacks the `read` scope |
| `500`  | Server error               |

### cURL

```bash
curl -H "Authorization: Bearer $PEAK_API_KEY" \
  https://api.example.com/api/v1/manifest
```

***

## `GET /api/v1/catalog`

Return the catalog: every product enriched with its lifecycle business rules (upgrade, downgrade, cancellation, add-on) and pricing-rule indicators, plus a summary of every payment page.

* **Auth scope:** `read`

### Response `200`

```json
{
  "data": {
    "products": [
      {
        "id": "prod_01H...",
        "name": "Pro Plan",
        "sku": "PRO",
        "description": "Everything plus seats and integrations.",
        "category": "subscription",
        "productType": "plan",
        "priceCents": 4900,
        "currency": "USD",
        "billingInterval": "month",
        "isActive": true,
        "lifecycleRules": {
          "upgrade":      { "ruleId": "br_...", "ruleName": "Default upgrade", "changeTiming": "immediate", "prorationType": "prorated" },
          "downgrade":    { "ruleId": "br_...", "ruleName": "Default downgrade", "changeTiming": "at_period_end", "prorationType": "none" },
          "cancellation": null,
          "addOn":        null
        },
        "pricingRules": { "hasDynamicPricing": true, "pricingTierCount": 3 }
      }
    ],
    "paymentPages": [
      {
        "id": "pg_01H...",
        "name": "Default Checkout",
        "slug": "checkout",
        "companyName": "Acme Inc.",
        "paymentMethods": ["card", "ach"]
      }
    ]
  },
  "nextActions": [
    { "rel": "capabilities", "method": "GET", "href": "/api/v1/capabilities" },
    { "rel": "manifest", "method": "GET", "href": "/api/v1/manifest" },
    { "rel": "createPaymentSession", "method": "POST", "href": "/api/v1/payments" }
  ]
}
```

### cURL

```bash
curl -H "Authorization: Bearer $PEAK_API_KEY" \
  https://api.example.com/api/v1/catalog
```

***

## `GET /api/v1/capabilities`

Return merchant capabilities: enabled payment methods, supported currencies, the available action set, and active billing integrations.

* **Auth scope:** `read`

### Response `200`

```json
{
  "paymentMethods": ["card", "ach"],
  "supportedCurrencies": ["USD"],
  "availableActions": [
    "list_catalog", "get_capabilities", "get_manifest",
    "create_account", "get_account", "update_account",
    "list_invoices", "pay_invoice",
    "create_subscription", "change_plan", "cancel_subscription", "renew_subscription",
    "create_order", "update_order",
    "create_payment_session", "complete_payment_session",
    "list_payment_methods", "add_payment_method", "set_default_payment_method",
    "list_webhooks", "create_webhook", "update_webhook", "delete_webhook"
  ],
  "integrations": [
    { "type": "stripe", "name": "Production", "isActive": true }
  ],
  "nextActions": [
    { "rel": "capabilities", "method": "GET", "href": "/api/v1/capabilities" },
    { "rel": "manifest", "method": "GET", "href": "/api/v1/manifest" },
    { "rel": "createPaymentSession", "method": "POST", "href": "/api/v1/payments" }
  ]
}
```

### cURL

```bash
curl -H "Authorization: Bearer $PEAK_API_KEY" \
  https://api.example.com/api/v1/capabilities
```

***

## Related

* [Accounts](/developers/reference-pages/accounts.md)
* [Pricing previews](/developers/reference-pages/pricing-previews.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/reference-pages/discovery.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.
