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

# Overview

> Complete API documentation for Meridian x402 payments

Welcome to the Meridian API documentation. This guide covers all endpoints for x402 payments, facilitator-backed settlement, and related organization features.

## Base URL

All API requests are made to the following base URL:

```
https://api.mrdn.finance/v1
```

## Authentication

Meridian Protocol supports API key authentication for server-to-server & client-to-server integrations:

```bash theme={"system"}
curl -X POST https://api.mrdn.finance/v1/settle \
  -H "Authorization: Bearer pk_..." \
  -H "Content-Type: application/json" \
  -d '{
    "paymentPayload": { "...": "..." },
    "paymentRequirements": { "...": "..." }
  }'
```

## Core Endpoints

### x402 Payments

<Warning>
  `POST /v1/verify` is deprecated and should only be used by existing legacy
  integrations.
</Warning>

<CardGroup cols={2}>
  <Card title="Verify Payment (Deprecated)" icon="check">
    `POST /v1/verify` - Legacy x402 payment verification endpoint
  </Card>

  <Card title="Settle Payment" icon="dollar-sign">
    `POST /v1/settle` - Settle verified payment
  </Card>

  <Card title="Execute ERC-20 Permit" icon="signature">
    `POST /v1/permit` - Execute an ERC-2612 permit-backed token transfer
  </Card>

  <Card title="Supported Networks" icon="globe">
    `GET /v1/supported` - Get supported payment types
  </Card>
</CardGroup>

## Error Handling

All endpoints return consistent error responses with the HTTP status code mirrored in the body:

```json theme={"system"}
{
  "type": "api_error",
  "code": 401,
  "message": "You are not authorized to access this resource."
}
```

### Common Error Codes

* `400 Bad Request` - The request is unacceptable
* `401 Not Authorized` - Missing or invalid authentication
* `403 Forbidden` - You do not have permission to perform the request
* `404 Not Found` - This object was not found
* `409 Conflict` - There was an issue adding or updating this resource

## Examples

### Node.js (Backend)

```javascript theme={"system"}
const response = await fetch("https://api.mrdn.finance/v1/settle", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: `Bearer ${process.env.MERIDIAN_API_KEY}`,
  },
  body: JSON.stringify({
    paymentPayload: {
      /* ... */
    },
    paymentRequirements: {
      /* ... */
    },
  }),
});
```

## Webhooks (Coming Soon)

Meridian supports webhooks for payment events:

* `payment.verified` - Payment successfully verified
* `payment.failed` - Payment verification failed
* `payment.settled` - Payment successfully settled

Configure webhooks in your developer dashboard or via API.
