Developer API

Ranking API for Agents

Score and rank ad creatives programmatically. Send image URLs, get back a ranked list with scores, rationales, and confidence levels. Built for computer-use agents, CLI tools, and automation pipelines.

Overview

The Ranking API evaluates ad creatives using Kettio's SSR (Semantic Similarity Rating) pipeline — the same scoring engine behind the Kettio dashboard. Each asset is scored 1–5 against a target audience persona, with a written rationale explaining the score.

Batch ranking

Up to 20 assets per request

Audience-aware

Inline personas or saved audiences

1 credit / asset

Only charged for successful evals

┌───────────────────────┐
│  Agent / CLI / Script │
└──────────┬────────────┘
           │  POST /api/v1/rank
           │  { assets[], audience, goal }
           ▼
┌───────────────────────┐
│    Kettio API         │
│  Auth + Rate Limit    │
│  Credit Check         │
└──────────┬────────────┘
           │  Parallel evaluation (4 concurrent)
           ▼
┌───────────────────────┐
│   SSR Pipeline        │
│  Gemini → Rationale   │
│  Embed → Score (1-5)  │
└──────────┬────────────┘
           │  Sorted results
           ▼
┌───────────────────────┐
│   JSON Response       │
│  ranked[], errors[],  │
│  credits summary      │
└───────────────────────┘

API Key

Generate an API key below. Keys start with agk_live_ and are sent via the Authorization header.

Quickstart

Rank three ad creatives with a single curl command:

curl -X POST https://kettio.com/api/v1/rank \
  -H "Authorization: Bearer agk_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "assets": [
      { "url": "https://example.com/ad-a.png", "id": "ad-a" },
      { "url": "https://example.com/ad-b.png", "id": "ad-b" },
      { "url": "https://example.com/ad-c.png", "id": "ad-c" }
    ],
    "audience": {
      "name": "Budget-conscious parents",
      "description": "Parents aged 30-44 who compare prices",
      "demographics": { "ageRange": "35-44", "priceSensitivity": "high" }
    },
    "goal": "purchase-intent"
  }'

For Computer-Use Agents

The API returns structured JSON — no browser interaction needed. Agents can parse the ranked[] array directly, read rationale strings for reasoning, and use score values to make decisions.

API Reference

Endpoint

POST/api/v1/rank

Score and rank up to 20 image assets against a target audience persona. Assets are evaluated concurrently and returned sorted by score (highest first).

Requires API key1 credit per asset60 assets/min rate limit120s max timeout

Request Body

assets{ url, id? }[]required
Array of 1–20 objects. url is required (https or data:image URI). id is optional for correlation.
audienceobject
Inline audience: name (required), description, demographics. Mutually exclusive with audience_id.
audience_idstring
ID of a saved audience from your Kettio account. Mutually exclusive with audience.
goalstringDefault: purchase-intent
Evaluation goal. See Goals table.
asset_typestringDefault: Social Media Post
Asset type for context framing. See Asset Types table.

Response

{
  "request_id": "a1b2c3d4-...",
  "ranked": [
    {
      "rank": 1,
      "asset_url": "https://example.com/ad-a.png",
      "asset_id": "ad-a",
      "score": 4.23,
      "rationale": "This ad immediately communicates value...",
      "product_read": "A promotional banner showing a family...",
      "confidence": "high",
      "confidence_details": {
        "entropy": 0.42,
        "top_margin": 0.31,
        "sample_std_dev": 0.08
      }
    },
    {
      "rank": 2,
      "asset_url": "https://example.com/ad-b.png",
      "asset_id": "ad-b",
      "score": 3.15,
      "rationale": "The creative lacks a clear value proposition...",
      "confidence": "medium"
    }
  ],
  "errors": [],
  "summary": {
    "goal": "purchase-intent",
    "asset_type": "Social Media Post",
    "audience": "Budget-conscious parents",
    "assets_ranked": 2,
    "assets_failed": 0,
    "credits_used": 2,
    "credits_remaining": 48
  }
}
ranked[]array
Sorted by score descending. Each entry has rank, score (1–5), rationale, confidence, and the original URL/ID.
errors[]array
Assets that failed evaluation. Credits are not charged for failed assets.
summaryobject
Totals: assets_ranked, assets_failed, credits_used, credits_remaining.

Error Codes

StatusMeaning
401Missing or invalid API key
402Insufficient credits for this batch
404audience_id not found or not owned by you
422Validation error (bad request body)
429Rate limited — check Retry-After header

Reference

Configuration

Evaluation Goals

The goal parameter determines what dimension your assets are scored on. purchase-intent is the default and highest accuracy.

GoalBest For
purchase-intentdefaultProduct ads, DTC creatives
click-through-rateAds optimized for clicks
conversion-potentialLanding pages, lead gen
trustworthinessAny ad — perceived trust
scroll-stoppingFeed-based social ads
engagementSocial content, community
brand-recognitionBrand awareness
emotional-resonanceStorytelling creative
open-rateEmail headers
logo-professionalismLogo evaluation
logo-versatilityLogo evaluation
product-page-conversionProduct detail pages
landing-page-conversionLanding pages

Asset Types

The asset_type sets the context framing — it changes the system prompt so the simulated persona evaluates the asset in the right mental context.

Asset TypeContext
Social Media PostdefaultFeed-based content
AdvertisementPaid ads
Product PhotoProduct imagery
Email HeaderEmail marketing
Landing Page HeroHero sections
LogoBrand marks
Website BannerDisplay ads
IllustrationCustom art

Demographics Fields

Optional fields on audience.demographics. These shape the simulated persona's attitude and behavior. All fields are optional — sensible defaults are applied automatically.

FieldAccepted Values
ageRange18-24, 25-34, 35-44, 45-54, 55-64, 65+
incomeLevelunder-25k, 25k-50k, 50k-75k, 75k-100k, 100k-150k, 150k+
adSkepticismvery-low, low, moderate, high, very-high
trustBaselinevery-low, low, moderate, high, very-high
priceSensitivityvery-low, low, moderate, high, very-high
categoryFamiliaritynone, casual, knowledgeable, expert
shoppingIntentbrowsing, researching, comparing, ready-to-buy
urgencynone, low, moderate, high, urgent
brandFamiliarityunaware, heard-of, familiar, loyal
platformFatiguelow, medium, high, very-high