Documentation / API
Auth & organizations
Sign-up, sign-in and session; organizations, their settings, data statistics and deletion; members, roles, invitations and the audit log.
All paths are relative to https://apiv1.opensensorcloud.com/api/v1.
Account and session
POST /auth/register
Creates an account and signs it in (sets the osc_session cookie).
{ "email": "marie@example.com", "password": "at-least-10-chars", "name": "Marie Martin" }
email: valid address (stored lowercase); password: 10 to 200 characters; name: 1 to 100 characters.
201:
{ "id": "bd6fc07f-…", "email": "marie@example.com", "name": "Marie Martin", "locale": "fr", "isAdmin": false }
Errors: 409 email_taken, 400 validation.
POST /auth/login
{ "email": "marie@example.com", "password": "…" }
200 with the user (same shape as above) and the session cookie. Errors: 401 invalid_credentials, 429 too_many_attempts (repeated failures; retry a few minutes later).
POST /auth/logout
Ends the session and clears the cookie. 204.
GET /auth/me
The signed-in user, or 401 without a valid session. isAdmin is true for instance administrators.
Organizations
GET /orgs
Organizations of the signed-in user, with their role.
[
{ "id": "7dd446ca-…", "slug": "demo", "name": "Démo", "role": "owner", "retentionDays": null, "defaultDashboardId": null, "aiEnabled": false }
]
retentionDays: how long raw measurements are kept (null = forever). defaultDashboardId: dashboard opened by the "Dashboards" navigation entry (null = none). aiEnabled: the AI assistant is enabled for the organization (set by an instance administrator only, see Admin).
POST /orgs
{ "name": "Greenhouses", "slug": "greenhouses" }
slug: 3 to 40 characters, lowercase letters, digits and hyphens, not starting or ending with a hyphen. It cannot be changed later (it is part of the MQTT topics). The caller becomes owner. 201 with the organization (as in GET /orgs). Errors: 409 slug_taken, 403 org_quota_reached (too many organizations owned).
PATCH /orgs/{orgId} — admin
Changes only the given fields; unknown fields (such as slug) are refused with 400.
{ "name": "Greenhouses (north)", "retentionDays": 365, "defaultDashboardId": "2b4e3d35-…" }
retentionDays: 1 to 36500, or null to keep raw data forever (older raw measurements are deleted within the hour; hourly and daily averages are kept). defaultDashboardId: a dashboard of this organization (400 unknown_dashboard otherwise) or null. 204.
DELETE /orgs/{orgId} — owner
Deletes the organization and everything in it (devices, measurements, dashboards, rules, integrations, members, audit log). The body must repeat the slug:
{ "confirm": "greenhouses" }
Asynchronous: answers 202 { "status": "deleting" } at once. From then on no member has access (404 on every route, absent from GET /orgs), its device tokens, integrations, invitations and public dashboard links stop working, and its data is removed in the background. Errors: 400 confirmation_mismatch, 403 for admins and below, 404 once deleted.
GET /orgs/{orgId}/stats
Stored data of the organization (any member):
{
"devices": 173, "channels": 5962, "points": 2295894,
"firstPointAt": "2026-11-11T08:00:00.000Z", "lastPointAt": "2026-11-13T09:24:57.059Z",
"estimatedBytes": 629145600, "messagesToday": 7011, "msgPerDay": 50000000
}
points counts numeric measurements only, from the hourly aggregate (recent points may take up to about 1.5 hours to be counted). estimatedBytes is an estimate of the organization's share of the measurement storage.
GET /orgs/{orgId}/usage
Today's (UTC) accepted messages and the effective daily quota:
{ "day": "2026-11-13", "messages": 7011, "msgPerDay": 100000 }
Members
GET /orgs/{orgId}/members
[ { "userId": "bd6fc07f-…", "email": "marie@example.com", "name": "Marie Martin", "role": "owner" } ]
PATCH /orgs/{orgId}/members/{userId} — admin
{ "role": "editor" }
role: admin, editor or viewer (the owner cannot be changed). 204.
DELETE /orgs/{orgId}/members/{userId} — admin
Removes the member. An open real-time stream of that member is closed within a minute. 204.
Invitations
Invitations are not sent by email: the API returns an acceptance link to pass on yourself.
POST /orgs/{orgId}/invitations — admin
{ "email": "new@example.com", "role": "viewer" }
201, the only response that contains the link (valid 7 days):
{ "id": "…", "email": "new@example.com", "role": "viewer", "expiresAt": "2026-11-20T10:30:37.000Z",
"acceptUrl": "https://www.opensensorcloud.com/invitations/T6GxL…" }
Error: 409 already_member.
GET /orgs/{orgId}/invitations — admin
Pending invitations (without acceptUrl).
DELETE /orgs/{orgId}/invitations/{invitationId} — admin
Revokes an invitation. 204.
GET /invitations/{token} — public
Preview shown on the acceptance page, no session needed:
{ "email": "new@example.com", "role": "viewer", "orgName": "Greenhouses" }
404 invitation_invalid for an expired, used or unknown token.
POST /invitations/{token}/accept
Accepts with the signed-in account, whose email must match (403 invitation_email_mismatch otherwise). 200 with the organization and the new role.
Invitations of the signed-in user
| Method and path | Effect |
|---|---|
GET /me/invitations |
pending invitations addressed to the account's email: [{ id, orgName, orgSlug, role, expiresAt }] |
POST /me/invitations/{invitationId}/accept |
accepts it; 200 with the organization |
DELETE /me/invitations/{invitationId} |
declines it (the invitation is deleted); 204 |
Audit log
GET /orgs/{orgId}/audit — admin
Every change made in the organization, newest first, 50 per page. Only field names are recorded, never values.
[
{
"id": "1842", "at": "2026-11-13T10:30:38.000Z", "action": "device.update",
"targetId": "8dec3c85-…", "fields": ["profileId", "location"],
"user": { "id": "bd6fc07f-…", "name": "Marie Martin", "email": "marie@example.com" }
}
]
Next page: GET /orgs/{orgId}/audit?before=1842 (the id of the last entry received). An empty array means there is nothing older. user is null when the account was deleted.
Actions: org.create, org.settings_update, org.quota_update, org.ai_enabled, org.ai_disabled, member.join, member.role_change, member.remove, invitation.create, invitation.revoke, device.create, device.update, device.delete, device.token_regenerate, gateway.config_update, profile.create|update|delete, integration.create|update|delete, dashboard.create|update|delete|share|unshare, alert_rule.create|update|delete, alert.acknowledge, notification_channel.create|delete.