APIリファレンス

アフィリエイトプログラム

アフィリエイトプログラムでは、オーナーのリンクから登録した人が支払うたびに、その一部がオーナーに支払われます。内容はアプリのアフィリエイトページと同じです。プログラムとその統計の読み取り、リンクのコードの変更、オーナーの銀行口座への残高の送金ができます。

お金が動くのは出金のときだけで、残高の全額がStripe上のオーナー自身の銀行口座に送られます。必ず事前にオーナーに確認してください。銀行口座の国はあとから変更できないため、最初の銀行口座の追加はアプリで行います。

アフィリエイトプログラムを見られるのはXアカウントのオーナーだけで、チームメンバーのキーではforbiddenが返ります。

アフィリエイトプログラムオブジェクト

アプリのアフィリエイトページと同じ内容の、オーナーのアフィリエイトプログラム。金額は米ドルです。オーナーは、自分のリンクから登録した人が支払うたびに、その一部を受け取ります。

属性

  • objectstring
    常にaffiliate_programです。
  • codestringまたはnull
    リンクのコード。?via=のあとの部分です。
  • linkstringまたはnull
    シェアするアフィリエイトリンク。
  • rate_percentinteger
    紹介した人が支払うたびに受け取る割合。アクティブな紹介の数に応じて、5%から50%まで上がります。
  • active_referralsinteger
    現在支払いを続けている紹介の数。
  • next_rate_percentintegerまたはnull
    次の報酬率。最高の報酬率に達している場合はnullです。
  • max_rate_percentinteger
    最高の報酬率。
  • rates_percentintegersの配列
    最初から最高までのすべての報酬率。
  • currencystring
    常にusdです。
  • earningsnumber
    これまでに獲得した総額。
  • balancenumber
    獲得済みで、まだ出金されていない金額。
  • payout_accountobject
    出金先となる、Stripe上の銀行口座。
  • can_cash_outboolean
    出金先の口座があり、残高がゼロより多い場合はtrue。
  • referralsobjectsの配列
    リンクから登録した人。それぞれname、email、plan、サブスクリプションのstatus、オーナーにもたらしたearned、rate_percentを含みます。
  • payoutsobjectsの配列
    銀行口座への出金。新しい順で、それぞれid、amount、currency、status、created_atを含みます。
  • tweet_reviewobject
    次回の支払いが20%オフになるレビューポスト。最初の3か月間に3回まで利用できます。
  • manage_urlstring
    アプリのアフィリエイトページ。
アフィリエイトプログラムオブジェクト
{
  "object": "affiliate_program",
  "code": "acme",
  "link": "https://gemlead.ai?via=acme",
  "rate_percent": 15,
  "active_referrals": 6,
  "next_rate_percent": 20,
  "max_rate_percent": 50,
  "rates_percent": [5, 10, 15, 20, 25, 30, 40, 50],
  "currency": "usd",
  "earnings": 1284.6,
  "balance": 342.15,
  "payout_account": {
    "connected": true,
    "payouts_enabled": true
  },
  "can_cash_out": true,
  "referrals": [
    {
      "name": "Nina Park",
      "email": "nina@parkpicks.com",
      "plan": "business",
      "status": "active",
      "earned": 309.15,
      "rate_percent": 15
    },
    {
      "name": "Leo Grant",
      "email": "leo@grantsignals.io",
      "plan": "starter",
      "status": "trialing",
      "earned": 0,
      "rate_percent": 15
    }
  ],
  "payouts": [
    {
      "id": "py8Kq2LmXv",
      "object": "affiliate_payout",
      "amount": 942.45,
      "currency": "usd",
      "status": "paid",
      "created_at": "2026-10-31T12:00:00.000Z"
    }
  ],
  "tweet_review": {
    "discount_percent": 20,
    "status": "approved",
    "post_url": "https://x.com/acme/status/1985402219876543210",
    "used": 1,
    "remaining": 2,
    "max": 3,
    "discount_pending": false,
    "can_submit": true,
    "window_open": true,
    "window_ends_at": "2026-12-14T09:21:05.000Z",
    "submitted_at": "2026-10-02T11:04:37.000Z",
    "reviewed_at": "2026-10-02T11:06:12.000Z",
    "last_checked_at": "2026-11-06T06:00:00.000Z",
    "reply_found": true,
    "draft": null,
    "draft_validated": false
  },
  "manage_url": "https://gemlead.ai/app/affiliate"
}

アフィリエイトプログラムを取得

GET/v1/affiliatereadスコープMCPget_affiliate

リンク、報酬率、紹介、残高、出金、レビューポストの割引を返します。

戻り値

アフィリエイトプログラムオブジェクト。

エラー

  • キーはチームメンバーのものです。この操作はXアカウントのオーナーしかできません。
GET/v1/affiliate
curl https://gemlead.ai/api/v1/affiliate \
  -H "Authorization: Bearer $GEMLEAD_API_KEY"
レスポンス200
{
  "object": "affiliate_program",
  "code": "acme",
  "link": "https://gemlead.ai?via=acme",
  "rate_percent": 15,
  "active_referrals": 6,
  "next_rate_percent": 20,
  "max_rate_percent": 50,
  "rates_percent": [5, 10, 15, 20, 25, 30, 40, 50],
  "currency": "usd",
  "earnings": 1284.6,
  "balance": 342.15,
  "payout_account": {
    "connected": true,
    "payouts_enabled": true
  },
  "can_cash_out": true,
  "referrals": [
    {
      "name": "Nina Park",
      "email": "nina@parkpicks.com",
      "plan": "business",
      "status": "active",
      "earned": 309.15,
      "rate_percent": 15
    },
    {
      "name": "Leo Grant",
      "email": "leo@grantsignals.io",
      "plan": "starter",
      "status": "trialing",
      "earned": 0,
      "rate_percent": 15
    }
  ],
  "payouts": [
    {
      "id": "py8Kq2LmXv",
      "object": "affiliate_payout",
      "amount": 942.45,
      "currency": "usd",
      "status": "paid",
      "created_at": "2026-10-31T12:00:00.000Z"
    }
  ],
  "tweet_review": {
    "discount_percent": 20,
    "status": "approved",
    "post_url": "https://x.com/acme/status/1985402219876543210",
    "used": 1,
    "remaining": 2,
    "max": 3,
    "discount_pending": false,
    "can_submit": true,
    "window_open": true,
    "window_ends_at": "2026-12-14T09:21:05.000Z",
    "submitted_at": "2026-10-02T11:04:37.000Z",
    "reviewed_at": "2026-10-02T11:06:12.000Z",
    "last_checked_at": "2026-11-06T06:00:00.000Z",
    "reply_found": true,
    "draft": null,
    "draft_validated": false
  },
  "manage_url": "https://gemlead.ai/app/affiliate"
}

アフィリエイトコードを確認

GET/v1/affiliate/code_availabilityreadスコープMCPget_affiliate

リンクの入力欄でのチェックと同じく、コードをアフィリエイトリンクに使えるかどうかを返します。

クエリパラメーター

  • codestring必須
    確認するコード。?via=のあとの部分です。小文字の英字、数字、-、_の2文字から32文字です。

戻り値

objectがaffiliate_codeのオブジェクト。code、そのコードで作られるlink、使えるかどうかを示すavailableを含みます。

エラー

  • 必須パラメーターがありません。paramにその名前が入ります。
  • APIが受け付けない値のパラメーターがあります。paramにその名前が入ります。
  • キーはチームメンバーのものです。この操作はXアカウントのオーナーしかできません。
GET/v1/affiliate/code_availability
curl -G \
  https://gemlead.ai/api/v1/affiliate/code_availability \
  -H "Authorization: Bearer $GEMLEAD_API_KEY" \
  -d code=acme-picks
レスポンス200
{
  "object": "affiliate_code",
  "code": "acme-picks",
  "link": "https://gemlead.ai?via=acme-picks",
  "available": true
}

アフィリエイトコードを変更

PATCH/v1/affiliate/codewriteスコープMCPmanage_affiliate

アフィリエイトリンクのコードを変更します。古いリンクからは紹介が入らなくなるため、事前にオーナーに確認してください。

ボディパラメーター

  • codestring必須
    新しいコード。小文字の英字、数字、-、_の2文字から32文字です。

戻り値

新しいlinkを含むアフィリエイトプログラムオブジェクトと、message。

エラー

  • 必須パラメーターがありません。paramにその名前が入ります。
  • APIが受け付けない値のパラメーターがあります。paramにその名前が入ります。
  • このコードは使用中か予約済みです。リンクは変わりません。
  • キーはチームメンバーのものです。この操作はXアカウントのオーナーしかできません。
PATCH/v1/affiliate/code
curl -X PATCH https://gemlead.ai/api/v1/affiliate/code \
  -H "Authorization: Bearer $GEMLEAD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "code": "acme-picks"
  }'
レスポンス200
{
  "object": "affiliate_program",
  "code": "acme-picks",
  "link": "https://gemlead.ai?via=acme-picks",
  "rate_percent": 15,
  "active_referrals": 6,
  "next_rate_percent": 20,
  "max_rate_percent": 50,
  "rates_percent": [5, 10, 15, 20, 25, 30, 40, 50],
  "currency": "usd",
  "earnings": 1284.6,
  "balance": 342.15,
  "payout_account": {
    "connected": true,
    "payouts_enabled": true
  },
  "can_cash_out": true,
  "referrals": [
    {
      "name": "Nina Park",
      "email": "nina@parkpicks.com",
      "plan": "business",
      "status": "active",
      "earned": 309.15,
      "rate_percent": 15
    },
    {
      "name": "Leo Grant",
      "email": "leo@grantsignals.io",
      "plan": "starter",
      "status": "trialing",
      "earned": 0,
      "rate_percent": 15
    }
  ],
  "payouts": [
    {
      "id": "py8Kq2LmXv",
      "object": "affiliate_payout",
      "amount": 942.45,
      "currency": "usd",
      "status": "paid",
      "created_at": "2026-10-31T12:00:00.000Z"
    }
  ],
  "tweet_review": {
    "discount_percent": 20,
    "status": "approved",
    "post_url": "https://x.com/acme/status/1985402219876543210",
    "used": 1,
    "remaining": 2,
    "max": 3,
    "discount_pending": false,
    "can_submit": true,
    "window_open": true,
    "window_ends_at": "2026-12-14T09:21:05.000Z",
    "submitted_at": "2026-10-02T11:04:37.000Z",
    "reviewed_at": "2026-10-02T11:06:12.000Z",
    "last_checked_at": "2026-11-06T06:00:00.000Z",
    "reply_found": true,
    "draft": null,
    "draft_validated": false
  },
  "manage_url": "https://gemlead.ai/app/affiliate",
  "message": "The link is now https://gemlead.ai?via=acme-picks. The old one stops bringing referrals."
}

出金先の口座を編集

POST/v1/affiliate/payout_accountwriteスコープMCPmanage_affiliate

出金先の銀行口座の登録を完了または編集するための、Stripeのページを返します。初回は、オーナーがアプリの「アフィリエイト」の「出金」から口座を追加します。そこで選んだ国はあとから変更できません。ここではIdempotency-Keyは無視されるため、再試行すると新しいリンクが返ります。

戻り値

objectがaffiliate_payout_linkのオブジェクト。Stripeのurl、onboardingかupdateのkind、messageを含みます。

エラー

  • 出金先の口座がまだありません。先にアプリで追加してください。
  • キーはチームメンバーのものです。この操作はXアカウントのオーナーしかできません。
  • Stripeが応答しませんでした。何も変更されていないので、1分後にもう一度お試しください。
POST/v1/affiliate/payout_account
curl -X POST \
  https://gemlead.ai/api/v1/affiliate/payout_account \
  -H "Authorization: Bearer $GEMLEAD_API_KEY"
レスポンス200
{
  "object": "affiliate_payout_link",
  "url": "https://connect.stripe.com/setup/e/acct_1Q2wErTy3uIoPa4S/Xy7zKq9LmN2v",
  "kind": "update",
  "message": "Open this Stripe page to edit the bank account payouts go to."
}

残高を出金

POST/v1/affiliate/cashoutwriteスコープMCPmanage_affiliate

アフィリエイトページの「出金」と同じく、アフィリエイト残高の全額をStripe上のオーナー自身の銀行口座に送ります。お金が動くため、事前にオーナーに金額を伝えて確認してください。再試行で二重に支払われないよう、Idempotency-Keyを送ってください。

戻り値

objectがaffiliate_cashoutのオブジェクト。送金したamount、そのcurrency、destination、messageを含みます。

エラー

POST/v1/affiliate/cashout
curl -X POST https://gemlead.ai/api/v1/affiliate/cashout \
  -H "Authorization: Bearer $GEMLEAD_API_KEY"
レスポンス200
{
  "object": "affiliate_cashout",
  "amount": 342.15,
  "currency": "usd",
  "destination": "The owner's bank account connected on Stripe.",
  "message": "Payout sent."
}

レビューポストの下書きを作成

POST/v1/affiliate/tweet_review/draftwriteスコープMCPmanage_affiliate

次回の支払いが20%オフになるレビューポストを準備します。オーナーが書いたtextを送ると、@Gemleadへのメンションがあり具体的な内容かどうかをアプリのAIがチェックします。オーナーのnotesを送ると、Nico AIがそれをポストに仕上げます。そのあとオーナーが自分のXアカウントからポストし、リプライにリンクを追加したら、あなたがポストを提出します。

ボディパラメーター

  • textstring
    オーナーが書いたままのポスト。8 000文字までです。textかnotesのどちらかを指定します。
  • notesstring
    オーナーのメモ。8 000文字までです。Nico AIがこれをもとにポストを書きます。

戻り値

objectがtweet_review_draftのオブジェクト。ポストのtext、validated、ポストを入力した状態でXの投稿画面を開くpost_on_x_url、プログラムのtweet_review、messageを含みます。

エラー

  • textとnotesの両方を指定したか、どちらも指定していません。
  • アプリのAIがポストを却下しました。何を変えればよいかはメッセージに書かれています。
  • すでに次回の支払いに20%オフが適用待ちです。新しいポストは、その支払いが済むまで提出できません。
  • 最後のポストがまだ審査中です。
  • この特典を利用できるのは最初の3か月間だけです。
  • 3回の割引をすべて使用済みです。
  • キーはチームメンバーのものです。この操作はXアカウントのオーナーしかできません。
  • XまたはGemleadのサービスが応答しませんでした。何も変更されていないので、1分後にもう一度お試しください。
POST/v1/affiliate/tweet_review/draft
curl -X POST \
  https://gemlead.ai/api/v1/affiliate/tweet_review/draft \
  -H "Authorization: Bearer $GEMLEAD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "notes": "found 40 hot leads in a week, booked 6 calls, setup took 10 minutes"
  }'
レスポンス200
{
  "object": "tweet_review_draft",
  "text": "Tried @Gemlead for a week: 40 hot leads on X, 6 calls booked, and the setup took 10 minutes. The scoring is scary good.",
  "validated": true,
  "post_on_x_url": "https://x.com/intent/tweet?text=Tried%20%40Gemlead%20for%20a%20week%3A%2040%20hot%20leads%20on%20X%2C%206%20calls%20booked%2C%20and%20the%20setup%20took%2010%20minutes.%20The%20scoring%20is%20scary%20good.",
  "tweet_review": {
    "discount_percent": 20,
    "status": "approved",
    "post_url": "https://x.com/acme/status/1985402219876543210",
    "used": 1,
    "remaining": 2,
    "max": 3,
    "discount_pending": false,
    "can_submit": true,
    "window_open": true,
    "window_ends_at": "2026-12-14T09:21:05.000Z",
    "submitted_at": "2026-10-02T11:04:37.000Z",
    "reviewed_at": "2026-10-02T11:06:12.000Z",
    "last_checked_at": "2026-11-06T06:00:00.000Z",
    "reply_found": true,
    "draft": "Tried @Gemlead for a week: 40 hot leads on X, 6 calls booked, and the setup took 10 minutes. The scoring is scary good.",
    "draft_validated": true
  },
  "message": "Ready. The user posts it from their own X account (post_on_x_url opens X's composer), adds gemlead.ai or their affiliate link in a reply, then manage_affiliate tweet_submit with the post's link."
}

レビューポストを提出

POST/v1/affiliate/tweet_review/submitwriteスコープMCPmanage_affiliate

投稿したレビューを提出します。アプリがX上でポストとリンク付きのリプライを確認すると、次回の支払いが20%オフになります。ポストを削除すると割引は失われます。

ボディパラメーター

  • post_urlstring必須
    Xのポストのリンク。https://x.com/name/status/123などです。

戻り値

アフィリエイトプログラムオブジェクトとmessage。

エラー

  • 必須パラメーターがありません。paramにその名前が入ります。
  • post_urlが公開されているXのポストのリンクではありません。
  • このポストはすでに提出されています。
  • ポストが事前にチェックされていません。レビューポストの下書きを作成してから、そのポストを投稿してください。
  • アプリのチェックでポストが却下されました。理由はメッセージに書かれています。
  • すでに次回の支払いに20%オフが適用待ちです。新しいポストは、その支払いが済むまで提出できません。
  • 最後のポストがまだ審査中です。
  • この特典を利用できるのは最初の3か月間だけです。
  • 3回の割引をすべて使用済みです。
  • キーはチームメンバーのものです。この操作はXアカウントのオーナーしかできません。
POST/v1/affiliate/tweet_review/submit
curl -X POST \
  https://gemlead.ai/api/v1/affiliate/tweet_review/submit \
  -H "Authorization: Bearer $GEMLEAD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "post_url": "https://x.com/acme/status/1987012345678901234"
  }'
レスポンス200
{
  "object": "affiliate_program",
  "code": "acme",
  "link": "https://gemlead.ai?via=acme",
  "rate_percent": 15,
  "active_referrals": 6,
  "next_rate_percent": 20,
  "max_rate_percent": 50,
  "rates_percent": [5, 10, 15, 20, 25, 30, 40, 50],
  "currency": "usd",
  "earnings": 1284.6,
  "balance": 342.15,
  "payout_account": {
    "connected": true,
    "payouts_enabled": true
  },
  "can_cash_out": true,
  "referrals": [
    {
      "name": "Nina Park",
      "email": "nina@parkpicks.com",
      "plan": "business",
      "status": "active",
      "earned": 309.15,
      "rate_percent": 15
    },
    {
      "name": "Leo Grant",
      "email": "leo@grantsignals.io",
      "plan": "starter",
      "status": "trialing",
      "earned": 0,
      "rate_percent": 15
    }
  ],
  "payouts": [
    {
      "id": "py8Kq2LmXv",
      "object": "affiliate_payout",
      "amount": 942.45,
      "currency": "usd",
      "status": "paid",
      "created_at": "2026-10-31T12:00:00.000Z"
    }
  ],
  "tweet_review": {
    "discount_percent": 20,
    "status": "approved",
    "post_url": "https://x.com/acme/status/1987012345678901234",
    "used": 2,
    "remaining": 1,
    "max": 3,
    "discount_pending": true,
    "can_submit": false,
    "window_open": true,
    "window_ends_at": "2026-12-14T09:21:05.000Z",
    "submitted_at": "2026-11-06T10:12:03.000Z",
    "reviewed_at": "2026-11-06T10:12:09.000Z",
    "last_checked_at": "2026-11-06T06:00:00.000Z",
    "reply_found": true,
    "draft": null,
    "draft_validated": false
  },
  "manage_url": "https://gemlead.ai/app/affiliate",
  "message": "20% off is on the next payment. Keep the post up: a deleted post loses it."
}

アフィリエイトの統計オブジェクト

アフィリエイトページの「統計」。期間内の数値を比較期間と並べ、指定したタイムゾーンで集計します。

属性

  • objectstring
    常にaffiliate_statsです。
  • timezonestring
    日付の集計に使うIANAタイムゾーン。
  • currencystring
    常にusdです。
  • periodobject
    集計した期間。time、startとend、scale、使えるscales、comparison、比較期間のcompared_startとcompared_endを含みます。
  • chartsobjectsの配列
    グラフごとに1件。それぞれkey、title、about、countかusdのunit、期間のtotal、compared_total、change_percentを含み、seriesを指定した場合はperiodとvalueを持つデータポイントも含みます。
アフィリエイトの統計オブジェクト
{
  "object": "affiliate_stats",
  "timezone": "Europe/Paris",
  "currency": "usd",
  "period": {
    "time": "last_7_days",
    "start": "2026-10-30T23:00:00.000Z",
    "end": "2026-11-06T22:59:59.999Z",
    "scale": "day",
    "scales": ["day", "hour"],
    "comparison": "previous_period",
    "compared_start": "2026-10-23T22:00:00.000Z",
    "compared_end": "2026-10-30T22:59:59.999Z"
  },
  "charts": [
    {
      "key": "signups",
      "title": "Sign-ups",
      "about": "Accounts created with the affiliate link.",
      "unit": "count",
      "total": 9,
      "compared_total": 6,
      "change_percent": 50,
      "series": [
        {
          "period": "2026-11-04",
          "value": 2
        },
        {
          "period": "2026-11-05",
          "value": 3
        },
        {
          "period": "2026-11-06",
          "value": 1
        }
      ]
    }
  ]
}

アフィリエイトの統計を取得

GET/v1/affiliate/statsreadスコープMCPget_affiliate

アフィリエイトページの「統計」にある、期間内の登録数、新規顧客、報酬、出金を、比較期間と並べて返します。

クエリパラメーター

  • timestring
    期間。ページのメニューと同じです。デフォルトはlast_4_weeksで、customの場合はstartとendを指定します。
    todaylast_7_dayslast_4_weekslast_3_monthslast_12_monthsmonth_to_datequarter_to_dateyear_to_dateall_timecustom
  • startstring
    カスタム期間の初日。YYYY-MM-DD形式で、2025年以降を指定します。
  • endstring
    カスタム期間の最終日。YYYY-MM-DD形式です。
  • scalestring
    系列の単位。期間のscalesの中から指定します。時間単位は14日までの期間で使え、月単位は61日以上の期間で使えます。デフォルトは期間の最初の単位です。
    hourdaymonth
  • comparisonstring
    比較する期間。デフォルトはprevious_periodです。
    previous_periodprevious_monthprevious_quarterprevious_yearno_comparison
  • timezonestring
    日付を数えるIANAタイムゾーン。Europe/Parisなどです。デフォルトはオーナーのタイムゾーンで、ない場合はUTCです。
  • chartsstringsの配列
    指定したグラフのみを返します。デフォルトは4つすべてです。
    signupsnew_customerscommissionspayouts
  • seriesboolean
    trueにすると、各グラフのデータポイントを単位ごとに1つずつ追加します。

戻り値

アフィリエイトの統計オブジェクト。

エラー

  • 必須パラメーターがありません。paramにその名前が入ります。
  • APIが受け付けない値のパラメーターがあります。paramにその名前が入ります。
  • キーはチームメンバーのものです。この操作はXアカウントのオーナーしかできません。
GET/v1/affiliate/stats
curl -G https://gemlead.ai/api/v1/affiliate/stats \
  -H "Authorization: Bearer $GEMLEAD_API_KEY" \
  -d time=last_7_days \
  -d charts=signups \
  -d series=true
レスポンス200
{
  "object": "affiliate_stats",
  "timezone": "Europe/Paris",
  "currency": "usd",
  "period": {
    "time": "last_7_days",
    "start": "2026-10-30T23:00:00.000Z",
    "end": "2026-11-06T22:59:59.999Z",
    "scale": "day",
    "scales": ["day", "hour"],
    "comparison": "previous_period",
    "compared_start": "2026-10-23T22:00:00.000Z",
    "compared_end": "2026-10-30T22:59:59.999Z"
  },
  "charts": [
    {
      "key": "signups",
      "title": "Sign-ups",
      "about": "Accounts created with the affiliate link.",
      "unit": "count",
      "total": 9,
      "compared_total": 6,
      "change_percent": 50,
      "series": [
        {
          "period": "2026-11-04",
          "value": 2
        },
        {
          "period": "2026-11-05",
          "value": 3
        },
        {
          "period": "2026-11-06",
          "value": 1
        }
      ]
    }
  ]
}