Skip to main content
認証済みエージェントがこのベンダーエージェントで操作できるすべてのアカウントを返します。既存アカウントの探索、保留中アカウントのステータス変更確認、プロトコル操作で使用する account_id 値の取得に使用します。 list_accounts はすべてのベンダープロトコルで機能する — メディアバイエージェント、シグナルエージェント、ガバナンスエージェント、クリエイティブエージェントはすべてこの同じタスクを通じてアカウントを返します。 応答時間: 約1秒。 リクエストスキーマ: /schemas/v3/account/list-accounts-request.json レスポンススキーマ: /schemas/v3/account/list-accounts-response.json

クイックスタート

このエージェントが操作できるすべてのアカウントを一覧表示します。
import { testAgent } from "@adcp/client/testing";
import { ListAccountsResponseSchema } from "@adcp/client";

const result = await testAgent.listAccounts({});

if (!result.success) {
  throw new Error(`Request failed: ${result.error}`);
}

const validated = ListAccountsResponseSchema.parse(result.data);

if ("errors" in validated && validated.errors) {
  throw new Error(`Operation failed: ${JSON.stringify(validated.errors)}`);
}

for (const account of validated.accounts) {
  console.log(`${account.account_id}: ${account.name} (${account.status})`);
}

リクエストパラメーター

すべてのパラメーターはオプション。空のリクエストはすべてのアカウントを返します。
パラメーター必須説明
statusstringNoアカウントステータスでフィルタ: activepending_approvalrejectedpayment_requiredsuspendedclosed
sandboxbooleanNotrue の場合、サンドボックスアカウントのみ返します。false または省略時は本番アカウントのみ返します。主に明示的アカウント(require_operator_auth: true)で使用し、プラットフォーム上の既存テストアカウントを参照します。
paginationobjectNo大規模アカウントセット用のページネーションカーソル。

レスポンス

フィールド説明
accountsアカウントオブジェクトの配列(下記参照)
errorsリクエストが失敗した場合のエラー配列
paginationさらに結果がある場合の次ページのページネーションカーソル
各アカウントには以下が含まれます:
フィールド説明
account_idベンダーエージェントの識別子。プロトコルタスクに渡す: create_media_buyget_signalsactivate_signalreport_usage などの操作。status: "rejected" の場合は省略されることがあります。
nameアカウントのベンダーエージェント表示名
brandブランド参照オブジェクト: domainブランドレジストリのハウスドメイン)とオプションの brand_id(ハウス内のサブブランド)
operatorオペレータードメイン。常に存在 — ブランドが直接運営する場合、operator はブランドのドメインと同一。
status現在のアカウント状態: activepending_approvalrejectedpayment_requiredsuspendedclosed
billing有効な請求モデル: operator または agent
account_scopeセラーがアカウントをスコープした方法: operatorbrandoperator_brandagentアカウントスコープ を参照。
payment_termsこのアカウントで合意した支払い条件: net_15net_30net_45net_60net_90prepay。アカウントがアクティブな場合、すべての請求書に対して拘束力を持ちます。
setupstatus: "pending_approval" の場合に存在。セットアップ完了の url と必要な内容を説明する message を含みます。

一般的なシナリオ

アカウントがアクティブになるまでポーリング

sync_accountspending_approval を返した後、アカウントが準備できるまでポーリングします。
import { testAgent } from "@adcp/client/testing";
import { ListAccountsResponseSchema } from "@adcp/client";

async function waitForAccount(targetAccountId, maxAttempts = 20) {
  for (let i = 0; i < maxAttempts; i++) {
    const result = await testAgent.listAccounts({ status: "active" });

    if (!result.success) {
      throw new Error(`Request failed: ${result.error}`);
    }

    const validated = ListAccountsResponseSchema.parse(result.data);

    if ("errors" in validated && validated.errors) {
      throw new Error(`Operation failed: ${JSON.stringify(validated.errors)}`);
    }

    if ("accounts" in validated) {
      const account = validated.accounts.find(a => a.account_id === targetAccountId);
      if (account) {
        console.log(`Account active: ${account.account_id}`);
        return account;
      }
    }

    // 再ポーリングまで30秒待機
    await new Promise(resolve => setTimeout(resolve, 30_000));
  }

  throw new Error(`Account ${targetAccountId} did not become active`);
}

アクティブなアカウントのみフィルタ

import { testAgent } from "@adcp/client/testing";
import { ListAccountsResponseSchema } from "@adcp/client";

const result = await testAgent.listAccounts({ status: "active" });

if (!result.success) {
  throw new Error(`Request failed: ${result.error}`);
}

const validated = ListAccountsResponseSchema.parse(result.data);

if ("accounts" in validated) {
  for (const account of validated.accounts) {
    console.log(`${account.account_id}: ${account.name} — billing: ${account.billing}`);
  }
}

エラーハンドリング

エラーコード説明解決策
ACCOUNT_NOT_FOUNDこのエージェントのアカウントが見つからないまず sync_accounts を実行して購買関係を確立する

次のステップ