All routes live under https://. Scopes: org:read to read, org:write to write, except for the directory (see below).
OverviewLink to the Overview section
GET / · org:read
{
"org": { "id": "8c1f2a4e-5b6d-4e7f-9a0b-1c2d3e4f5a6b", "name": "Lycée Victor-Hugo", "slug": "lycee-victor-hugo", "description": null, "logo_url": null, "org_kind": "education", "managed": true, "created_at": 1751328000 },
"members": { "active": 380, "suspended": 4 },
"invitations_pending": 25,
"groups": 42,
"usage_scope": "workspace",
"activity": {
"active_30d": 295, "requests_30d": 18422, "active_7d": 241, "requests_7d": 5100,
"month_pct_avg": 37.4,
"top": [{ "user_id": "41ab2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d", "name": "Léa Dupont", "month_pct": 98.2 }]
},
"alerts": []
}| Field | Description |
|---|---|
members, invitations_pending, groups | Counters; null when the key lacks the scope that reads them (members:*, groups:*). |
usage_scope | workspace: members’ usage is counted by the organization. personal: each member uses their own allowance, and activity is null. |
activity | Active members and number of requests over 30 and 7 days, the average share of the monthly limit used (as a percentage), and the 5 members closest to their limit. Requires usage:read. |
alerts | The “To do” list, as returned by GET /alerts. |
“To do” listLink to the “To do” list section
GET /alerts · org:read
Returns {"items": . Each item has code, severity (danger, warning or info), title, detail, href (a page of the admin console), count and params. An alert is only returned if the key holds one of the permissions it relates to.
code | Meaning | params |
|---|---|---|
invitations_pending | Pending invitations. | count |
domain_unverified | Domains not verified yet. | count |
sso_not_configured | Managed organization without single sign-on. | verified_domains |
contract_ending | The contract ends within 60 days, with no renewal. | date, days |
invoice_overdue | Overdue invoices. | count |
license_pool_full | A license pool is full. | pool_id, plan_name, seats, used |
license_pool_nearly_full | A pool is 95% full or more. | the same, plus free |
license_members_unlicensed | Some active members have no license. | count |
license_fallback_used | Some members are in the fallback pool. | count |
members_without_group | Members of a managed organization who belong to no group. | count |
retention_will_delete | Chats that the retention period is about to delete. | count, days |
org_models_base_unavailable | Organization models whose base model is no longer offered. | count |
org_models_not_shared | Organization models shared with no one. | count |
For automated processing, rely on code and params: title and detail are written for the console.
Identity and settingsLink to the Identity and settings section
ReadLink to the Read section
GET /general · org:read
{
"id": "8c1f2a4e-5b6d-4e7f-9a0b-1c2d3e4f5a6b",
"name": "Lycée Victor-Hugo",
"slug": "lycee-victor-hugo",
"description": "Établissement public",
"logo_url": null,
"created_at": 1751328000,
"owner": { "id": "a11f3c5e-7b9d-4f1a-8c2e-4d6f8a0b2c4e", "name": "Claire Moreau", "email": "claire.moreau@ecole.fr" },
"is_personal": false,
"org_kind": "education",
"org_kinds": ["team", "education", "company", "public_sector", "other"],
"managed": true,
"outside_access": true,
"retention_days": 365,
"retention_applied": true,
"policy_version": 88,
"members_active": 380,
"retained_accounts": 0,
"has_active_contract": true,
"memory_policy": "allowed",
"can": { "memory": false, "edit": true, "policies": true, "transfer": false, "delete": false, "platform": false }
}| Field | Description |
|---|---|
managed | The managed organization features are on: rules apply. |
outside_access | true: members can also use Moon AI outside the organization. |
retention_days | How long chats are kept, from 30 to 3,650 days; null: nothing is deleted. |
retained_accounts | Members held in the organization (a managed organization with outside access closed). |
has_active_contract | The organization has an active contract; null if it could not be read. |
can | What the key can change here. transfer and delete are always false with a key. |
UpdateLink to the Update section
PATCH / · org:write
| Field | Type | Required | Description |
|---|---|---|---|
name | string | no | 1 to 128 characters. |
slug | string | no | 2 to 50 characters: lowercase letters, digits and hyphens, with no hyphen at the start or end. |
description | string | no | 2,048 characters at most; empty or null clears it. |
logo_url | string | no | An http or https address; empty or null clears it. |
org_kind | string | no | team, education, company, public_sector or other. It changes the names of the built-in roles. |
managed | boolean | no | Turns on the managed organization features (an active contract is required). |
outside_access | boolean | no | false closes access outside the organization (an active contract is required). |
retention_days | integer | no | 30 to 3,650; null removes the retention period. |
Only the fields you send are processed. managed, outside_access and retention_days also require the rules:read or rules:write scope. The response has the same shape as the read.
curl -X PATCH https://chat.realmoon.ai/api/v1/orgs/$ORG_ID/general \
-H "Authorization: Bearer $MOONAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Lycée Victor-Hugo", "retention_days": 365}'import os
import requests
r = requests.patch(
f"https://chat.realmoon.ai/api/v1/orgs/{os.environ['ORG_ID']}/general",
headers={"Authorization": f"Bearer {os.environ['MOONAI_ADMIN_KEY']}"},
json={"name": "Lycée Victor-Hugo", "retention_days": 365},
timeout=30,
)
r.raise_for_status()
print(r.json()["retention_days"])const r = await fetch(`https://chat.realmoon.ai/api/v1/orgs/${process.env.ORG_ID}/general`, {
method: 'PATCH',
headers: { Authorization: `Bearer ${process.env.MOONAI_ADMIN_KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify({ name: 'Lycée Victor-Hugo', retention_days: 365 }),
});
if (!r.ok) throw new Error(await r.text());
console.log((await r.json()).retention_days);| Status | code | Cause |
|---|---|---|
| 400 | invalid_request | Nothing to change, an invalid field (fields), null for org_kind, managed or outside_access, or rules that would become invalid after the change (errors). |
| 403 | managed_needs_contract | Turning on managed or closing outside_access without an active contract. |
| 409 | slug_taken | The slug is already used by another organization. |
In a managed organization with a retention period, chats inactive for longer than that period are deleted every night.
Retention previewLink to the Retention preview section
GET / · org:read
Returns {"days": : the number of chats in the workspace that have not been changed for days days. days is required, from 30 to 3,650.
Settings onlyLink to the Settings only section
GET / (org:read) and PATCH / (org:write) read and update org_kind, managed, outside_access and retention_days, with the same rules as /general, without the organization’s identity.
Member directoryLink to the Member directory section
The directory controls what a member can see of the other members.
GET / · members:read
{ "value": null, "default": "groups", "effective": "groups", "options": ["all", "groups", "admins"] }| Value | What a member sees |
|---|---|
all | Every member. |
groups | The people in their groups and in the groups they manage, plus the admins. |
admins | The admins only. |
value is null when the organization follows the default: groups for a managed or education organization, all otherwise.
PUT / · org:write
| Field | Type | Required | Description |
|---|---|---|---|
value | string | no | all, groups or admins; null or missing goes back to the default. |