> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anyway.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# API Introduction

> Getting started with the Anyway Merchant API

## Overview

Programmatic access to your merchant account.

**Base URL:**

```
https://merchant-api-prod.anyway.sh
```

## Authentication

Merchant API requests are authenticated with a **Payment API Key** (format: `ak_<base64>`), sent in the `X-API-Key` header.

### Getting a Payment API Key

1. Log in to your [Dashboard](https://app.anyway.sh)
2. Go to **Settings** > **API Keys** > **Payment API Keys**
3. Click **Create New Key**
4. Copy your key (it won't be shown again)

### Using the Payment API Key

```bash theme={null}
curl https://merchant-api-prod.anyway.sh/v1/orders \
  -H "X-API-Key: ak_YOUR_API_KEY"
```

<Warning>
  Keep your API keys secure. Never expose them in client-side code or public repositories.
</Warning>

## Response Envelope

All responses use a consistent envelope:

```json theme={null}
{
  "success": true,
  "message": "Orders retrieved",
  "data": { ... }
}
```

Error responses use the same envelope with `success: false` and an additional `error` object:

```json theme={null}
{
  "success": false,
  "message": "Unauthorized",
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Unauthorized"
  }
}
```

Common status codes:

| Status | Description                                                    |
| ------ | -------------------------------------------------------------- |
| `401`  | API key missing or invalid.                                    |
| `404`  | Resource does not exist or is not scoped to your organization. |
| `500`  | Server-side error.                                             |

## API Endpoints

<CardGroup cols={2}>
  <Card title="Orders" icon="receipt" href="/api-reference/endpoint/orders">
    List and read merchant orders
  </Card>

  <Card title="Products" icon="box" href="/api-reference/endpoint/products">
    List and read merchant products
  </Card>
</CardGroup>
