提供规模的组织和账户

When you onboard a large customer — thousands of OUs and member accounts in one go — call the bulk and paginated APIs below rather than looping the single-entity verbs. They are idempotent, apply backpressure, and come with published latency targets you can budget retries against.

All paths are under the public gateway at https://api.flexgalaxy.ai, signed with FGAI-HMAC-SHA256 (see Integrate an external app with AK/SK). Management-account context is supplied with the X-Account-Id header. The wire is snake_case.

批量创建 OUs

POST /organizations/v1/{org}/ous/batch — synchronous, up to 500 OUs per call.

  • Items are topologically sorted, so you can create a whole subtree in one request and reference a not-yet-created parent by parent_ref.

  • 每个项目在自己的交易中承诺:一个坏项目(名称碰撞,配额旅行,坏父母)被自己拒绝,并且永远不会丢弃其他项目. 您得到一个每个项目接受/ 拒绝的结果集 。

  • Requires an Idempotency-Key header. Re-POSTing the same key replays the exact same result instead of creating duplicates.

批量进口成员账户

POST /accounts/v1/provision/batch — asynchronous, up to 1000 accounts per call.

  • 前置拒绝(quota headroom, 重复的电子邮件, 未知的 OU) 在回复中立即返回.

  • Everything accepted is enqueued on a durable relay and returns a batch_id.

  • Poll GET /accounts/v1/provision/batch/{batch_id} for {total, pending, completed, failed, items[]}.

  • Also Idempotency-Key-guarded.

Account provisioning is asynchronous by design — each account is stood up in the background (identity realm, root user, org-access role). A 202/enqueue is fast; the account becomes live a few seconds later. Drive large onboards as a sustained background import, not a single burst: submit, poll the batch, and honor Retry-After (below). Reconcile any in-flight single-provision work with GET /accounts/v1/provision/jobs.

Enterprise onboarding — placeholder accounts & lazy materialization

For an enterprise import where most accounts will not be used immediately (a franchise rolling out thousands of locations, say), use the onboarding path instead of provisioning every account up front. It creates cheap placeholder accounts now and defers the expensive per-account setup — identity realm, authz projection — to first use.

POST /organizations/v1/{org}/account-batches — synchronous 202, bulk placeholder create.

{ "ou_node_id": "<ou>", "accounts": [ { "name": "warehouse-01" }, { "name": "warehouse-02" } ] }

Each returned account is { "status": "PLACEHOLDER", "realm_status": "NONE" } — a row, nothing more. A 20K-account import is just that many rows and stays fast.

Accounts materialize lazily on first use:

Call

Transition

POST …/onboarding/accounts/{account}/grant-operator

first operator grant → PLACEHOLDER → ACTIVE

POST …/onboarding/accounts/{account}/provision-service-user

first service user → materializes the account realm

Teardown mirrors it:

Call

Effect

POST …/onboarding/accounts/{account}/terminate

transition to terminal CLOSED (idempotent)

Hard-delete (purge) is not a partner verb — it is classified platform-operator in the edge declaration; a placeholder created in error is removed by operator tooling.

Read the roster with the lifecycle view, optionally filtered by status:

GET /organizations/v1/{org}/account-lifecycle?status=PLACEHOLDER|MATERIALIZING|ACTIVE|CLOSED

The status values, the full lifecycle row shape and the filter semantics are in Account lifecycle status.

All of the above is available on the CLI as fgai org onboard-accounts, onboard-grant-operator, onboard-provision-service-user, onboard-terminate, and account-lifecycle (see CLI reference).

读书不拉整个森林

无端点返回整棵树 。 页面和范围如下:

  • GET /organizations/v1/{org}/ous?page=&size= → a page of OuSummary (size capped at 200). Each item carries child_count / has_children, so you can render a lazy tree without pre-fetching descendants. Add ?parentId=<ou> to fetch just one OU's direct children.

  • GET /organizations/v1/{org}/accounts?page=&size= and GET /organizations/v1/{org}/ous/{ou}/accounts?page=&size= → paginated (the OU filter runs in the database).

  • The nested GET /organizations/v1/{org}/tree door is bearer-only (a human session; an FGAI-HMAC service user receives 401 by design — 175-W2 ruling A, DotID#1762 / DotID#1899). A service user walks the tree branch-by-branch instead: ous?parentId=<ou> for one level, following child_count / has_children, or fgai org ou-list --parent-id <ou> / fgai org ou-get on the CLI.

后压率限制( R)

  • Backpressure. When the provisioning backlog is over its high-water mark, POST /accounts/v1/provision and /provision/batch return 429 with a Retry-After header and the standard error envelope (error_code = "provisioning-backpressure", with details.backlog / highWaterMark / retryAfterSeconds). Batches are rejected whole — never partially enqueued — so a retry is clean.

  • Rate limit. A single POST /accounts/v1/provision is capped per management account. Over the cap → 429, error_code = "rate-limited", Retry-After. Use /provision/batch for bulk.

These errors use the platform problem envelope (application/problem+json): { "type", "title", "status", "detail", "error_code", "code", "details"?, "request_id" }. The machine code to branch on is error_code; code is the stable catalogued error identifier (FG-DOT-…) to quote when reporting a problem; the human sentence is detail, and any structured payload is details. request_id is the same value as the X-Request-Id response header.

Always honor Retry-After and retry with the same Idempotency-Key.

// 429 backpressure response (application/problem+json)
{
  "type": "about:blank",
  "title": "Too Many Requests",
  "status": 429,
  "detail": "Provisioning queue is over capacity (backlog … >= high-water mark …); retry after 30s.",
  "error_code": "provisioning-backpressure",
  "code": "FG-DOT-…",
  "details": { "backlog": 5000, "highWaterMark": 5000, "retryAfterSeconds": 30 },
  "request_id": "…"
}

延迟目标

预算您的客户端超时, 并重试备份 :

行动

目标

OU 创建( 单一)

p95 ~ 200 毫秒

OU /batch (N ≤ 500)

p95~2 s (中文(简体) ).

标注树 / 列表改为(大小 )

p95 ~ 300 毫秒

Member provision — accept (202)

p95~400 mss (英语).

成员规定——完成(账户直播)

~7秒(同步)

For very large onboards, plan for a sustained background import through the batch + relay path and pace submission to Retry-After — that is the supported path for high-volume onboarding.