> ## 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.

# Get Gateway Status

> Returns Circle Gateway client status, the per-network enablement map, and the upstream `getSupported()` payload from Circle. Useful to confirm Gateway connectivity from your environment.

Diagnostic endpoint that reports the facilitator's Circle Gateway client status, the per-network enablement map, and the upstream `getSupported()` payload from Circle's Gateway API. Use it to confirm Gateway connectivity and check which networks are currently routable through the batched path before integrating.

## Authentication

Requires `Authorization: Bearer <api-key>`. The endpoint requires `req.auth.organization.id` to be present after the `apiSession` middleware runs; otherwise it returns HTTP 401.

## Response

The literal response body returned by the facilitator:

```json theme={"system"}
{
  "success": true,
  "data": {
    "message": "Circle Gateway batched nanopayments integration",
    "organization": "Acme",
    "organizationId": "org_123",
    "gatewayMainnetEnabled": true,
    "networkStatus": {
      "arc-testnet": true,
      "base-sepolia": true,
      "optimism-sepolia": true,
      "fluent-testnet": true,
      "base": true,
      "optimism": true,
      "polygon": true,
      "unichain": true,
      "ink": true,
      "hyperevm": true,
      "megaeth": true
    },
    "gatewaySupported": {
      "...": "Pass-through of Circle Gateway's /supported response, or null if the upstream call failed"
    },
    "endpoints": {
      "batchedVerify": "POST /v1/batched-verify",
      "batchedSettle": "POST /v1/batched-settle",
      "batchedSample": "GET /v1/batched-sample"
    },
    "usage": {
      "description": "Use /v1/batched-settle and /v1/batched-verify as opt-in alternatives to /v1/settle and /v1/verify. The batched endpoints route payments through Circle Gateway for gas-free batched settlement. The default /v1/settle and /v1/verify endpoints continue to settle directly on-chain.",
      "note": "Circle recommends using settle() directly rather than verify() + settle() for production batched flows."
    },
    "timestamp": "2026-04-30T18:24:11.502Z"
  }
}
```

<Warning>
  The `endpoints.batchedVerify` and `endpoints.batchedSettle` strings (`POST
      /v1/batched-verify` / `POST /v1/batched-settle`) and the `usage.description`
  text are returned verbatim by the facilitator but are misleading: those URLs
  do **not** exist as distinct routes. Batched payments are routed through the
  regular `POST /v1/verify` and `POST /v1/settle` endpoints, with detection
  driven by `paymentRequirements.extra.name === "GatewayWalletBatched"`.
</Warning>

### Field reference

| Field                   | Description                                                                                                                                                                 |
| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `message`               | Constant `"Circle Gateway batched nanopayments integration"`.                                                                                                               |
| `organization`          | Organization name resolved from the API key, or `"Unknown"` if not set.                                                                                                     |
| `organizationId`        | Organization ID resolved from the API key.                                                                                                                                  |
| `gatewayMainnetEnabled` | Mirrors the `GATEWAY_MAINNET_ENABLED` constant in `apps/facilitator/src/gateway/index.ts`. When `false`, only testnets route through Circle.                                |
| `networkStatus`         | Boolean per network: result of `isGatewayEnabledForNetwork(name)`. Only the ten networks shown above are reported.                                                          |
| `gatewaySupported`      | Pass-through of Circle Gateway's upstream `getSupported()` response, or `null` if the call to Circle threw. Internally uses the **mainnet** Circle client (no network arg). |
| `endpoints`             | Static map of names → strings as returned by the facilitator (see warning above for accuracy).                                                                              |
| `usage.description`     | Static descriptive string returned by the facilitator (see warning above).                                                                                                  |
| `usage.note`            | Constant: Circle recommends calling `settle()` directly for production batched flows.                                                                                       |
| `timestamp`             | ISO timestamp generated when the response is built.                                                                                                                         |

## Errors

### 401 Unauthorized

Returned when the request has no organization context after `apiSession`:

```json theme={"system"}
{
  "error": "No organization found for this request"
}
```

### 500 Internal Server Error

Returned when the route handler throws (Circle unreachable for reasons other than the wrapped `getSupported()` call, etc.):

```json theme={"system"}
{
  "error": "Internal server error",
  "message": "<error.message or 'Unknown error'>"
}
```


## OpenAPI

````yaml GET /v1/batched-sample
openapi: 3.1.0
info:
  title: Meridian Protocol API
  description: API for x402 payments
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.mrdn.finance
    description: Production server
security:
  - cookieAuth: []
  - apiKeyAuth: []
paths:
  /v1/batched-sample:
    get:
      summary: Get Nanopayments Gateway status
      description: >-
        Returns Circle Gateway client status, the per-network enablement map,
        and the upstream `getSupported()` payload from Circle. Useful to confirm
        Gateway connectivity from your environment.
      responses:
        '200':
          description: Gateway status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchedSampleResponse'
        '401':
          description: Missing or invalid API key
        '500':
          description: Internal server error
      security:
        - apiKeyAuth: []
components:
  schemas:
    BatchedSampleResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        data:
          type: object
          properties:
            message:
              type: string
              example: Circle Gateway batched nanopayments integration
            organization:
              type: string
            organizationId:
              type: string
            gatewayMainnetEnabled:
              type: boolean
              example: true
            networkStatus:
              type: object
              additionalProperties:
                type: boolean
              description: >-
                Map of internal network name to whether Gateway batching is
                enabled.
              example:
                base-sepolia: true
                optimism-sepolia: true
                base: true
                optimism: true
                polygon: true
                unichain: true
                ink: true
                hyperevm: true
                megaeth: true
            gatewaySupported:
              type: object
              description: Pass-through `/supported` payload from the Circle Gateway API.
            endpoints:
              type: object
              description: >-
                Static labels returned verbatim by the facilitator. Note: the
                strings reference `/v1/batched-verify` and `/v1/batched-settle`,
                but those URLs do not exist as distinct routes; batched routing
                happens on the regular `/v1/verify` and `/v1/settle` endpoints.
              properties:
                batchedVerify:
                  type: string
                  example: POST /v1/batched-verify
                batchedSettle:
                  type: string
                  example: POST /v1/batched-settle
                batchedSample:
                  type: string
                  example: GET /v1/batched-sample
            usage:
              type: object
              properties:
                description:
                  type: string
                note:
                  type: string
            timestamp:
              type: string
              format: date-time
  securitySchemes:
    cookieAuth:
      type: apiKey
      in: cookie
      name: siwe-session
    apiKeyAuth:
      type: apiKey
      in: header
      name: Authorization

````