Agent API
REST で secure handoff を組み込む
Authorization: Bearer sl_agent_... を使い、用途制約付きトークンの範囲で create / finalize / revoke / logs / audit context を呼び出せます。
認証と利用条件
認証ヘッダー
Authorization: Bearer sl_agent_agt_xxxxxxxxxxxxxxxx_yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyBusiness 以上で利用できます。
Business 以上では、同じ handoff を Web アプリ経由で Slack workspace の channel / DM に投稿する導線も使えます。
トークンは raw secret を発行時に一度だけ表示します。
トークンには scope、purpose、宛先ドメイン、IP、期限、最大ファイルサイズを設定できます。URL共有ではリンク先ドメインも監査文脈に含められます。
TOTP 有効組織では、発行・閲覧・失効時に追加確認が入ります。
送信側の API 導線
いまの主ユースケースです。自社の AI が送信者となり、ファイル登録、転送完了、共有停止、監査追記までを API で完結します。
共有リンクの配布先として Slack を使う場合も、revoke、監査、workspace ごとの posting policy は同じ基盤に残ります。Agent API と Slack delivery は入口が違うだけです。
受信側の API 導線
受信企業がアカウントを持つ場合は、受信した資料を自社 AI に回す次のワークフローでこの API を使います。まず /api/agent/receive で AI が受信し、その後に必要なら自社の送信者として新しい handoff を作る形です。
最短の疎通確認
送信側は create API、受信側は receive API を 1 本叩けば、トークン、scope、recipient domain 制約、暗号パラメータまたは URL 情報の受け渡しまで確認できます。
cURL 例: ファイル共有
curl -X POST https://www.sealith.com/api/agent/transfers \
-H "Authorization: Bearer sl_agent_..." \
-H "Content-Type: application/json" \
-d '{
"purpose": "contract_review",
"jobId": "job_20260423_001",
"transfer": {
"fileName": "nda.pdf",
"fileSizeBytes": 524288,
"mimeType": "application/pdf",
"recipients": [{ "email": "legal@example.com", "name": "法務担当" }],
"message": "レビューをお願いします。",
"salt": "base64url-salt",
"ivFile": "base64url-file-iv",
"ivWrap": "base64url-wrap-iv",
"passcodeHash": "argon2id-passcode-hash",
"systemAccessiblePasscode": "kms-wrapped-passcode",
"expiresAt": "2026-04-30T12:00:00.000Z",
"maxDownloads": 3,
"passcodeDeliveryMode": "B",
"sensitivityLevel": "confidential"
}
}'cURL 例: URL共有
curl -X POST https://www.sealith.com/api/agent/transfers \
-H "Authorization: Bearer sl_agent_..." \
-H "Content-Type: application/json" \
-d '{
"purpose": "dd_link_review",
"jobId": "job_20260423_002",
"transfer": {
"resourceType": "url",
"title": "DD資料共有リンク",
"targetUrl": "https://drive.google.com/file/d/xxx/view",
"targetDomain": "drive.google.com",
"recipients": [{ "email": "legal@example.com", "name": "法務担当" }],
"message": "リンク先の資料確認をお願いします。",
"passcodeHash": "argon2id-passcode-hash",
"systemAccessiblePasscode": "kms-wrapped-passcode",
"expiresAt": "2026-04-30T12:00:00.000Z",
"maxDownloads": 3,
"passcodeDeliveryMode": "B",
"sensitivityLevel": "confidential"
}
}'POST /api/agent/transfers
scope: transfers:create暗号化ファイル共有または監査付きURL共有の handoff を作成します。REST Agent API は従来どおり file で uploadUrl を返し、MCP では small file inline と large file upload session の抽象化を上に重ねています。passcodeDeliveryMode=B の場合は、組織設定に応じてパスコード送信予約時刻も返します。
Request
{
"purpose": "contract_review",
"jobId": "job_20260423_001",
"aiProvider": "anthropic",
"aiClient": "claude_code",
"aiModel": "claude-sonnet-4",
"transfer": {
"fileName": "nda.pdf",
"fileSizeBytes": 524288,
"mimeType": "application/pdf",
"recipients": [
{ "email": "legal@example.com", "name": "法務担当" }
],
"message": "レビューをお願いします。",
"salt": "base64url-salt",
"ivFile": "base64url-file-iv",
"ivWrap": "base64url-wrap-iv",
"passcodeHash": "argon2id-passcode-hash",
"senderAccessiblePasscode": null,
"systemAccessiblePasscode": "kms-wrapped-passcode",
"expiresAt": "2026-04-30T12:00:00.000Z",
"maxDownloads": 3,
"passcodeDeliveryMode": "B",
"sensitivityLevel": "confidential"
}
}Response
{
"transferId": "tr_xxxxxxxxxxxxxxxx",
"uploadUrl": "https://storage.example.com/...",
"expiresIn": 300,
"shareUrlPath": "/r/tr_xxxxxxxxxxxxxxxx",
"passcodeScheduledSendAt": "2026-04-23T06:10:00.000Z"
}POST /api/agent/transfers (resourceType=url)
scope: transfers:createGoogle Drive や Box などの共有URLを、パスコードと監査付きで渡す handoff を作成します。Sealith が保護するのは URL の受け渡しと監査であり、リンク先の権限管理は外部サービス側です。MCP ではこの作成から通知までを 1 ステップで扱えます。
Request
{
"purpose": "dd_link_review",
"jobId": "job_20260423_002",
"aiProvider": "openai",
"aiClient": "chatgpt_connector",
"transfer": {
"resourceType": "url",
"title": "DD資料共有リンク",
"targetUrl": "https://drive.google.com/file/d/xxx/view",
"targetDomain": "drive.google.com",
"recipients": [
{ "email": "legal@example.com", "name": "法務担当" }
],
"message": "リンク先の資料確認をお願いします。",
"passcodeHash": "argon2id-passcode-hash",
"senderAccessiblePasscode": null,
"systemAccessiblePasscode": "kms-wrapped-passcode",
"expiresAt": "2026-04-30T12:00:00.000Z",
"maxDownloads": 3,
"passcodeDeliveryMode": "B",
"sensitivityLevel": "confidential"
}
}Response
{
"transferId": "tr_xxxxxxxxxxxxxxxx",
"uploadUrl": null,
"expiresIn": 300,
"shareUrlPath": "/r/tr_xxxxxxxxxxxxxxxx",
"passcodeScheduledSendAt": "2026-04-23T06:10:00.000Z"
}GET /api/agent/transfers/:id
scope: transfers:read作成済み handoff の状態を返します。recipient ごとの通知状況、passcodeScheduledSendAt、download 数または外部リンク遷移数などの確認に使います。
Request
GET /api/agent/transfers/tr_xxxxxxxxxxxxxxxxResponse
{
"transfer": {
"id": "tr_xxxxxxxxxxxxxxxx",
"fileName": "nda.pdf",
"fileSizeBytes": 524288,
"mimeType": "application/pdf",
"recipients": [
{
"email": "legal@example.com",
"name": "法務担当",
"notifiedUrlAt": "2026-04-23T06:00:00.000Z",
"notifiedPasscodeAt": null,
"firstAccessedAt": null,
"downloadCount": 0
}
],
"status": "active",
"expiresAt": "2026-04-30T12:00:00.000Z",
"maxDownloads": 3,
"totalDownloadCount": 0,
"passcodeDeliveryMode": "B",
"passcodeScheduledSendAt": "2026-04-23T06:10:00.000Z",
"createdAt": "2026-04-23T06:00:00.000Z"
}
}POST /api/agent/transfers/:id/finalize
scope: transfers:finalizeアップロード後に handoff を有効化し、受信者へ URL 通知を送ります。標準転送では後続のパスコード送信予約も作成されます。
Request
{
"shareUrl": "https://www.sealith.com/r/tr_xxxxxxxxxxxxxxxx"
}Response
{
"ok": true
}POST /api/agent/transfers/:id/revoke
scope: transfers:revokehandoff を共有停止します。未送信のパスコード通知があれば同時にキャンセルします。
Request
{}Response
{
"ok": true
}GET /api/agent/transfers/:id/logs
scope: logs:readagent に紐づく監査ログを返します。eventType、purpose、jobId、tokenId、metadata まで含みます。
Request
GET /api/agent/transfers/tr_xxxxxxxxxxxxxxxx/logsResponse
{
"logs": [
{
"id": "log_xxxxx",
"sequence": 12,
"eventHash": "9db4...",
"previousHash": "f0ab...",
"canonicalPayloadHash": "3b81...",
"hashAlgorithm": "sha256",
"eventTime": "2026-04-23T06:12:10.000Z",
"eventType": "agent_audit_context_appended",
"actorType": "agent",
"actorId": "contract-review-agent",
"actorName": "契約レビューエージェント",
"actorEmail": null,
"tokenId": "agt_xxxxx",
"purpose": "contract_review",
"jobId": "job_20260423_001",
"scope": "audit:append",
"success": true,
"errorCode": null,
"metadata": {
"note": "要確認条項を抽出しました。",
"result": "needs_human_review"
},
"createdAt": "2026-04-23T06:12:10.000Z"
}
]
}POST /api/agent/audit-context
scope: audit:appendAI が何を判断したかを purpose / jobId / aiProvider / aiClient / note / result として監査ログへ追記します。aiModel は取得できる場合のみ任意です。
Request
{
"transferId": "tr_xxxxxxxxxxxxxxxx",
"purpose": "contract_review",
"jobId": "job_20260423_001",
"aiProvider": "anthropic",
"aiClient": "claude_code",
"aiModel": "claude-sonnet-4",
"note": "要確認条項を抽出しました。",
"result": "needs_human_review",
"metadata": {
"model": "gpt-5.4",
"reviewCount": 4
}
}Response
{
"ok": true
}POST /api/agent/receive
scope: transfers:read人が作成した handoff を AI が受信するための endpoint です。file では復号に必要な暗号パラメータと署名付き download URL、url では targetUrl と targetDomain を返します。
Request
{
"transferId": "tr_xxxxxxxxxxxxxxxx",
"passcode": "A2b!C3d@E4f#G5h$",
"purpose": "contract_review",
"jobId": "job_20260423_001",
"aiProvider": "anthropic",
"aiClient": "claude_app",
"recipientEmail": "legal@example.com"
}Response
{
"resourceType": "file",
"signedUrl": "https://storage.example.com/...",
"fileName": "nda.pdf",
"fileSizeBytes": 524288,
"mimeType": "application/pdf",
"ciphertext": {
"expiresIn": 300
},
"crypto": {
"salt": "base64url-salt",
"ivFile": "base64url-file-iv",
"ivWrap": "base64url-wrap-iv"
},
"metadata": {
"senderEmail": "owner@example.com",
"senderDisplayName": "営業担当",
"message": "レビューをお願いします。"
}
}POST /api/agent/receive (resourceType=url)
scope: transfers:readURL共有の受信時は、AI が外部サービスへ進むためのリンク情報を返します。Sealith は URL の受け渡しと監査を担当し、リンク先へのアクセス権限までは代行しません。
Request
{
"transferId": "tr_xxxxxxxxxxxxxxxx",
"passcode": "A2b!C3d@E4f#G5h$",
"purpose": "dd_link_review",
"jobId": "job_20260423_002",
"aiProvider": "openai",
"aiClient": "chatgpt_connector",
"recipientEmail": "legal@example.com"
}Response
{
"resourceType": "url",
"link": {
"targetUrl": "https://drive.google.com/file/d/xxx/view",
"targetDomain": "drive.google.com",
"title": "DD資料共有リンク"
},
"metadata": {
"senderEmail": "owner@example.com",
"senderDisplayName": "営業担当",
"message": "リンク先の資料確認をお願いします。"
}
}GET /api/agent/transfers
scope: transfers:readこのトークンが作成した handoff を一覧・検索します。q(キーワード)、status、resourceType、recipientEmail、dateFrom / dateTo、limit で絞り込めます。transfer ID を知らなくても目的の転送を探せます。
Request
GET /api/agent/transfers?status=active&q=契約書&limit=20Response
{
"transfers": [
{
"id": "tr_xxxxxxxxxxxxxxxx",
"resourceType": "file",
"fileName": "nda.pdf",
"title": "nda.pdf",
"status": "active",
"recipients": [
{
"email": "legal@example.com",
"name": "法務担当",
"firstAccessedAt": null,
"downloadCount": 0
}
],
"totalDownloadCount": 0,
"maxDownloads": 3,
"expiresAt": "2026-04-30T12:00:00.000Z",
"purpose": "contract_review",
"jobId": "job_20260423_001",
"sensitivityLevel": "confidential",
"createdAt": "2026-04-23T06:00:00.000Z"
}
],
"total": 1
}POST /api/agent/transfers/bulk
scope: transfers:revokeこのトークンが作成した handoff を一括で取り消します。最大20件。reason を指定すると監査ログに記録されます。プロジェクト終了・退職者対応・誤送信時の一括処理に使います。
Request
{
"action": "revoke",
"transferIds": [
"tr_xxxxxxxxxxxxxxxx",
"tr_yyyyyyyyyyyyyyyy"
],
"reason": "プロジェクト終了のため"
}Response
{
"ok": true,
"revokedCount": 2
}GET /api/agent/org/usage
scope: transfers:read組織のプラン上限と今月の利用状況を返します。月間転送上限に対する残件数、ファイルサイズ上限、保持日数などを確認できます。大量処理前のクォータチェックに使います。
Request
GET /api/agent/org/usageResponse
{
"plan": "business",
"limits": {
"maxMonthlyTransfers": 2000,
"maxFileSizeMB": 5120,
"maxRecipients": 10,
"maxRetentionDays": 1095
},
"usage": {
"currentMonthTransfers": 47,
"remainingMonthlyTransfers": 1953,
"resetAt": "2026-05-01T00:00:00.000Z"
},
"capabilities": {
"mcp": true,
"agentTokens": true,
"archive": true,
"openNotification": true,
"auditCsvExport": true
}
}GET /api/agent/org/audit/verify
scope: logs:read組織の監査ログ全件(最大1000件)の SHA-256 ハッシュチェーンを検証します。ok: false の場合は failures に改ざん箇所の sequence と理由が含まれます。コンプライアンス証跡・顧客向け監査報告に使います。
Request
GET /api/agent/org/audit/verifyResponse
{
"ok": true,
"checked": 128,
"verified": 125,
"legacy": 3,
"failures": [],
"latestHash": "9db4c2f3...",
"summary": "Audit chain intact. 125 events verified, 3 pre-hash legacy events skipped."
}エラーコード一覧
| HTTP | error | 意味 |
|---|---|---|
| 401 | agent_unauthorized | Authorization ヘッダーがないか Bearer 形式ではありません。 |
| 401 | invalid_agent_token | トークン形式不正、存在しないトークン、または secret 不一致です。 |
| 401 | agent_token_revoked | 発行済みトークンが失効済みです。 |
| 401 | agent_token_expired | トークン期限切れです。 |
| 401 | agent_scope_denied | 必要 scope がトークンに含まれていません。 |
| 401 | agent_ip_denied | IP allowlist に含まれない IP から呼ばれました。 |
| 400 | invalid_request | JSON 形式や必須フィールドが schema に一致しません。issues を返します。 |
| 400 | file_size_exceeds_agent_policy | トークンごとの最大ファイルサイズ制約を超えています。file の handoff で発生します。 |
| 400 | max_file_size_exceeds_plan | Agent Token に設定した最大ファイルサイズが、組織プラン上限を超えています。 |
| 400 | file_size_exceeds_plan | 組織プランのファイルサイズ上限を超えています。 |
| 400 | retention_exceeds_plan | expiresAt が組織の保管期間上限を超えています。Business は最大3年、Enterprise は管理者設定による無期限。上限は maxDays フィールドで返します。 |
| 400 | recipient_email_required | 複数宛先の receive_handoff です。どの宛先として受け取るか recipientEmail が必要です。 |
| 400 | share_url_required | finalize で shareUrl が送られていません。 |
| 429 | agent_rate_limited | Agent API の1分あたり上限に達しています。少し待ってから再試行してください。 |
| 403 | purpose_not_allowed | allowedPurposes に含まれない purpose です。 |
| 403 | recipient_domain_not_allowed | allowedRecipientDomains 外の宛先が含まれています。 |
| 403 | mode_b_not_allowed | 組織設定で Mode B が無効です。 |
| 403 | monthly_transfer_limit_reached | 組織の月間送信上限に達しています。 |
| 403 | ai_handoff_limit_reached | 今月の AI handoff 上限に達しています。 |
| 403 | ai_audit_append_limit_reached | 今月の AI監査追記上限に達しています。 |
| 403 | feature_not_available_on_plan | Business 未満のため Agent API を使えません。 |
| 403 | agent_token_limit_reached | このプランで発行できる Agent Token 上限に達しています。 |
| 403 | forbidden | 別組織または別 token が作成した transfer にアクセスしています。 |
| 404 | not_found | 対象 transfer が存在しません。 |
| 404 | recipient_not_found | 指定した recipientEmail がこの transfer の宛先に含まれていません。 |
| 409 | invalid_status | finalize 時点で transfer が draft 以外です。 |
| 503 | service_not_configured | メールや外部サービスの環境変数が不足しています。 |
フィールドの見どころ
purpose は監査ログと token 制約の両方に効きます。
jobId、aiProvider、aiClient は AI 起点の呼び出しで必須です。あとから具体的なワークフローと実行クライアントへ結び直せるようにします。
passcodeDeliveryMode は A または B を取ります。B は systemAccessiblePasscode が必要です。
sensitivityLevel は public / internal / confidential / restricted です。
shareUrlPath は create の戻り値です。最終的な公開 URL は自前の base URL と結合して finalize に渡します。
/api/agent/receive は transferId と passcode を受け取り、AI が復号処理へ進むための暗号パラメータと短期 download URL を返します。