iMarioiMario
ドキュメントAPI リファレンス

ガイド

API の概要とクイックスタート認証サンドボックスとテストキーAPI のエラーページ分割冪等なリクエストレート制限API のバージョン管理Webhook

エンドポイント

エンドポイント一覧ワークスペースオーディエンス合成ペルソナ調査レポートライブラリファイル自律調査データ連携メンバーAPI キーWebhook エンドポイント
エンドポイント

Webhook エンドポイント

iMario がイベントを送るエンドポイント、テストイベント、署名シークレット、配信ログ。オーナーと管理者のみ。

ベース URL は https://api.imario.ai/v1 です。各呼び出しには、記載のスコープを持つキーが必要です。キーのロールも、記載のロール以上である必要があります(認証を参照)。エラーについては API のエラーを参照してください。

Webhook エンドポイントの一覧を取得

GET /v1/webhook-endpoints

スコープ webhooks:read · ロール オーナーまたは管理者

キーのモード(本番またはテスト)のエンドポイントを、新しい順に返します。webhook_endpoint のフィールドは id、livemode(テストキーで作成したエンドポイントはテスト用で、サンドボックスのイベントだけを受け取ります)、created_at、url、description、events(イベントの種類。すべてなら ["*"])、enabled、disabled_reason(配信が3日間失敗し続けて iMario がオフにした場合は delivery_failures、ほかに disabled_by_user または null)です。

パラメーター

名前場所型必須説明
limitクエリintegerいいえ返すオブジェクトの数(1〜100)。既定値は 20 です。
cursorクエリstringいいえ前のページの next_cursor。200文字まで。

例

curl https://api.imario.ai/v1/webhook-endpoints \
  -H "Authorization: Bearer $IMARIO_API_KEY"

レスポンス

リストを返します:{"object": "list", "data": [...], "has_more": false, "next_cursor": null}。ページ分割を参照してください。

Webhook エンドポイントを作成

POST /v1/webhook-endpoints

スコープ webhooks:write · ロール オーナーまたは管理者

レスポンスには secret(whsec_...)が含まれます。表示されるのはこの1回だけです。webhook-signature(Standard Webhooks)の検証に使うので、保管してください。URL は https で、公開アドレスだけに解決される必要があります。配信のたびに、あらためて確認します。webhook_endpoint のフィールドは id、livemode(テストキーで作成したエンドポイントはテスト用で、サンドボックスのイベントだけを受け取ります)、created_at、url、description、events(イベントの種類。すべてなら ["*"])、enabled、disabled_reason(配信が3日間失敗し続けて iMario がオフにした場合は delivery_failures、ほかに disabled_by_user または null)です。

リクエスト本文

フィールド型必須説明
urlstringはい公開されている https の URL。リダイレクトはたどりません。2,048文字まで。
eventsstring[]はい受け取るイベントの種類。すべての種類を受け取るなら ["*"]。20件まで。
descriptionstringいいえ200文字まで。

例

curl https://api.imario.ai/v1/webhook-endpoints \
  -H "Authorization: Bearer $IMARIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/imario/webhooks",
    "events": ["study.completed", "study.failed", "report.completed"],
    "description": "Production receiver"
  }'

Webhook エンドポイントを取得

GET /v1/webhook-endpoints/{endpoint_id}

スコープ webhooks:read · ロール オーナーまたは管理者

webhook_endpoint のフィールドは id、livemode(テストキーで作成したエンドポイントはテスト用で、サンドボックスのイベントだけを受け取ります)、created_at、url、description、events(イベントの種類。すべてなら ["*"])、enabled、disabled_reason(配信が3日間失敗し続けて iMario がオフにした場合は delivery_failures、ほかに disabled_by_user または null)です。

例

curl https://api.imario.ai/v1/webhook-endpoints/ENDPOINT_ID \
  -H "Authorization: Bearer $IMARIO_API_KEY"

Webhook エンドポイントを更新

PATCH /v1/webhook-endpoints/{endpoint_id}

スコープ webhooks:write · ロール オーナーまたは管理者

変更するフィールドだけを送ってください。webhook_endpoint のフィールドは id、livemode(テストキーで作成したエンドポイントはテスト用で、サンドボックスのイベントだけを受け取ります)、created_at、url、description、events(イベントの種類。すべてなら ["*"])、enabled、disabled_reason(配信が3日間失敗し続けて iMario がオフにした場合は delivery_failures、ほかに disabled_by_user または null)です。

リクエスト本文

フィールド型必須説明
urlstringいいえ2,048文字まで。
eventsstring[]いいえ20件まで。
descriptionstringいいえ200文字まで。
enabledbooleanいいえfalse で配信を止めます(待機中の配信は破棄します)。true でエンドポイントを再びオンにします。

例

curl -X PATCH https://api.imario.ai/v1/webhook-endpoints/ENDPOINT_ID \
  -H "Authorization: Bearer $IMARIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": false
  }'

Webhook エンドポイントを削除

DELETE /v1/webhook-endpoints/{endpoint_id}

スコープ webhooks:write · ロール オーナーまたは管理者

このエンドポイントへの待機中の配信は破棄します。{object, id, deleted: true} を返します。

例

curl -X DELETE https://api.imario.ai/v1/webhook-endpoints/ENDPOINT_ID \
  -H "Authorization: Bearer $IMARIO_API_KEY"

テストイベントを送信

POST /v1/webhook-endpoints/{endpoint_id}/test

スコープ webhooks:write · ロール オーナーまたは管理者

このエンドポイントだけに ping イベントを送るようキューに入れ(data.object はこのエンドポイント)、webhook_delivery を返します。フィールドは id、endpoint_id、event_id、event_type、status(pending、delivered、failed)、attempts、last_status_code、last_error、created_at、delivered_at、next_attempt_at です。

例

curl -X POST https://api.imario.ai/v1/webhook-endpoints/ENDPOINT_ID/test \
  -H "Authorization: Bearer $IMARIO_API_KEY"

署名シークレットを更新

POST /v1/webhook-endpoints/{endpoint_id}/rotate-secret

スコープ webhooks:write · ロール オーナーまたは管理者

新しい secret を返します。表示されるのはこの1回だけです。24時間は、配信に2つの署名(新しいシークレットと古いシークレットによるもの)が付くため、受信側はイベントを取りこぼさずに切り替えられます。webhook_endpoint のフィールドは id、livemode(テストキーで作成したエンドポイントはテスト用で、サンドボックスのイベントだけを受け取ります)、created_at、url、description、events(イベントの種類。すべてなら ["*"])、enabled、disabled_reason(配信が3日間失敗し続けて iMario がオフにした場合は delivery_failures、ほかに disabled_by_user または null)です。

例

curl -X POST https://api.imario.ai/v1/webhook-endpoints/ENDPOINT_ID/rotate-secret \
  -H "Authorization: Bearer $IMARIO_API_KEY"

エンドポイントの配信ログを取得

GET /v1/webhook-endpoints/{endpoint_id}/deliveries

スコープ webhooks:read · ロール オーナーまたは管理者

新しい順に返します。保存期間は30日です。各 webhook_delivery のフィールドは id、endpoint_id、event_id(webhook-id ヘッダーの値)、event_type、status(pending、delivered、failed)、attempts、last_status_code、last_error、created_at、delivered_at、next_attempt_at です。失敗した配信は、1分後、5分後、30分後、2時間後、6時間後、12時間後に再試行します。

パラメーター

名前場所型必須説明
limitクエリintegerいいえ返すオブジェクトの数(1〜100)。既定値は 20 です。
cursorクエリstringいいえ前のページの next_cursor。200文字まで。

例

curl https://api.imario.ai/v1/webhook-endpoints/ENDPOINT_ID/deliveries \
  -H "Authorization: Bearer $IMARIO_API_KEY"

レスポンス

リストを返します:{"object": "list", "data": [...], "has_more": false, "next_cursor": null}。ページ分割を参照してください。

← API キー

このページの内容

Webhook エンドポイントの一覧を取得Webhook エンドポイントを作成Webhook エンドポイントを取得Webhook エンドポイントを更新Webhook エンドポイントを削除テストイベントを送信署名シークレットを更新エンドポイントの配信ログを取得