REST API
Ayra’s REST API opens after the private beta. It will give server-to-server access to the same data the admin shows (customers and their wallets, ledgers, referrals, reviews, segments, opportunities and the event stream) with app-level API keys issued per store, JSON over HTTPS, cursor pagination and per-key rate limits. Until then, use the JavaScript API on the storefront, the metafields Ayra writes to Shopify, and Shopify Flow triggers for automation.
Base URL and versioning
Section titled “Base URL and versioning”https://api.ayra.one/v1/ with the major version in the path. Dates in ISO 8601, money as { amount, currencyCode }, IDs as strings.
Authentication
Section titled “Authentication”Per-store API keys created in Ayra → Settings → API, sent as a bearer token. Keys carry scopes (read:customers, write:wallet, read:events, …) chosen at creation and can be rotated without downtime.
Resources (planned)
Section titled “Resources (planned)”| Resource | Methods | Notes |
|---|---|---|
/customers/{id} | GET | Profile with wallet, tier, stage, segments |
/customers/{id}/ledger | GET, POST | Points and credit lines; POST grants or deducts with a reason (audited) |
/customers/{id}/timeline | GET | Signals, opportunities and actions with reasons |
/referrals | GET | Codes, links and reward status |
/reviews | GET, POST, PATCH | Reviews and moderation (with the Reviews module) |
/segments and /segments/{id}/customers | GET | Live segment membership |
/opportunities | GET | Open opportunities by type and priority |
/events | GET | The ay:* event stream with cursor pagination |
/exports | POST, GET | Trigger and fetch the CSV exports described on Uninstall & export |
Rate limits and errors
Section titled “Rate limits and errors”Per-key limits with RateLimit-* headers; errors as { code, message, details } with the same codes as the JavaScript API.
Related
Section titled “Related”Something missing or wrong on this page? Ask us and we will fix the docs.