An investment in knowledge pays the best interest.
Benjamin Franklin

Health

Health APIs#

Service health check endpoint.

Overview#

  • Base URL:
    markup
    https://api.pay.ledger1.ai/portalpay
  • Authentication: Public. No subscription key is required for this endpoint.
  • Gateway posture: APIM custom domain is the primary endpoint. Azure Front Door (AFD) may be configured as an optional/fallback edge; if enabled, APIM accepts an internal
    markup
    x-edge-secret
    per policy.
  • Rate limiting headers (if enabled):
    markup
    X-RateLimit-Limit
    ,
    markup
    X-RateLimit-Remaining
    ,
    markup
    X-RateLimit-Reset
See authentication and security details in
markup
../auth.md
. For OpenAPI schema details, refer to
markup
../../public/openapi.yaml
.

GET /portalpay/healthz#

Returns the health status of the service and dependencies.

Request#

Examples:

const res = await fetch('https://api.pay.ledger1.ai/portalpay/healthz');
const data = await res.json();
GET/portalpay/healthz

Try It: Healthz

Check service health status. No subscription key required.

Default is the APIM custom domain. For AFD, enter only the AFD endpoint host (e.g., https://afd-endpoint-pay-...) without any path; the /portalpay prefix is added automatically for /api/* and /healthz.

The key is kept only in memory while this page is open. Do not paste secrets on shared machines.

For public reads (GET /api/inventory, GET /api/shop/config), include the merchant wallet (0x-prefixed 40-hex). Non-GET requests should use JWT and will ignore this header.

Using server-side proxy to avoid CORS. Requests go through /api/tryit-proxy to AFD/APIM.
cURL
curl -X GET "https://api.pay.ledger1.ai/portalpay/healthz"
Response Status
Response Headers
Response Body

Response#

Success (200 OK):

json
{
  "ok": true,
  "status": "healthy",
  "time": 1698765432000,
  "dependencies": {
    "apim": "ok",
    "backend": "ok",
    "database": "ok"
  }
}

Degraded/Unavailable (503 Service Unavailable):

json
{
  "ok": false,
  "status": "degraded",
  "time": 1698765432000,
  "dependencies": {
    "apim": "ok",
    "backend": "ok",
    "database": "degraded"
  },
  "reason": "cosmos_unavailable"
}

If rate limiting is enabled, the following headers may be present:

  • markup
    X-RateLimit-Limit
  • markup
    X-RateLimit-Remaining
  • markup
    X-RateLimit-Reset

Error Responses#

403 Forbidden (origin enforcement)

json
{ "error": "forbidden", "message": "Origin enforcement failed" }

429 Too Many Requests

json
{ "error": "rate_limited", "resetAt": 1698765432000 }

503 Service Unavailable

json
{ "error": "unavailable", "message": "Service not healthy" }

Code Examples#

JavaScript/TypeScript#

typescript
const BASE_URL = 'https://api.pay.ledger1.ai/portalpay';

export async function getHealth() {
  const res = await fetch(`${BASE_URL}/healthz`);
  return res.json() as Promise<{
    ok: boolean;
    status: string;
    time?: number;
    dependencies?: Record<string, string>;
    reason?: string;
  }>;
}

Python#

python
import requests
BASE_URL = 'https://api.pay.ledger1.ai/portalpay'

def get_health():
  r = requests.get(f'{BASE_URL}/healthz')
  r.raise_for_status()
  return r.json()

Notes#

  • Public endpoint: no APIM subscription key is required.
  • Health responses may include dependency statuses for diagnostic purposes.