外部アプリを AK/SK と統合する

これは、service access key (AK/SK) only を使用して外部アプリケーションを FlexGalaxy.AI platform と統合するためのエンドツーエンドガイドです。対話的な user session、admin console、self-registration はありません。顧客に代わってアカウントをプロビジョニングし、policy を作成し、authorization を確認し、user を管理する portal または backend を構築している場合、これが全体の手順です。

integration model

Your application is a service principal. During onboarding you are issued one service-user access key (an access-key id + secret). From then on you sign every AK/SK request with FGAI-HMAC-SHA256 against the public API gateway at https://api.flexgalaxy.ai, under the /identity/v1/…, /accounts/v1/…, /organizations/v1/… capability paths.

注釈

There is no interactive step in this model. You do not capture a human's login, you do not call the browser/console gateway, and you do not self-register the app (app registration is done once during onboarding). One service-user credential signs every surface this page marks as AK/SK — it does not sign the handful of surfaces the tables below mark JWT only. Which credential each public route accepts is declared once, in the API auth model; this page is the integrator's view of the AK/SK half of it.

あなたの key は1 つの account にバインドされています。すべての call はその account の scope で評価されます。key が属する account 内の resources だけを読み取り、変更できます。cross-account access は別個の明示的な delegation feature であり、1 つの key が暗黙的に行うものではありません。

1. Get your credential

Sign in to the FlexGalaxy console, open Service users, create one if you have none, and Create access key on it — the id and secret are shown once. The full walkthrough (and where the name you pass to --auth comes from) is the help site's Service users page; to issue additional keys or rotate your own, see [CLI & service authentication](https://docs.flexgalaxy.ai/dev/dotid/cli-authentication/). A key is an access-key id (e.g. AKIA…) and a secret; temporary (STS) keys start with ASIA… and also require a session token.

2. Sign a request (FGAI-HMAC-SHA256)

Every request you sign carries these headers:

Header

値

Authorization

FGAI-HMAC-SHA256 Credential=<access-key-id>/<date>/<region>/<service>/fgai4_request, SignedHeaders=<h1;h2;…>, Signature=<hex>

X-FGAI-Date

Request timestamp、yyyyMMddTHHmmssZ (UTC)

X-FGAI-Content-SHA256

raw request body の Hex SHA-256 (body-less GET の場合は empty string)

X-FGAI-Security-Token

temporary (ASIA…) credentials の場合のみ存在します

signature は canonical request に対する AWS-SigV4-shaped HMAC である:

canonicalRequest =
  METHOD            \n
  canonical_path    \n     # the public request path, e.g. /identity/v1/accounts/{id}/users
  canonical_query   \n     # sorted, percent-encoded query string ("" if none)
  canonical_headers \n     # each SignedHeader, lowercased "name:value", sorted, newline-terminated
  signed_headers    \n     # the SignedHeaders list, ";"-joined
  hex_sha256(body)

signing key は HMAC by HMAC で derive される: kDate = HMAC("FGAI4"+secret, date) → kRegion = HMAC(kDate, region) → kService = HMAC(kRegion, service) → kSigning = HMAC(kService, "fgai4_request")、そして Signature = hex(HMAC(kSigning, canonicalRequest))。呼び出す public host と path(https://api.flexgalaxy.ai)に対して署名する — gateway は verification のためにそれらを保持する。Requests は ±5-minute clock skew の外では rejected されるため、clock を同期しておくこと。

Tip

host、x-fgai-date、および x-fgai-content-sha256 は SignedHeaders に含める必要があります。content hash に署名することで、body が signature に bind されます。

重要

The <region> and <service> segments of the Credential are not free-form — they are part of the signing key derivation and are checked against the API you call:

  • <region> is always ap-northeast-1.

  • <service> is per-product. Use the value for the API family you are calling:

    API family

    Paths

    <service>

    DotID identity / accounts / organizations

    /identity/v1/…, /accounts/v1/…, /organizations/v1/…

    identity

    Software-licensing / marketplace (bazaar)

    /v1/integrations/licensing/…, other bazaar product APIs

    bazaar (or software-licensing)

A signature scoped to the wrong service is rejected with 403 credential_scope_mismatch (note: 403, distinct from a 401 invalid_signature, which means the HMAC itself did not match — usually a mishandled secret, clock skew beyond ±5 min, or a canonical-request mismatch). If you use the reference signer, pass --service bazaar for licensing/marketplace calls — its default is identity.

A Python reference signer (fgai_hmac_sign.py, standard-library only) that reproduces this canonical layout and key derivation byte-for-byte is available on request from your onboarding contact — use it rather than reimplementing the byte layout by hand.

3. Which capabilities are AK/SK vs. web-only

integrator が必要とするものはすべて AK/SK gateway 上にあります。いくつかの本当に interactive な flows は設計上 browser-only のままです。

Capability

AK/SK gateway 上ですか?

Path

Accounts — read/manage

✅

/accounts/v1/…

Organizations & OUs — full CRUD、account→OU placement、tree

✅

/organizations/v1/…

会員アカウントのライフサイクル — 会員アカウントの読み込み/名前変更/停止/復元/削除

✅ (management credential)

/organizations/v1/{orgId}/accounts/{account_id} — see Manage member accounts

Enterprise onboarding — bulk-create placeholder accounts

✅ (management credential)

POST /organizations/v1/{orgId}/account-batches — see Enterprise onboarding

Onboarding — promote an account to ACTIVE (first operator)

✅ (management credential)

POST /organizations/v1/{orgId}/onboarding/accounts/{account_id}/grant-operator

Account-lifecycle status — placeholder/active roster with status + realm_status

✅ (management credential)

GET /organizations/v1/{orgId}/account-lifecycle[?status=]

PassPort app-entry routing — resolve ONBOARDING vs APP on Open/deep-link

⚠️ workforce JWT only (not AK/SK)

POST /passport/v1/app-entry/resolve — see PassPort app-entry

PassPort application (read)

✅ (public)

GET /passport/v1/applications/{appId}

Workforce users — list / invite / disable / enable / remove

⚠️ console/JWT のみ (AK/SK ではありません)

Identity Center directory /identity/v1/organizations/{orgId}/identity-center/users — 以前の account-scoped …/workforce-users AK/SK surface は廃止されました。Workforce users を参照してください

IAM / programmatic users — create / list / delete

✅

/identity/v1/accounts/{id}/users

Service users

✅

/identity/v1/accounts/{id}/service-users

Workload identities (federated)

✅

/identity/v1/accounts/{id}/workload-identities/federated

Customer-managed policy の作成 (名前指定)

✅

/identity/v1/accounts/{id}/policies, /permission-sets/{id}/customer-policies

Policy simulator

✅

/identity/v1/authorize, /identity/v1/authorize/batch

Application registration

one-time (onboarding)

—

Root / tenant サインアップ、対話型 password/MFA リセット

❌ web-only

https://auth.flexgalaxy.ai

注釈

Workforce users (email で onboard され、role と PENDING/ACTIVE/DISABLED status を持つ人) は、IAM/programmatic users (machine identities、有効化済みで作成される) とは異なる surface です。これらは Identity Center directory で管理されます。

4. Required fields & common pitfalls

これらはインテグレーターに実際の手戻りコストを発生させます。構築前に読んでください。

  • authorize requires principal (with account_id, user_id, user_type and ic_session), action and resource, and — for permission-set checks — principal.ps_id. A missing or blank required field, or an unreadable body, returns a 400 with a structured error body (status, message); the 401 is reserved for the credential and signature. principal.ic_session is a primitive boolean on the wire: send it explicitly — false for a normal IAM-user check, true for an Identity Center federated session, which then also carries ps_id. Omitting it (or sending null) is not a default of false: the body becomes unreadable and the call returns 400 Malformed request body. See [Policy simulator](https://docs.flexgalaxy.ai/dev/dotid/pdp-authorize/). The simulator also requires the IamPolicySimulateAccess permission attached to the signing service user — a key alone is refused with 403 policy-simulate-required.

  • Batch authorize は requests ではなく checks を使います。 body は { "principal": {…}, "context": {…}, "checks": [ { "action": …, "resource": … }, … ] }、response は同じ順序の { "results": [ … ] } です。すべての checks は 1 つの principal/context を共有します。

  • Default-deny。 一致する Allow が存在しない場合は DENY(IMPLICIT_DENY)です。明示的な Deny は常に優先されます(EXPLICIT_DENY)。Authorization は key の account に scope されます。

  • 400 means the body; 401 means the credential. A missing required field or a malformed body is a 400 rendered in the request dispatch, not a 401 — so if a request you believe is signed correctly returns 401, it is the signature/key, not the body shape. If it returns 400, read message: a validation failure names the failing field in its wire spelling (snake_case), while an unreadable body reports Malformed request body.

  • workforce/account call での 403 は account scope を意味します。 path 内の {accountId} は、あなたの key が bound されている account でなければなりません。access-key-expired も 403 です。

  • body hash に署名します。 X-FGAI-Content-SHA256 は送信する正確な bytes の SHA-256 でなければなりません。署名済み hash と一致しない body は拒否されます。

5. End-to-end walkthrough

最小の integrator flow。すべて同じ signed key を使用します:

  1. tenant tree を provision します。 account とその organization/OUs(/accounts/v1/…, /organizations/v1/…)を作成し、accounts を OUs に配置します。

  2. Author policy. Create an account-scoped customer-managed policy by name and reference it from a permission set (/identity/v1/accounts/{id}/policies, /permission-sets/{id}/customer-policies).

  3. アクセスを割り当てます。 permission set を principals / OUs に attach します(スコープされている場合、assignments は read-down cascade します)。

  4. authorization を確認します。 app が action を実行する前に、principal がそれを実行してよいか PDP(/identity/v1/authorize または /authorize/batch)に問い合わせます。

  5. Manage employees。 Workforce(store-employee)users は Identity Center directory であり、account-scoped surface ではありません。これは現在 console/JWT フロー(/identity/v1/organizations/{orgId}/identity-center/users)です — Workforce users を参照してください。(以前の account-scoped の AK/SK surface /identity/v1/accounts/{id}/workforce-users は retired になりました。)

各 step は https://api.flexgalaxy.ai への 1 回の signed HTTPS call です。実際の requests は [External developer API examples](https://docs.flexgalaxy.ai/dev/dotid/examples/external-developer-api/index/) を参照してください。

会員アカウントの管理

組織の管理アカウントは、AK / SK上のメンバーアカウントを管理します。コンソールとメンバーアカウントのログインは必要ありません。 これらのコールを管理アカウントのキーに署名します。

オペレーション

電話番号

メンバーアカウントを読む

GET  /organizations/v1/{orgId}/accounts/{account_id}

会員アカウントの名前を変更する

PUT  /organizations/v1/{orgId}/accounts/{account_id} — body {"name": …, "description": …}

会員アカウントを中断

POST /organizations/v1/{orgId}/accounts/{account_id}/suspend

中断されたメンバーアカウントの復元

POST /organizations/v1/{orgId}/accounts/{account_id}/restore

会員アカウントへのアクセス

DELETE /organizations/v1/{orgId}/accounts/{account_id}

認証は管理アカウントで行います。 上記のすべての操作は、あなたの鍵が拘束されるときのみ許可されます。{orgId} の管理アカウントであり、{accountId}は、その組織のメンバーです。 他のアカウントに拘束されるキーは、403を取得します。

Suspendはリバーシブルです。 suspendは、メンバーアカウントを凍結し、ユーザーに署名します。 restoreはアクティブに戻ります。 両方があなたの管理の資格によって承認されるので — 会員アカウント自体の独立者 — あなたはいつもあなたが中断したメンバーを復元することができます; 中断は、片道のドアではありません。

注釈

管理アカウントは、itself(400)を中断することはできません。 組織全体を巻き込むには、管理アカウントを中断するのではなく組織を削除します。

スコープ委任(会社のアカウントの管理者)

時々、あなたは1つのアカウントを管理するために1つのアカウントをしたいです。例えば、店舗が後で開いているすべての店に到達する地域のマネージャーは、それらを他のものを付与することなく。 組織の管理アカウントは、AK/SK上のOU → Managerの委任状としてこれを承認します。これは、特定の権限設定スコープを会社のOUからManagerアカウントに委任します。 その後、マネージャーには、OU のサブツリーの [every current and future account] を上回るスコープがあり、それらだけ* を持っています。 OUに置いた新しい店が自動的に覆われています。OUの外側には何もありません。

*managementアカウントの**キーでこれらを署名します。

オペレーション

電話番号

委任状を作成する

POST   /organizations/v1/{orgId}/delegations — ボディ {"delegatorOuId": …, "delegateeAccountId": …, "scopePermissionSetIds": […]}

アクティブな委任をリスト

GET    /organizations/v1/{orgId}/delegations

委任を取り消す

DELETE /organizations/v1/{orgId}/delegations/{delegationId}の特長

  • 管理アカウントにより承認される。 {orgId} の管理アカウントにあなたの鍵がバインドされるときだけすべての呼び出しが許可されます。 他のアカウントは403を取得します。

  • 推奨事項 有効な委任は 201 を戻します。 OU は、{orgId} に所属し、各権限セットが OU** (OU または ancestor に割り当てられている) で既に有効である必要があります。そうでなければ、呼び出しは 422 で拒否されます(OU が保持しない権限を委任することはできません)。 管理アカウントが403を取得していない発信者。

  • スコープのみ狭い。 マネージャーは、OU が保持しているものよりも利益を得ることはできません。また、マネージャーが退任した場合、各ホップはスコープを狭くするかもしれませんが、それを広げることはありません。

  • 取消は即時です。 DELETE …/delegations/{delegationId}は、マネージャの継承されたアクセスを一度に落とします。次の承認チェックは、キャッシュされた付与なしで反映されます。

Tip

This complements the per-account transitive delegation authoring path (/identity/v1/accounts/{account_id}/delegations), which an account uses to delegate its own scope upward. Both are now reachable over AK/SK: the account path is authorized for the account itself or its org's management account; the OU → Manager path above is management-account only.

Workforce users (Identity Center directory)

account-scoped /identity/v1/accounts/{id}/workforce-users AK/SK surface は retired され、現在は 404 を返します。 これに対して構築していた場合、呼び出しは 404 になります — 使用しないでください。

Workforce (store-employee) users は、正規には organization の Identity Center directory です:

以前 (retired, account-scoped, AK/SK)

現在 (canonical、org-scoped)

GET  …/accounts/{id}/workforce-users

GET  /identity/v1/organizations/{orgId}/identity-center/users

POST …/accounts/{id}/workforce-users (招待メール+ロール)

POST /identity/v1/organizations/{orgId}/identity-center/users

POST …/workforce-users/{u}/disable | /enable

POST …/identity-center/users/{u}/disable | /enable

POST …/workforce-users/{u}/rotate-credentials

POST …/identity-center/users/{u}/reset-password

DELETE …/workforce-users/{u}

DELETE …/identity-center/users/{u}

Programmatic access: Identity Center directory はすべての operation で authorized され、STS temporary credentials を受け入れるため、headless に workforce users を管理できます — console は不要です。flow:

  1. IdC user として、STS session-token flow(console または CLI から利用可能)経由で一時 ASIA… credentials を取得します。credentials は gateway-agnostic です — public API で動作します。

  2. /identity/v1/organizations/{orgId}/identity-center/users 呼び出しを FGAI-HMAC-SHA256 で署名し、X-FGAI-Security-Token header を含める(temporary-credential requirement — §2 を参照)。public gateway は path を保持するため、呼び出す path に対して署名する(§2)。

各 operation は identitycenter:User:{verb} (List/Read/Create/Update/Delete/ Disable/Enable/ResetPassword) に対してチェックされるため、呼び出しユーザーは organization の management account に割り当てられた、カバーする Identity Center permission set (例: IdentityCenterFullAccess) を保持している必要があります。保持していない caller は 403 を受け取ります。Bearer-JWT/console path は変更なく動作し続けます。

Pure AK/SK(interactive user なし)? service access key だけを持ち、headless に workforce users を管理したい場合は、identitycenter:User:* permission を持つ role を assume し、その temporary credentials で操作してください — Manage workforce (Identity Center) users headlessly (M2M) を参照してください。

IAM roles & AssumeRole

service credential(または JWT user)は、account ごとの IAM roles を作成し、それらを assume して一時的でスコープ付きの credentials を取得できます — AWS に忠実な cross-account メカニズムです:

  • POST /identity/v1/accounts/{account_id}/roles — create a role (trust policy + attached permission policies).

  • POST /identity/v1/sts/assume-role — roleFrn によってロールを引き受けます。ロールの権限でそのロールのアカウント内で動作する一時 ASIA 認証情報 (X-FGAI-Security-Token ヘッダーと共に使用) を返します。

1 つの organization 内の accounts 間のクロスアカウント管理では、各 member account に自動プロビジョニングされる OrganizationAccountAccessRole を使用します。management account はそれを assume して、その member の IAM を管理します。

同じ assume-role mechanism が headless workforce-user management を支える — Manage workforce (Identity Center) users headlessly (M2M) を参照。

Enterprise onboarding (bulk accounts)

Onboard a company's accounts in bulk instead of looping single POST /accounts/v1/provision calls. All three calls are authorized by management-account ownership (your key's account must be the org's management account) — the AWS-faithful model.

  1. Create placeholders — POST /organizations/v1/{orgId}/account-batches

    { "accounts": [ { "name": "account-shibuya-01" }, { "name": "account-shibuya-02" } ] }
    

    → 202 Accepted with the placeholder roster; each account starts status: "PLACEHOLDER", realm_status: "NONE":

    { "org_id": "…", "placeholders_created": 2,
      "accounts": [ { "account_id": "…", "name": "account-shibuya-01",
                      "status": "PLACEHOLDER", "realm_status": "NONE", "version": 0 } ] }
    
  2. Promote an account to ACTIVE (first operator grant) — POST /organizations/v1/{orgId}/onboarding/accounts/{account_id}/grant-operator → 200 with the account now status: "ACTIVE". The sibling …/{accountId}/provision-service-user onboards the account's first service user and completes account activation — the current model has no per-account realms.

  3. Surface live status — GET /organizations/v1/{orgId}/account-lifecycle[?status=PLACEHOLDER] → 200 with the ordered roster; every row carries status (PLACEHOLDER / MATERIALIZING / ACTIVE / CLOSED) and realm_status.

PassPort app-entry routing

On a PassPort deep-link / Open, resolve whether to route the user to onboarding or the app: POST /passport/v1/app-entry/resolve ({ "app_id": …, "account_id": …, "user_type": "workforce" }) → the routing decision keyed on the target account's lifecycle.

重要

app-entry/resolve authenticates the workforce user's DotID session (a Keycloak Bearer JWT), not a service AK/SK — it routes that signed-in user and verifies they are an assigned member of the account. Call it with the end-user's DotID access token (the one your app receives from OIDC login), which the public gateway forwards. A service AK/SK gets 401 here by design. The read surface GET /passport/v1/applications/{appId} is public.

Declaring a split onboarding entry. By default every account resolves to the app's homepage_url (route APP). To route not-yet-active (PLACEHOLDER / MATERIALIZING) accounts to a distinct onboarding page, set surfaces.app_launch.onboarding_entry_url (a relative browser path, e.g. /welcome) when you register the app via POST /developer/v1/services. The surfaces object is required on registration; its app_launch slice takes launch_path, required_action, resource_frn_pattern, allowed_redirect_paths, and the optional onboarding_entry_url. Omit onboarding_entry_url and app-entry always returns APP.