API Reference
UGC
POST /ugc/process

POST /ugc/process

Match a contextual ad to a piece of user-generated content.

Request

Endpoint

POST https://api.adzen.ai/ugc/process

Headers

HeaderRequiredValue
X-API-KeyYesYour subscription key
Content-TypeYesapplication/json
X-Forwarded-ForNoClient IP (for geo targeting)

Body

{
  post_id: string      // Your unique identifier for the post
  message: string      // The post text (max 10,000 chars)
  meta?: {
    location?: string  // ISO country/subdivision (e.g. "US-CA"). Optional —
                       // falls back to IP-based geo lookup.
  }
}

Example

curl -X POST https://api.adzen.ai/ugc/process \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -d '{
    "post_id": "thread-12345",
    "message": "Looking for a good plumber in Seattle",
    "meta": { "location": "US-WA" }
  }'

Response

200 OK

{
  "post_id": "thread-12345",
  "ads": [
    {
      "ad_id": "ad-abc123",
      "title": "Need a plumber? Same-day service in Seattle",
      "cta": "Book Now",
      "click_through_url": "https://api.adzen.ai/click/abc123",
      "advertiser_name": "Seattle Plumbing Co",
      "pricing_model": {
        "type": "cpc",
        "bid_amount": 0.85
      },
      "relevancy_score": 0.92,
      "ttl_seconds": 300,
      "pixel_trackers": [
        {
          "vendor": "adzen",
          "tracker_type": "impression",
          "url": "https://api.adzen.ai/pixel/abc123"
        }
      ]
    }
  ]
}

Response fields

FieldTypeDescription
post_idstringEcho of the request post_id
adsarrayMatched ads, ordered by relevance. Empty array when no ad passes matching gates.
ads[].ad_idstringUnique ad identifier. Pass this on impression and disable calls.
ads[].titlestringShort headline for the ad
ads[].ctastringCall-to-action button text
ads[].click_through_urlstringURL to open on ad click (slug-based for tracking)
ads[].advertiser_namestringHuman-readable advertiser name
ads[].pricing_model.typestring"cpc", "cpm", or "cpa"
ads[].pricing_model.bid_amountnumberBid in USD
ads[].relevancy_scorenumber0-1 score from the matching pipeline
ads[].ttl_secondsintegerRefresh the match after this many seconds
ads[].pixel_trackersarrayThird-party pixels to fire when the ad is displayed

Error responses

StatusMeaning
400Validation error (missing post_id, empty message, message too long)
401Missing or invalid API key
429Rate limit exceeded
502Downstream matching service failure

An empty ads array is not an error. It means the matching pipeline found no ad relevant to the content, or all candidates were filtered by quality gates.