Skip to content
Vayra Platform

Developers

An API designed around events, not polling.

The Vayra Platform partner API is in development for v1.1. This page documents the design we are building to, so your team can plan integration now. Nothing marked v1.1 is live yet.

Authentication

Coming in v1.1 The API uses OAuth 2.0 client credentials. You exchange a client id and secret for a short-lived bearer token, and every request is scoped to your partner account. Secrets are issued per environment, can be rotated without downtime, and are never shown again after creation.

POST /oauth/token
curl https://api.vayraplatform.com/oauth/token \
  -d grant_type=client_credentials \
  -d client_id=$VAYRA_CLIENT_ID \
  -d client_secret=$VAYRA_CLIENT_SECRET

Resources

Coming in v1.1 Resources carry identifiers and status. Clinical content stays inside the clinical record and is not exposed through the API.

ResourcePathCovers
Partners/v1/partnerYour account, programs and configuration
Patients/v1/patientsIdentifiers and status. Clinical content stays in the record
Providers/v1/providersClinicians and coverage by state
Encounters/v1/encountersAsync reviews and visits, with decision status
Orders/v1/ordersPharmacy orders and shipment tracking
Prescriptions/v1/prescriptionsPrescription status and routing
Payments/v1/paymentsCharges, refunds, disputes and subscriptions
Webhooks/v1/webhook-endpointsRegister endpoints and rotate signing secrets
GET /v1/orders
curl https://api.vayraplatform.com/v1/orders?limit=25 \
  -H "Authorization: Bearer $VAYRA_ACCESS_TOKEN"

Pagination and errors

Coming in v1.1 Lists are cursor-paginated. Pass limit and the nextCursor from the previous page. Cursors are stable while you page, even as new records arrive.

Errors use standard HTTP status codes with a consistent body: a type, a machine-readable code, a human message, the parameter at fault where there is one, and a request id to quote to support.

400 Bad Request
{
  "error": {
    "type": "invalid_request",
    "code": "parameter_invalid",
    "message": "limit must be between 1 and 100",
    "param": "limit",
    "requestId": "req_8c1f02"
  }
}

Webhooks

Coming in v1.1 Register an HTTPS endpoint and choose the events you want. Every delivery is signed with your endpoint secret, retried with backoff when your endpoint fails, and safe to process more than once using the event id.

Webhook event catalogue
EventSent when
intake.completedA patient finished an intake and it entered review
encounter.decidedA clinician approved, declined or converted a case
prescription.routedA prescription was sent to a pharmacy
order.shippedThe pharmacy shipped an order, with tracking
order.exceptionAn order needs attention: address, loss or damage
subscription.renewedA recurring payment succeeded
subscription.payment_failedA recurring payment failed and a retry is scheduled
dispute.openedA chargeback arrived, with evidence gathered
assistant.escalatedVayra Intelligence handed a patient to the care team

Verify the signature

Compute an HMAC SHA-256 over the timestamp and raw body, compare in constant time, and reject old timestamps.
verify-webhook.ts
import { createHmac, timingSafeEqual } from "node:crypto";

// Header format: "t=<unix seconds>,v1=<hex signature>"
export function verifyVayraSignature(rawBody: string, header: string, secret: string): boolean {
  const parts = Object.fromEntries(header.split(",").map((p) => p.split("=") as [string, string]));
  const timestamp = Number(parts.t);
  if (!parts.v1 || !Number.isFinite(timestamp)) return false;
  // Reject replays older than five minutes.
  if (Math.abs(Date.now() / 1000 - timestamp) > 300) return false;
  const expected = createHmac("sha256", secret).update(`${timestamp}.${rawBody}`).digest();
  const received = Buffer.from(parts.v1, "hex");
  return received.length === expected.length && timingSafeEqual(received, expected);
}

Rate limits

Coming in v1.1 Limits are per partner and per endpoint, published with your sandbox credentials. Responses carry the remaining allowance in headers, and a 429 includes a retry hint.

Sandbox

Coming in v1.1 A separate environment with test patients, test pharmacies and test payments, so you can run the whole lifecycle without touching real data. Request access through the contact page.

Changelog

API changes will be versioned and announced here, with deprecation notice before any breaking change. No entries yet: the first entry will be the v1.1 release.

Plan your integration with our engineers

Tell us what you need to connect. We will show you the event model and the exports available today.