> ## Documentation Index
> Fetch the complete documentation index at: https://adcp-docs-ja.pier1.co.jp/llms.txt
> Use this file to discover all available pages before exploring further.

# validate_content_delivery

> validate_content_delivery は AdCP でコンテンツセーフティポリシーに照らして配信記録を非同期でバッチ評価します。

# validate\_content\_delivery

コンテンツセーフティポリシーに照らして配信記録を検証します。広告が実際に配信された場所をバッチ監査する用途です。

**非同期**: 即時受け付け、バックグラウンド処理。ステータスポーリング用に `validation_id` を返します。

## Data Flow

コンテンツアーティファクトは配信メトリクスとは別です。検証用コンテンツ取得には `get_media_buy_artifacts` を使います:

```mermaid theme={null}
sequenceDiagram
    participant Buyer as Buyer Agent
    participant Seller as Seller Agent
    participant Verifier as Verification Agent

    Buyer->>Seller: get_media_buy_artifacts (sampled)
    Seller-->>Buyer: Artifacts with content
    Buyer->>Verifier: validate_content_delivery
    Verifier-->>Buyer: Validation results
```

**なぜバイヤー経由か?**

* **バイヤー** がメディアバイの主体で、どの `standards_id` を適用するか把握
* **バイヤー** がセラーへアーティファクトを要求（パフォーマンス指標とは別）
* **バイヤー** がブランドセーフティ順守の責任主体
* **検証エージェント** はバイヤーの代理として動く

責任分界を明確にするため、セラーは `get_media_buy_artifacts` でコンテンツサンプルを提供し、バイヤーが検証エージェントで確認します。

## Request

**Schema**: [validate-content-delivery-request.json](https://adcontextprotocol.org/schemas/v3/content-standards/validate-content-delivery-request.json)

| Parameter        | Type    | Required | Description                 |
| ---------------- | ------- | -------- | --------------------------- |
| `standards_id`   | string  | Yes      | 検証に用いるスタンダード設定 ID           |
| `records`        | array   | Yes      | 検証する配信記録（最大 10,000）         |
| `feature_ids`    | array   | No       | 評価する特定フィーチャー（省略時は全て）        |
| `include_passed` | boolean | No       | 合格レコードを結果に含めるか（デフォルト: true） |

### 配信レコード

```json theme={null}
{
  "record_id": "imp_12345",
  "timestamp": "2025-01-15T10:30:00Z",
  "media_buy_id": "mb_nike_reddit_q1",
  "artifact": {
    "property_id": {"type": "domain", "value": "example.com"},
    "artifact_id": "article_12345",
    "assets": [
      {"type": "text", "role": "title", "content": "Article Title"}
    ]
  },
  "country": "US",
  "channel": "display",
  "brand_context": {
    "brand_id": "nike_global",
    "sku_id": "air_max_2025"
  }
}
```

| Field           | Required | Description                              |
| --------------- | -------- | ---------------------------------------- |
| `record_id`     | Yes      | この配信レコードの一意 ID                           |
| `artifact`      | Yes      | 広告が配信されたコンテンツアーティファクト                    |
| `media_buy_id`  | No       | このレコードが属するメディアバイ（複数買付のバッチ時）              |
| `timestamp`     | No       | 配信時刻                                     |
| `country`       | No       | ISO 3166-1 alpha-2 の国コード（ターゲティング文脈）      |
| `channel`       | No       | チャネル種別（display, video, audio, social など） |
| `brand_context` | No       | ポリシー評価用のブランド/SKU 情報（スキーマ未定）              |

## Response

**Schema**: [validate-content-delivery-response.json](https://adcontextprotocol.org/schemas/v3/content-standards/validate-content-delivery-response.json)

### Success Response

```json theme={null}
{
  "$schema": "/schemas/content-standards/validate-content-delivery-response.json",
  "summary": {
    "total_records": 1000,
    "passed_records": 950,
    "failed_records": 50
  },
  "results": [
    {
      "record_id": "imp_12345",
      "verdict": "pass",
      "features": [
        {
          "feature_id": "brand_safety",
          "status": "passed",
          "value": "safe"
        }
      ]
    },
    {
      "record_id": "imp_12346",
      "verdict": "fail",
      "features": [
        {
          "feature_id": "brand_safety",
          "status": "failed",
          "value": "high_risk",
          "message": "Content contains violence"
        }
      ]
    }
  ]
}
```

## Use Cases

### Post-Campaign Audit

```python theme={null}
def audit_campaign_delivery(campaign_id, standards_id, content_standards_agent):
    """Audit all delivery records from a campaign."""
    # Fetch delivery records from your ad server
    records = fetch_delivery_records(campaign_id)

    # Validate in batches
    batch_size = 10000
    all_results = []

    for i in range(0, len(records), batch_size):
        batch = records[i:i + batch_size]
        response = content_standards_agent.validate_content_delivery(
            standards_id=standards_id,
            records=batch
        )
        all_results.extend(response["results"])

    return all_results
```

### Real-Time Monitoring Sample

```python theme={null}
import random

def sample_and_validate(records, standards_id, sample_size=1000):
    """Validate a random sample for real-time monitoring."""
    sample = random.sample(records, min(sample_size, len(records)))
    return content_standards_agent.validate_content_delivery(
        standards_id=standards_id,
        records=sample
    )
```

### Filter for Issues Only

```python theme={null}
# Only get failed records to reduce response size
response = content_standards_agent.validate_content_delivery(
    standards_id="nike_emea_safety",
    records=delivery_records,
    include_passed=False  # Only return failures
)

for result in response["results"]:
    print(f"Issue with {result['record_id']}")
    for feature in result["features"]:
        if feature["status"] == "failed":
            print(f"  - {feature['feature_id']}: {feature['message']}")
```

## Related Tasks

* [get\_media\_buy\_artifacts](./get_media_buy_artifacts) - Get content artifacts from seller
* [calibrate\_content](./calibrate_content) - Understand why artifacts pass/fail
* [get\_content\_standards](./get_content_standards) - Retrieve the policies
