# Ad Spend & Fee Audit – Advertising Invoice Reconciliation

> Ad Spend & Fee Audit – Advertising Invoice Reconciliation is a paid API for AI agents from rooke-token-risk-pilot.rookepoole.workers.dev, paid per call via x402, $9/call, status unknown (last checked 2026-09-16).

Reconciles an advertising invoice against a signed media agreement, verifying fee calculations, spend totals, and credits to produce a pass/fail verdict with risk flags and pacing analysis.

## Facts

- Endpoint: POST https://rooke-token-risk-pilot.rookepoole.workers.dev/v1/x402/ad-spend-fee-audit
- Price: $9/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-16
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/ad-spend-fee-audit-advertising-invoice-reconciliation-61b26495
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_w-JVeiEUExQvt8etZuPxZ

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability ad-spend-fee-audit-advertising-invoice-reconciliation-61b26495 -d '<json body>'
```

Example prompt: Audit invoice INV-88 for agreement MEDIA-2026-08 (signed-v3, USD, period 2026-08-01 to 2026-08-31, media budget $1,000, expected credits $0): the invoice shows $375 media spend, a $57.50 management fee at 1,500 bps of media spend, and a total of $432.50 — check whether the fees are correct and flag any budget pacing issues.

## When to prefer this

Choose this endpoint when you need a structured, auditable verdict on whether an advertising invoice's fees, credits, and totals match a signed media agreement — especially when the agreement has complex fee rules (percent-of-spend with floors/ceilings, fixed fees). Prefer it over manual spreadsheet checks or generic reconciliation APIs when you need risk flags, budget pacing projections, and a tamper-evident report hash in a single call. It is purpose-built for ad-spend and agency-fee reconciliation, not general AP matching.

## Known failure modes

- Missing required invoice or agreement fields returns a 400 validation error
- Fee rule calculationMode enum mismatch causes rule to be skipped or flagged as unknown
- Period dates in wrong format (not YYYY-MM-DD) cause parsing errors
- observedTotalMinor inconsistent with observed line items may produce a non-zero variance unexpectedly
- Payment failure (x402) if USDC balance is insufficient — call is not executed
- Agreement version mismatch between caller-supplied data and actual signed contract yields CALLER_SUPPLIED_AGREEMENT_CAMPAIGN_AND_INVOICE_FACTS_NOT_AUTHENTICATED evidence gap

## How this service works

Public static preview plus paid token controls, risk consensus, AI security, webhook reliability, developer security, schedule risk, decision analysis, API release compatibility, accounts-payable reconciliation, e-commerce return eligibility, SaaS subscription-proration, sales-commission reconciliation, parcel-charge reconciliation, SLA service-credit reconciliation, advertising spend-and-fee audit, contract-renewal audit, workforce timecard reconciliation, hotel booking-commission reconciliation, and warehouse cycle-count adjustment reconciliation products for autonomous agents.

## Output

Returns a JSON object with: a verdict string (e.g. MATCHED_WITHIN_TOLERANCE), a reconciliation object showing expected vs observed media spend, fee totals, and variance in minor currency units, a list of risk flags (e.g. PROJECTED_MEDIA_BUDGET_OVERRUN), pacing data (elapsed/total days, projected spend), a list of unknown observed fee lines, expected fee lines with computed amounts, a recommended disposition, evidence gaps, a claim boundary object indicating no funds were moved or invoices approved, and a SHA-256 report hash for audit trail purposes.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "invoice": {
   "type": "object",
   "required": [
    "invoiceId",
    "observedMediaSpendMinor",
    "observedFeeLines",
    "observedCreditsMinor",
    "observedTotalMinor"
   ],
   "properties": {
    "invoiceId": {
     "type": "string",
     "maxLength": 120,
     "minLength": 1
    },
    "observedFeeLines": {
     "type": "array",
     "items": {
      "type": "object",
      "required": [
       "feeId",
       "label",
       "amountMinor"
      ],
      "properties": {
       "feeId": {
        "type": "string",
        "maxLength": 120,
        "minLength": 1
       },
       "label": {
        "type": "string",
        "maxLength": 120,
        "minLength": 1
       },
       "amountMinor": {
        "type": "integer",
        "maximum": 9007199254740991,
        "minimum": 0
       }
      },
      "additionalProperties": false
     },
     "maxItems": 200
    },
    "observedTotalMinor": {
     "type": "integer",
     "maximum": 9007199254740991,
     "minimum": 0
    },
    "observedCreditsMinor": {
     "type": "integer",
     "maximum": 9007199254740991,
     "minimum": 0
    },
    "observedMediaSpendMinor": {
     "type": "integer",
     "maximum": 9007199254740991,
     "minimum": 0
    }
   },
   "additionalProperties": false
  },
  "agreement": {
   "type": "object",
   "required": [
    "agreementId",
    "agreementVersion",
    "currency",
    "periodStartDate",
    "periodEndDate",
    "mediaBudgetMinor",
    "expectedCreditsMinor",
    "feeRules"
   ],
   "properties": {
    "currency": {
     "type": "string",
     "pattern": "^[A-Z]{3}$"
    },
    "feeRules": {
     "type": "array",
     "items": {
      "type": "object",
      "required": [
       "feeId",
       "label",
       "calculationMode",
       "rateBps",
       "fixedAmountMinor",
       "minimumAmountMinor",
       "maximumAmountMinor"
      ],
      "properties": {
       "feeId": {
        "type": "string",
        "maxLength": 120,
        "minLength": 1
       },
       "label": {
        "type": "string",
        "maxLength": 120,
        "minLength": 1
       },
       "rateBps": {
        "type": "integer",
        "maximum": 100000,
        "minimum": 0
       },
       "calculationMode": {
        "enum": [
         "PERCENT_OF_MEDIA_SPEND",
         "FIXED"
        ],
        "type": "string"
       },
       "fixedAmountMinor": {
        "type": "integer",
        "maximum": 9007199254740991,
        "minimum": 0

… (truncated)
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "pacing": {
   "totalDays": 10,
   "elapsedDays": 1,
   "actualSpendThroughMinor": 37500,
   "targetSpendThroughMinor": 10000,
   "projectedMediaSpendMinor": 375000
  },
  "verdict": "MATCHED_WITHIN_TOLERANCE",
  "agreement": {
   "currency": "USD",
   "agreementId": "MEDIA-2026-08",
   "agreementVersion": "signed-v3",
   "mediaBudgetMinor": 100000
  },
  "invoiceId": "INV-88",
  "riskFlags": [
   "PROJECTED_MEDIA_BUDGET_OVERRUN",
   "SPEND_AHEAD_OF_LINEAR_PACE"
  ],
  "reportHash": "sha256-hex",
  "evidenceGaps": [
   "CALLER_SUPPLIED_AGREEMENT_CAMPAIGN_AND_INVOICE_FACTS_NOT_AUTHENTICATED"
  ],
  "claimBoundary": {
   "fundsMoved": false,
   "paymentAttempted": false,
   "campaignPausedOrModified": false,
   "invoiceApprovedOrDisputed": false,
   "adPlatformOrAgencyConnected": false
  },
  "schemaVersion": "AD_SPEND_FEE_AUDIT_V1",
  "reconciliation": {
   "expectedTotalMinor": 42250,
   "observedTotalMinor": 42250,
   "totalVarianceMinor": 0,
   "expectedFeeTotalMinor": 5750,
   "expectedMediaSpendMinor": 37500
  },
  "campaignResults": [],
  "expectedFeeLines": [],
  "requestCommitment": "sha256-hex",
  "recommendedDisposition": "MATCHED_NO_ACTION",
  "unknownObservedFeeLines": []
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/ad-spend-fee-audit-advertising-invoice-reconciliation-61b26495/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from rooke-token-risk-pilot.rookepoole.workers.dev](https://www.zero.xyz/host/rooke-token-risk-pilot.rookepoole.workers.dev/llms.txt)
