REST API リファレンス
このページは、MeMesh を自分たちの仕組みと連携したい人向けです。ワークスペース、実行制御、承認、メモリ、チーム関連の API をまとめています。
https://api.memesh.ai/v1今このページが必要か迷ったら
初めて MeMesh を試すだけなら、まずは docs overview や Setup を見てください。自動化したい、外部システムから runtime を呼びたい、といった段階でこのページに戻るのが最短です。
認証ヘッダー
x-api-key: mk_your_api_key_hereすべてのリクエストに有効な API key が必要です。Setup > Agent Access Keys から作成できます。
Agent Workspace
workspace 単位の dispatch targets と target-level governance の真相です。
/agents/dispatch-targetsこの workspace で使えるローカル / リモート dispatch targets を一覧表示します。可否、runtime policy、control 状態、互換性要約を含みます。
Query: search?, targetKind? (LOCAL_AGENT|REMOTE_A2A), state?, limit?, offset?
/agents/dispatch-targets/:id1 つの dispatch target を取得し、remote control capability か local runtime summary を確認します。
/agents/dispatch-targets/:id/governanceruntime policy、review 状態、incident handoff、recent runs、recent audit、影響中の仕事などを確認します。
/agents/dispatch-targets/:id/holddispatch target に手動 hold をかけます。最新の runtime CAS token が必要です。
Body: { reason, releaseAfter?, expectedRuntimeUpdatedAt }
/agents/dispatch-targets/:id/release手動 hold を解除し、同じ CAS 保護 mutation で有効 policy を再計算します。
Body: { note?, expectedRuntimeUpdatedAt }
/agents/dispatch-targets/:id/review/acknowledge現在の policy epoch に対する governance review を処理済みとして記録します。
Body: { note?, expectedRuntimeUpdatedAt }
/agents/dispatch-targets/:id/incident/handoff現在の incident epoch に対する provider incident handoff を記録します。
Body: { externalIncidentId, owner, note?, expectedRuntimeUpdatedAt }
Memory
記憶を保存し、意味ベースで検索できます。
/memory/write任意の metadata 付きで 1 件の memory を保存します。
Body: { content, space?, summary?, tags?, sensitivity?, source? }
/memory/search自然言語クエリで memory を検索する GET 版です。
Query: query (required), spaces?, limit?
/memory/search構造化 POST body で memory を検索します。複雑な条件のときに向いています。
Body: { query, spaces?, limit? }
/memory/count現在のユーザーが持つ memory の総数を返します。
/memory/batch最大 100 件の memory を 1 回で保存します。transactional と partial success を選べます。
Body: { memories[], transactional? }
/memory/batch/search最大 50 件の検索を並列実行し、必要なら重複除去も行えます。
Body: { queries[], deduplicate? }
/memory/spaces現在のユーザーが使っている memory spaces を一覧表示します。
/memory/query意味検索、タグ、時間条件を組み合わせた memory query を実行します。
Body: { query, limit?, offset?, similarityThreshold? }
/memory/context-windowtoken 予算内で LLM の context window に入れる memory を選びます。
Body: { query, tokenBudget }
/memory/stream/export大きな memory export を Server-Sent Events で順次出力します。
Query: spaces?
Orchestrator Runtime
永続化された runs、control truth、reconcile、retry-cancel、runtime health を扱います。
/orchestrator/runsrecent runs を target kind、control truth、approval links、operator guidance 付きで返します。
/orchestrator/runs/:id1 つの run について、events、approvals、remote control state、推奨アクションを返します。
/orchestrator/runs/:id/control1 つの run に対する control capability truth、block reasons、operator guidance を返します。
/orchestrator/runs/:id/reconcileremote state を強制再取得し、遅れて届いた terminal truth と整合させます。
/orchestrator/runs/:id/retry-canceltimeout や一時的失敗のあとで remote cancel を再試行します。
/orchestrator/runs/:id/resolve-remoteremote recovery が尽きた後に、ガード付きの operator resolution を実行します。
/orchestrator/runtime-healthlocal compatibility、remote escalation、target governance、attention backlog の health summary を返します。
Local Agent Execution
claim token ベースの local execution queue で、lease、heartbeat、recovery、cancel acknowledgement を扱います。
/agents/executions現在の agent が処理できる pending local executions を一覧表示します。
/agents/executions/:id/claim呼び出し元が用意した claim token で local execution を claim します。
Body: { claimToken, workerId? }
/agents/executions/:id/heartbeat現在の lease を延長し、必要なら進捗も報告します。
Body: { claimToken, progressMessage? }
/agents/executions/:id/completeclaim 済み execution を完了します。
Body: { claimToken, result?, idempotencyKey? }
/agents/executions/:id/ack-cancelruntime がローカル中断を求めたあと、cancel を受け取ったことを返します。
Body: { claimToken, note? }
Team
team members、招待、role-based access control を扱います。
/team/members現在の tenant に属する team members を一覧表示します。
/team/members/inviteemail で新しい member を招待します。OWNER または ADMIN が必要です。
Body: { email, role? }
/team/members/:userId/roleteam member の role を変更します。
Body: { role }
/team/members/:userIdmember を team から外します。
Audit
セキュリティ確認やコンプライアンス向けに audit logs を参照します。
/audit/logsaction、resource、期間、limit で audit logs を検索します。
Query: action?, resource?, startDate?, endDate?, limit? (default: 100)
Billing & Usage
subscription plan、usage statistics、quota の状態を確認します。
/billing/plan現在のユーザーの subscription plan を取得します。
/usage/summarymemory、API keys、agents、seats、rate limits を含む usage summary を返します。
API Keys
自動連携用の API key を作成、一覧、無効化できます。
/keys新しい API key を作成します。生の key 値はレスポンスで 1 度だけ表示されます。
Body: { name }
/keys現在のユーザーの API keys を一覧表示します。値はマスクされています。
/keys/:idAPI key を完全に無効化します。
Device Authorization
CLI や MCP clients 向けの OAuth 2.0 Device Authorization flow です。
/auth/devicedevice authorization flow を開始し、device_code、user_code、verification_uri を返します。
Body: { client_id, scope? }
/auth/device/tokenユーザーが承認したあとで token を polling します。
Body: { grant_type: "urn:ietf:params:oauth:grant-type:device_code", device_code }
リクエスト例
curl "https://api.memesh.ai/v1/agents/dispatch-targets?targetKind=REMOTE_A2A&limit=10" \
-H "x-api-key: mk_your_api_key"curl -X POST https://api.memesh.ai/v1/orchestrator/runs/run_123/reconcile \
-H "x-api-key: mk_your_api_key" \
-H "Content-Type: application/json"curl -X POST https://api.memesh.ai/v1/agents/dispatch-targets/{targetId}/hold \
-H "x-api-key: mk_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"reason": "provider maintenance",
"releaseAfter": "2026-03-22T09:00:00.000Z",
"expectedRuntimeUpdatedAt": "2026-03-20T09:00:00.000Z"
}'HTTP ステータスコード
| コード | 説明 |
|---|---|
| 200 | 成功 |
| 201 | 作成完了(resource created) |
| 400 | 不正なリクエスト(validation error、無効な Agent Card) |
| 401 | 未認証(API key が無効または未指定) |
| 403 | 禁止(self-review blocked、権限不足) |
| 404 | 見つからない(agent または resource が存在しない) |
| 409 | 競合(stale policy epoch、stale runtime snapshot、duplicate claim) |
| 429 | リクエスト過多(rate limit exceeded) |