APIリファレンス

アクション

アクションはMCPサーバーのツールをRESTで使うものです。それぞれがMCPツールと同じ名前、入力、結果を持つので、スクリプトはAIアシスタントと同じことを、APIキーだけでMCPクライアントなしに実行できます。

ほとんどは、ほかのページに専用のエンドポイントもあります。エンドポイントのないツールを使うときや、すべてのツールを同じ方法で呼び出したいときにアクションを使ってください。

アクションオブジェクト

キーから見えるMCPサーバーのツール1つです。

属性

  • objectstring
    常にactionです。
  • namestring
    名前です。MCPツールと同じで、たとえばsearch_leadsです。
  • titlestring
    短いタイトルです。
  • descriptionstring
    何をして何を返すかの説明で、AIアシスタントが読む文章です。
  • scopestring
    データを変更するものはwriteです。readのキーはそれ以外だけを実行できます。
    readwrite
  • input_schemaobject
    受け取るボディのJSON Schemaで、フィールドと必須のものを示します。
アクションオブジェクト
{
  "object": "action",
  "name": "get_lead",
  "title": "Get lead",
  "description": "One lead by id: X profile, score and reason, hot, status, persona, campaign, conversation id, locked_to (the one X account of the owner allowed to contact this person, when a campaign or a conversation holds it), your metadata.",
  "scope": "read",
  "input_schema": {
    "type": "object",
    "properties": {
      "lead_id": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64,
        "description": "From search_leads."
      }
    },
    "required": ["lead_id"],
    "additionalProperties": false
  }
}

アクションを一覧表示

GET/v1/actionsreadスコープ

キーで実行できるすべてのアクションを名前順に返します。

戻り値

アクションオブジェクトのリストで、すべて1ページに入ります。

GET/v1/actions
curl https://gemlead.ai/api/v1/actions \
  -H "Authorization: Bearer $GEMLEAD_API_KEY"
レスポンス200
{
  "object": "list",
  "data": [
    {
      "object": "action",
      "name": "get_lead",
      "title": "Get lead",
      "description": "One lead by id: X profile, score and reason, hot, status, persona, campaign, conversation id, locked_to (the one X account of the owner allowed to contact this person, when a campaign or a conversation holds it), your metadata.",
      "scope": "read",
      "input_schema": {
        "type": "object",
        "properties": {
          "lead_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "From search_leads."
          }
        },
        "required": ["lead_id"],
        "additionalProperties": false
      }
    }
  ],
  "has_more": false
}

アクションを取得

GET/v1/actions/:namereadスコープ

受け取るボディのスキーマとともに、アクションを1つ返します。

パスパラメーター

  • namestring必須
    アクションの名前です。たとえばsearch_leadsです。

戻り値

アクションオブジェクトです。

エラー

GET/v1/actions/:name
curl https://gemlead.ai/api/v1/actions/get_lead \
  -H "Authorization: Bearer $GEMLEAD_API_KEY"
レスポンス200
{
  "object": "action",
  "name": "get_lead",
  "title": "Get lead",
  "description": "One lead by id: X profile, score and reason, hot, status, persona, campaign, conversation id, locked_to (the one X account of the owner allowed to contact this person, when a campaign or a conversation holds it), your metadata.",
  "scope": "read",
  "input_schema": {
    "type": "object",
    "properties": {
      "lead_id": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64,
        "description": "From search_leads."
      }
    },
    "required": ["lead_id"],
    "additionalProperties": false
  }
}

アクションを実行

POST/v1/actions/:namereadスコープ

MCPサーバーがツールを実行するのと同じように、アクションを1つ実行します。ボディは入力で、input_schemaにあるフィールドを送ります。何も受け取らないアクションなら空です。スコープがwriteのアクションにはwrite付きのキーが必要です。

パスパラメーター

  • namestring必須
    アクションの名前です。たとえばsearch_leadsです。

戻り値

アクション結果オブジェクトです。アクション自身のエラーはそのまま返ります。たとえばアカウントにないリードならresource_missingです。

エラー

  • キーで使える、この名前のアクションはありません。名前はアクションを一覧表示で確認できます。
  • アクションのスコープはwriteですが、キーはreadです。
  • アクションに必要なフィールドがありません。paramがその名前を示します。
  • ボディがアクションのinput_schemaと合いません。
  • こちら側でアクションが失敗しました。リクエストを変える必要はありません。少し待ってからもう一度お試しください。
POST/v1/actions/:name
curl -X POST https://gemlead.ai/api/v1/actions/get_lead \
  -H "Authorization: Bearer $GEMLEAD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "lead_id": "msgOtJ8dvT"
  }'
レスポンス200
{
  "object": "action_result",
  "action": "get_lead",
  "result": {
    "id": "msgOtJ8dvT",
    "object": "lead",
    "profile": {
      "x_user_id": "1460283925",
      "username": "jane_builds",
      "name": "Jane Doe",
      "bio": "Runs a paid trading community. Daily setups, no hype.",
      "followers_count": 12400,
      "following_count": 380,
      "location": "Austin, TX",
      "website": "https://janedoe.com",
      "profile_image_url": "https://pbs.twimg.com/profile_images/1460283925/jane_400x400.jpg",
      "verified": true,
      "url": "https://x.com/jane_builds"
    },
    "score": 86,
    "score_reason": "Runs a paid trading community and asks how to collect payments for it.",
    "hot": true,
    "status": "scored",
    "persona": {
      "id": "lvWBPnytpS",
      "name": "Tipsters"
    },
    "campaign": null,
    "conversation_id": null,
    "locked_to": null,
    "found_at": "2026-11-05T14:02:11.482Z",
    "scored_at": "2026-11-05T14:03:40.117Z",
    "updated_at": "2026-11-05T14:03:40.117Z",
    "metadata": {},
    "contact": null
  }
}

アクション結果オブジェクト

アクションを実行したときに返されたものです。

属性

  • objectstring
    常にaction_resultです。
  • actionstring
    アクションの名前です。
  • resultany
    結果です。MCPツールと同じで、たとえばget_leadならリードオブジェクトです。何も返さないときはnullです。
アクション結果オブジェクト
{
  "object": "action_result",
  "action": "get_lead",
  "result": {
    "id": "msgOtJ8dvT",
    "object": "lead",
    "profile": {
      "x_user_id": "1460283925",
      "username": "jane_builds",
      "name": "Jane Doe",
      "bio": "Runs a paid trading community. Daily setups, no hype.",
      "followers_count": 12400,
      "following_count": 380,
      "location": "Austin, TX",
      "website": "https://janedoe.com",
      "profile_image_url": "https://pbs.twimg.com/profile_images/1460283925/jane_400x400.jpg",
      "verified": true,
      "url": "https://x.com/jane_builds"
    },
    "score": 86,
    "score_reason": "Runs a paid trading community and asks how to collect payments for it.",
    "hot": true,
    "status": "scored",
    "persona": {
      "id": "lvWBPnytpS",
      "name": "Tipsters"
    },
    "campaign": null,
    "conversation_id": null,
    "locked_to": null,
    "found_at": "2026-11-05T14:02:11.482Z",
    "scored_at": "2026-11-05T14:03:40.117Z",
    "updated_at": "2026-11-05T14:03:40.117Z",
    "metadata": {},
    "contact": null
  }
}