API reference

The AY-Robots REST API lives under https://www.ay-robots.com/api and speaks JSON in both directions. This page documents authentication, the response conventions, and every endpoint, with full parameter documentation for the routes you are most likely to call programmatically.

Last updated 2026-08-09

Authentication

Every endpoint requires authentication unless it is listed in the Public section. The API accepts two forms of credentials, and both arrive the same way: either as the session cookie the dashboard already sends, or as an Authorization header with a Bearer token.

MethodHow it worksUse it for
Browser sessionThe Supabase session token of your logged-in account, sent as a cookie or as a Bearer tokenThe dashboard itself and quick experiments from an authenticated browser context
API keyA key with the prefix ayr_live_, created in /dashboard/settings and sent as a Bearer tokenScripts, servers, CI, and anything that must not depend on a browser login
MCPThe hosted MCP server at https://www.ay-robots.com/api/mcp (Streamable HTTP)LLM agents and tools that speak the Model Context Protocol
bash
curl https://www.ay-robots.com/api/sessions \
  -H 'Authorization: Bearer ayr_live_your_key_here'
Authenticating with an API key

API keys are created and revoked in /dashboard/settings. Treat them like passwords: keep them server-side, and rotate by creating a replacement key before revoking the old one. If you use the desktop CLI, it can also expose the platform as a local MCP server with the command: ay-robots mcp.

Responses are JSON. Errors use a consistent shape: a JSON object with a single error field containing a human-readable message, delivered with an appropriate 4xx or 5xx status code. Success responses return the resource directly; a few endpoints wrap lists in a named field, which the examples below show where it matters.

Auth endpoints

Account and profile plumbing. These are primarily used by the dashboard itself, but they work with any valid credential.

GET/api/auth/profileBearer session token or API key

Returns the profile of the authenticated user.

POST/api/auth/profileBearer session token or API key

Updates profile fields such as the display name and notification preferences.

POST/api/auth/syncBearer session token

Synchronizes the Supabase auth user with the platform user record.

GET/api/auth/check-onboardingBearer session token

Reports whether the authenticated user has completed onboarding.

POST/api/auth/avatarBearer session token

Uploads a new avatar image for the authenticated user.

Client endpoints

Everything a robot owner manages: registered robots, the client profile, datasets, invoices, and dashboard statistics.

GET/api/client/robotsBearer session token or API key (client role)

Lists the robots registered by the authenticated client, newest first, up to 50 entries. Timestamps are ISO 8601; last_online and last_heartbeat are null until the robot has connected once.

Request
curl https://www.ay-robots.com/api/client/robots \
  -H 'Authorization: Bearer ayr_live_your_key_here'
Response
[
  {
    "id": "1f9f4c1e-7f2a-4b7e-9a45-0f4d2b6c8a11",
    "name": "Lab SO-100",
    "robot_type": "SO-100",
    "status": "AVAILABLE",
    "control_url": "wss://robots.example.com/so100/control",
    "stream_url": "https://robots.example.com/so100/stream",
    "hardware_id": "board:local:usb-1",
    "last_online": "2026-08-09T10:12:00.000Z",
    "last_heartbeat": "2026-08-09T10:12:00.000Z",
    "total_hours": 12.5,
    "tags": ["lab"],
    "notes": null,
    "created_at": "2026-07-01T09:00:00.000Z"
  }
]
POST/api/client/robotsBearer session token or API key (client role)

Registers a new robot and returns its id. A motor board hardware id can belong to only one robot; a collision is rejected with status 409.

GET/api/client/profileBearer session token or API key (client role)

Returns the client profile of the authenticated user.

PATCH/api/client/profileBearer session token or API key (client role)

Updates client profile fields.

GET/api/client/datasetsBearer session token or API key (client role)

Lists the client's cloud datasets with episode counts and sizes.

GET/api/client/invoicesBearer session token or API key (client role)

Lists the client's monthly invoices.

GET/api/client/statsBearer session token or API key (client role)

Returns usage statistics for the client dashboard.

Operator endpoints

The operator side: profile and availability, certifications, scheduling, and earnings statistics.

GET/api/operator/profileBearer session token or API key (operator role)

Returns the operator profile of the authenticated user.

POST/api/operator/profileBearer session token or API key (operator role)

Creates or updates the operator profile.

GET/api/operator/available-robotsBearer session token or API key (operator role)

Lists robots that are currently available and match the operator's certifications.

GET/api/operator/certificationsBearer session token or API key (operator role)

Lists the operator's certification requests and their status.

POST/api/operator/certificationsBearer session token or API key (operator role)

Requests certification for a robot type.

GET/api/operator/scheduleBearer session token or API key (operator role)

Returns the operator's weekly availability schedule.

POST/api/operator/scheduleBearer session token or API key (operator role)

Updates the weekly availability schedule.

GET/api/operator/availabilityBearer session token or API key (operator role)

Returns the operator's current availability.

GET/api/operator/statsBearer session token or API key (operator role)

Returns earnings and session statistics for the operator dashboard.

Sessions

Sessions are the core resource of the platform: one session is one continuous teleoperation engagement between an operator and a robot. Session status moves through PENDING, ACTIVE, PAUSED, COMPLETED, and CANCELLED.

GET/api/sessionsBearer session token or API key

Lists sessions for the authenticated user. Operators see sessions they operated; clients see sessions on their robots. The field set differs slightly between the two views: the client view includes episodes_collected and data_collected_mb, the operator view includes operator_earnings_cents.

NameInTypeDescription
statusquerystringOptional. Filter by session status, for example ACTIVE or COMPLETED. Omit to list all.
limitquerynumberOptional. Page size, default 50, maximum 100.
offsetquerynumberOptional. Pagination offset, default 0.
Request
curl 'https://www.ay-robots.com/api/sessions?status=COMPLETED&limit=10' \
  -H 'Authorization: Bearer ayr_live_your_key_here'
Response
{
  "sessions": [
    {
      "id": "6b0d2c9a-53f1-4f6e-8f1a-2c9d4e7b5a30",
      "status": "COMPLETED",
      "started_at": "2026-08-08T14:00:12.000Z",
      "ended_at": "2026-08-08T14:47:31.000Z",
      "duration_minutes": 47,
      "client_charge_cents": 1175,
      "episodes_collected": 23,
      "data_collected_mb": 210.4,
      "rating": 5,
      "created_at": "2026-08-08T13:59:58.000Z",
      "robot_id": "1f9f4c1e-7f2a-4b7e-9a45-0f4d2b6c8a11",
      "robot_name": "Lab SO-100",
      "robot_type": "SO-100",
      "operator_name": "Jane D."
    }
  ]
}
POST/api/sessionsBearer session token or API key (operator role)

Starts a teleoperation session on an available robot. Requires the operator role: clients cannot start sessions. An operator can hold at most one ACTIVE or PAUSED session at a time, and the robot must currently have status AVAILABLE. On an immediate start the robot switches to IN_SESSION and the client is notified.

NameInTypeDescription
robotIdbodystringRequired. Id of the robot to operate. The robot must be AVAILABLE.
operatorIdbodystringOptional. Explicit operator id; defaults to the authenticated operator.
scheduledForbodystring (ISO 8601)Optional. Schedules the session for a future time instead of starting it immediately.
Request
curl -X POST https://www.ay-robots.com/api/sessions \
  -H 'Authorization: Bearer ayr_live_your_key_here' \
  -H 'Content-Type: application/json' \
  -d '{"robotId": "1f9f4c1e-7f2a-4b7e-9a45-0f4d2b6c8a11"}'
Response
{
  "sessionId": "6b0d2c9a-53f1-4f6e-8f1a-2c9d4e7b5a30",
  "status": "ACTIVE"
}
GET/api/sessions/[id]Bearer session token or API key

Returns a single session with its details.

PATCH/api/sessions/[id]Bearer session token or API key

Updates the session lifecycle: pause, resume, end, and related actions.

POST/api/sessions/[id]/extendBearer session token or API key (client, session owner)

Requests a session extension. Only the client who owns the session can call this, and the session must be ACTIVE. The request is logged as a session event and the operator receives a notification; the extension itself happens when the operator acts on it.

NameInTypeDescription
idpathstringThe session id.
additionalMinutesbodynumberRequested extension length in minutes.
Request
curl -X POST https://www.ay-robots.com/api/sessions/6b0d2c9a-53f1-4f6e-8f1a-2c9d4e7b5a30/extend \
  -H 'Authorization: Bearer ayr_live_your_key_here' \
  -H 'Content-Type: application/json' \
  -d '{"additionalMinutes": 30}'
Response
{
  "message": "Extension request sent to operator"
}
GET/api/sessions/[id]/messagesBearer session token or API key

Lists the chat messages of a session.

POST/api/sessions/[id]/messagesBearer session token or API key

Sends a chat message in a session.

POST/api/sessions/[id]/rateBearer session token or API key (client)

Rates a completed session on a 1 to 5 star scale, with an optional comment.

POST/api/sessions/exportBearer session token or API key

Exports session data.

Payments

All money movement runs through Stripe. Client billing uses a Stripe customer with a saved payment method; operator payouts use Stripe Connect. The platform itself never stores card or bank data.

POST/api/stripe/customerBearer session token (client role)

Creates or returns the Stripe customer used for client billing.

GET/api/stripe/connectBearer session token (operator role)

Returns the status of the operator's Stripe Connect account.

POST/api/stripe/connectBearer session token (operator role)

Starts Stripe Connect onboarding for operator payouts.

POST/api/stripe/setup-intentBearer session token (client role)

Creates a Stripe SetupIntent for saving a payment method.

POST/api/stripe/portalBearer session token (client role)

Creates a Stripe billing portal session for managing payment methods and invoices.

GET/api/stripe/payoutBearer session token (operator role)

Returns payout information for the authenticated operator.

POST/api/stripe/payoutBearer session token (operator role)

Requests a payout of accumulated earnings. The minimum payout is 10.00 EUR.

POST/api/stripe/webhookStripe webhook signature

Receives Stripe webhook events. Called by Stripe, not by API clients.

Public endpoints

These endpoints require no authentication. They are safe to call from monitoring, marketing pages, or a status probe.

GET/api/health

Health check for the API and its database connection. Returns 200 when both are fine; if the database check fails, the same shape is returned with status and db set to error and HTTP status 503.

Request
curl https://www.ay-robots.com/api/health
Response
{
  "status": "ok",
  "db": "ok",
  "timestamp": "2026-08-09T10:12:00.000Z"
}
GET/api/robots/[id]

Returns public information about a supported robot model.

GET/api/public/pricing

Returns the current public pricing plans.

POST/api/contact

Submits a contact form message. The message is stored first and then delivered by email, so a temporary mail outage does not lose it: in that case the response reports stored true and delivered false, and delivery is retried operationally.

NameInTypeDescription
namebodystringRequired. Your name.
emailbodystringRequired. A valid email address for the reply.
categorybodystringRequired. One of: General Inquiry, Bug Report, Feature Request, Sales & Pricing, Partnership, Career/Jobs, Technical Support, Billing & Payments, Press & Media, Other.
subjectbodystringRequired. Short subject line.
messagebodystringRequired. The message body.
Request
curl -X POST https://www.ay-robots.com/api/contact \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Jane Doe",
    "email": "jane@example.com",
    "category": "Technical Support",
    "subject": "SO-100 pairing question",
    "message": "My arm shows as offline after pairing."
  }'
Response
{
  "success": true,
  "message": "Message sent successfully",
  "id": "b1f2c3d4-0000-0000-0000-000000000000",
  "stored": true,
  "delivered": true
}
POST/api/robot-request

Requests support for a robot type that is not yet on the platform.

GET/api/stats

Returns public platform statistics.