Developers

API v1

API reference

Every Unays API endpoint, the scope it needs and what it returns. Base URL https://unays.net/api/v1.

Authentication

Create a key in your developer dashboard. Keys start with uak_live_. Send it in either header, and only from your server:

Authorization: Bearer $UNAYS_API_KEY
X-API-Key: $UNAYS_API_KEY

New keys carry the scopes ai:read, edu:read, auth:verify, iot:monitor and webhooks:write. Key management is free; paid education content still needs EDU access on the account. See pricing and access.

Rate limits

Each key can make 30 requests per minute, or 600 per minute for /iot/authorize. Every authenticated response includes:

HeaderMeaning
x-ratelimit-limitRequests allowed this minute
x-ratelimit-remainingRequests left this minute
x-ratelimit-resetWhen the window resets (ISO 8601 time)

Errors

Errors return JSON with ok: false and a readable error message.

{ "ok": false, "error": "A valid Unays API key is required." }
StatusWhat to do
400The body is missing a required field or a value is not allowed.
401The API key is missing, revoked or invalid.
403The key is valid but lacks the scope for this endpoint, or the account lacks the product access.
404The endpoint or the item does not exist.
409The request conflicts with current state, such as a sixth webhook.
429The key used its requests for this minute. Wait until x-ratelimit-reset.
503Temporarily unavailable. Retry with exponential backoff.

Endpoints

GET /status Service status

Public. Returns the API version, overall status and the services it covers. No key needed.

Scope: None (public)

curl https://unays.net/api/v1/status 
Example response
{
  "ok": true,
  "version": "v1",
  "status": "operational",
  "services": ["Unays AI API", "Education API", "Authentication API", "UnaysNET authorization"],
  "timestamp": "2026-11-30T09:00:00.000Z"
}

GET /platforms List products

Lists Unays products with an id, name, status and URL.

Scope: Any valid keyErrors: 401, 429

curl https://unays.net/api/v1/platforms \
  -H "Authorization: Bearer $UNAYS_API_KEY" 
Example response
{
  "ok": true,
  "products": [
    { "id": "ai", "name": "Unays AI", "status": "active", "url": "https://unays.net/ai/" }
  ]
}

GET /education/catalog Curriculum catalog

Summarises the curriculum: unit totals, classes 1 to 12, terms and subjects. The key’s account also needs paid EDU access.

Scope: edu:readErrors: 401, 403, 429, 503

curl https://unays.net/api/v1/education/catalog \
  -H "Authorization: Bearer $UNAYS_API_KEY" 
Example response
{
  "ok": true,
  "classes": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
  "terms": [1, 2, 3]
}

POST /auth/verify Verify a user token

Checks a Unays session token sent as the x-unays-user-token header or as userToken in the body, and returns the public profile.

Scope: auth:verifyErrors: 401, 403, 429

curl -X POST https://unays.net/api/v1/auth/verify \
  -H "Authorization: Bearer $UNAYS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"userToken":"USER_SESSION_TOKEN"}'
Example response
{
  "ok": true,
  "user": { "id": "…", "name": "…" }
}

POST /iot/authorize Authorize an IoT client

Confirms a UnaysNET or IoT client key and returns its scopes. Allows 600 requests per minute per key.

Scope: iot:monitorErrors: 401, 403, 429

curl -X POST https://unays.net/api/v1/iot/authorize \
  -H "Authorization: Bearer $UNAYS_API_KEY" 
Example response
{
  "ok": true,
  "authorized": true,
  "keyId": "devkey_…",
  "accountId": "…",
  "scopes": ["iot:monitor"]
}

GET /webhooks List webhooks

Lists the active webhooks on the key’s account.

Scope: webhooks:writeErrors: 401, 403, 429

curl https://unays.net/api/v1/webhooks \
  -H "Authorization: Bearer $UNAYS_API_KEY" 
Example response
{
  "ok": true,
  "webhooks": [
    { "id": "webhook_…", "url": "https://example.com/unays", "events": ["ai.response.completed"], "createdAt": "…" }
  ]
}

POST /webhooks Register a webhook

Registers a public HTTPS URL for up to three events. Each account can have five webhooks.

Scope: webhooks:writeErrors: 400, 401, 403, 409, 429

curl -X POST https://unays.net/api/v1/webhooks \
  -H "Authorization: Bearer $UNAYS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/unays","events":["ai.response.completed"]}'
Example response
{
  "ok": true,
  "webhook": { "id": "webhook_…", "url": "https://example.com/unays", "events": ["ai.response.completed"], "createdAt": "…" }
}

DELETE /webhooks Revoke a webhook

Revokes one of your webhooks by id.

Scope: webhooks:writeErrors: 401, 403, 404, 429

curl -X DELETE https://unays.net/api/v1/webhooks \
  -H "Authorization: Bearer $UNAYS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"id":"webhook_…"}'
Example response
{
  "ok": true
}

POST /ai/chat Ask Unays AI

Sends a prompt of up to 12,000 characters. Mode is general, educational, research, coder or business and defaults to general.

Scope: ai:readErrors: 400, 401, 403, 429, 503

curl -X POST https://unays.net/api/v1/ai/chat \
  -H "Authorization: Bearer $UNAYS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prompt":"Explain photosynthesis in two sentences.","mode":"educational"}'
Example response
{
  "ok": true,
  "answer": "…",
  "profile": "Learning profile",
  "usage": { "rateLimitRemaining": 29 }
}

Webhook events

Registration accepts these event names:

  • ai.response.completed
  • education.progress.updated
  • iot.alert.created

Webhook URLs must be public HTTPS endpoints. Before you rely on deliveries in production, email [email protected] to confirm the events your integration needs.