API: Org
Organization settings and team membership.
На этой странице
Раздел собран из спецификации OpenAPI продукта: 12 метод(ов). Поверхность — query-api (основной API, база /api/v1). Все методы требуют аутентификации.
Методы раздела
/org Get the current organization
Ответы
| Код | Что означает | Тело |
|---|---|---|
| 200 | Organization | object |
| 401 | Missing or invalid credentials (code=unauthorized) | Error |
/org Rename the organization (admin+)
Тело запроса application/json , обязательно
| Поле | Тип | Описание |
|---|---|---|
name обязательно | string |
Ответы
| Код | Что означает | Тело |
|---|---|---|
| 200 | Updated organization | object |
| 401 | Missing or invalid credentials (code=unauthorized) | Error |
| 403 | Authenticated but not permitted (code=forbidden) | Error |
| 422 | Request failed validation (code=validation_failed) | Error |
/org/invites List pending invites (admin+)
Invites that are neither accepted nor expired, newest first. The invite token is intentionally absent — it is returned once on creation only.
Ответы
| Код | Что означает | Тело |
|---|---|---|
| 200 | Pending invites | object |
| 401 | Missing or invalid credentials (code=unauthorized) | Error |
| 403 | Authenticated but not permitted (code=forbidden) | Error |
/org/invites Create an org invite (admin+)
Тело запроса application/json , обязательно
| Поле | Тип | Описание |
|---|---|---|
email обязательно | string (email) | |
role обязательно | enum(admin, analyst, viewer) |
Ответы
| Код | Что означает | Тело |
|---|---|---|
| 201 | Invite created. An invitation email with the accept link is sent (dev: logged when SMTP is not configured); the token is still returned once in this response so the link can be shared manually. | object |
| 401 | Missing or invalid credentials (code=unauthorized) | Error |
| 403 | Authenticated but not permitted (code=forbidden) | Error |
| 422 | Request failed validation (code=validation_failed) | Error |
/org/invites/{iid} Revoke a pending invite (admin+)
Deletes an invite that has not been accepted. Expired-but-unaccepted invites can be deleted too (cleanup). Accepted, foreign-org or unknown ids return 404.
Параметры
| Имя | Где | Тип | Описание |
|---|---|---|---|
iid обязателен | Путь | integer (int64) | Org invite id. |
Ответы
| Код | Что означает | Тело |
|---|---|---|
| 204 | Revoked | пусто |
| 401 | Missing or invalid credentials (code=unauthorized) | Error |
| 403 | Authenticated but not permitted (code=forbidden) | Error |
| 404 | Resource not found (code=not_found) | Error |
/org/members List organization members
Ответы
| Код | Что означает | Тело |
|---|---|---|
| 200 | Members | object |
| 401 | Missing or invalid credentials (code=unauthorized) | Error |
/org/members/{uid} Change a member's role (admin+; owner role changes require owner)
Параметры
| Имя | Где | Тип | Описание |
|---|---|---|---|
uid обязателен | Путь | integer (int64) | User id. |
Тело запроса application/json , обязательно
| Поле | Тип | Описание |
|---|---|---|
role обязательно | enum(owner, admin, analyst, viewer) |
Ответы
| Код | Что означает | Тело |
|---|---|---|
| 200 | Updated | object |
| 401 | Missing or invalid credentials (code=unauthorized) | Error |
| 403 | Authenticated but not permitted (code=forbidden) | Error |
| 404 | Resource not found (code=not_found) | Error |
| 422 | Request failed validation (code=validation_failed) | Error |
/org/members/{uid} Remove a member (admin+; removing an owner requires owner)
Параметры
| Имя | Где | Тип | Описание |
|---|---|---|---|
uid обязателен | Путь | integer (int64) | User id. |
Ответы
| Код | Что означает | Тело |
|---|---|---|
| 204 | Removed | пусто |
| 401 | Missing or invalid credentials (code=unauthorized) | Error |
| 403 | Authenticated but not permitted (code=forbidden) | Error |
| 404 | Resource not found (code=not_found) | Error |
| 422 | Request failed validation (code=validation_failed) | Error |
/org/oidc Read secret-redacted OIDC policy (owner)
Ответы
| Код | Что означает | Тело |
|---|---|---|
| 200 | OIDC policy; the client secret is never returned | OIDCConfig |
| 401 | Missing or invalid credentials (code=unauthorized) | Error |
| 403 | Authenticated but not permitted (code=forbidden) | Error |
| 404 | Resource not found (code=not_found) | Error |
/org/oidc Configure OIDC discovery and account policy (owner)
Discovery is fetched and validated before storage. The client secret is encrypted; omitting it preserves an existing secret.
Тело запроса application/json , обязательно
| Поле | Тип | Описание |
|---|---|---|
discovery_url обязательно | string (uri) | |
client_id обязательно | string | |
client_secret необязательно | string | Required on initial setup; omission preserves the encrypted existing value. |
allowed_domains обязательно | array<string> | |
jit_enabled обязательно | boolean | |
default_role обязательно | enum(viewer, analyst) | |
password_fallback обязательно | boolean | |
break_glass_user_id необязательно | integer (int64) | |
enabled обязательно | boolean |
Ответы
| Код | Что означает | Тело |
|---|---|---|
| 200 | Updated secret-redacted policy | OIDCConfig |
| 401 | Missing or invalid credentials (code=unauthorized) | Error |
| 403 | Authenticated but not permitted (code=forbidden) | Error |
| 422 | Request failed validation (code=validation_failed) | Error |
/org/trial/sms/start Start SMS phone confirmation to activate a risk-flagged trial (owner, cloud)
First activation path for an organization whose signup was risk-flagged (subscription pending_review, org.trial_state=sms_required). Available only while the latest subscription is pending_review AND the signup was marked sms_eligible (risk path; domain-review signups are not — they answer 409 sms_unavailable and wait for the manual review queue, which the pending_review status itself already represents). The phone is normalized: inputs WITHOUT a leading + get Russian-specific rewriting (8XXXXXXXXXX and bare 10-digit numbers become +7XXXXXXXXXX); inputs WITH a leading + keep their digits exactly as given (an explicit country code is never rewritten, even one starting with 8 — e.g. +81... stays +81..., it is not mistaken for the Russian 8-prefix) — and only the salted hash of the normalized number is ever kept: a 6-digit code is sent via the configured SMS provider and stored HMAC-hashed in Redis for 10 minutes together with the phone hash — the raw phone number is never persisted or logged. A phone already used by another organization whose trial started within the last 90 days is rejected (409 phone_already_used); the same check runs again at verify time to close the race where two organizations start with the same phone concurrently. Rate limited to 3 starts per hour per organization and per phone. A provider failure answers 502 sms_send_failed — the account simply stays pending_review (manual review remains available). Requires the owner role.
Тело запроса application/json , обязательно
| Поле | Тип | Описание |
|---|---|---|
phone обязательно | string | Phone number; digits are extracted, formatting characters (spaces, parentheses, dashes) are ignored. A leading + marks an explicit country code (kept as-is, 11-15 digits); without a leading + the number is assumed Russian (10 digits, or 11 with a leading 8) and rewritten to +7XXXXXXXXXX. |
Ответы
| Код | Что означает | Тело |
|---|---|---|
| 202 | Code sent via SMS (valid 10 minutes, 5 attempts) | object |
| 401 | Missing or invalid credentials (code=unauthorized) | Error |
| 403 | Authenticated but not permitted (code=forbidden) | Error |
| 409 | SMS confirmation is not applicable (code=sms_unavailable: the latest subscription is not pending_review, or the signup was not marked sms_eligible — the account waits for manual review), or the phone was already used for a trial started within the last 90 days (code=phone_already_used — submit for manual review instead). | Error |
| 422 | Request failed validation (code=validation_failed) | Error |
| 429 | Rate limit (code=rate_limited) or plan quota exceeded (code=quota_exceeded). On ingest operations a live trial that exhausted its total event cap answers code=trial_quota_exceeded instead of quota_exceeded. Заголовки: Retry-After.
| Error |
| 502 | The SMS provider failed to send the code (code=sms_send_failed) | Error |
/org/trial/sms/verify Confirm the SMS code and activate the trial (owner, cloud)
Companion of /org/trial/sms/start. Every code defect — no code requested, expired, wrong, or more than 5 attempts (the attempt counter increments before comparison; exceeding it kills the code so even the correct value stops working — request a new one via start) — yields the same uniform 422. On a correct code the code is consumed immediately (one-time, even if a later step fails) and the phone uniqueness check from /org/trial/sms/start runs again (code=phone_already_used): this closes the race where two organizations start with the same phone and the other one's verify won first. Success stores the confirmed phone hash in the signup signals (future trial dedup), atomically flips the pending_review subscription to trialing with trial dates starting now, lifts the ingest block and emits the dogfood trial-started event once. If the organization is no longer pending_review (a payment or a manual approval won the race) the answer is 409 sms_unavailable and existing access is left untouched. Requires the owner role.
Тело запроса application/json , обязательно
| Поле | Тип | Описание |
|---|---|---|
code обязательно | string | Six-digit code from the SMS. |
Ответы
| Код | Что означает | Тело |
|---|---|---|
| 200 | Trial activated; the subscription is now trialing | object |
| 401 | Missing or invalid credentials (code=unauthorized) | Error |
| 403 | Authenticated but not permitted (code=forbidden) | Error |
| 409 | Either SMS confirmation is not applicable (code=sms_unavailable: the latest subscription is not pending_review — already activated, converted, or under manual review — or the signup was not marked sms_eligible), or the phone was confirmed by another organization's trial first in the race window between this organization's start and verify calls (code=phone_already_used — the code is already consumed; start again with a different phone or submit for manual review). | Error |
| 422 | Request failed validation (code=validation_failed) | Error |
Источник раздела — docs/api/openapi.yaml репозитория продукта,
версия API 1.0.0, OpenAPI 3.0.3,
снимок 095579325c2d.
Расхождение снимка со спецификацией роняет сборку документации.