Skip to main content

Documentation Index

Fetch the complete documentation index at: https://developer.zeroclick.ai/docs/llms.txt

Use this file to discover all available pages before exploring further.

Get up and running with ZeroClick using the REST API. You’ll fetch personalized offers, render them, and track impressions.

Get Your API Key

  1. Visit the Developer Dashboard
  2. Navigate to API Keys, then under the App API Keys tab
  3. Click Create API Key
  4. In the drawer, under What type of key is this?, choose your key type:
    • Server key — private API key for server-to-server use (method: "server").
    • Client key — public API key, safe to use on client devices. Rate limited by IP (method: "client").
  5. Copy your key

1. Fetch Offers

Make a POST request to /api/v2/offers with your query:
const response = await fetch("https://zeroclick.dev/api/v2/offers", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "x-zc-api-key": "your-api-key" // Get from developer dashboard
  },
  body: JSON.stringify({
    method: "server",
    ipAddress: "your-client-ip-address", // required for server method
    userAgent: "your-client-user-agent", // optional but recommended
    query: "best running shoes",
    limit: 3
  })
});

const offers = await response.json();
console.log(offers);
Expected response:
[
  {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "title": "Nike Air Zoom Pegasus 40",
    "subtitle": "Premium running shoe for daily training",
    "content": "Responsive cushioning and breathable mesh upper...",
    "cta": "Shop Now",
    "clickUrl": "https://zero.click/1234...",
    "imageUrl": "https://example.com/pegasus40.jpg",
    "brand": {
      "name": "Nike",
      "url": "https://nike.com"
    },
    "price": {
      "amount": "129.99",
      "currency": "USD"
    }
  }
]
When calling from the browser, use method: "client". IP and User-Agent are extracted automatically from request headers.
Using method: "client" requires a Client key, since the key will be exposed in client-side code.
const response = await fetch("https://zeroclick.dev/api/v2/offers", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "x-zc-api-key": "your-client-key"
  },
  body: JSON.stringify({
    method: "client",
    query: "best running shoes",
    limit: 3
  })
});

2. Render Offers

Display the offers in your UI however you’d like:
offers.forEach(offer => {
  const card = `
    <div class="offer-card" data-offer-id="${offer.id}">
      <img src="${offer.imageUrl}" alt="${offer.title}" />
      <h3>${offer.title}</h3>
      <p>${offer.content}</p>
      <a href="${offer.clickUrl}" target="_blank">${offer.cta}</a>
      <span class="price">${offer.price.currency} ${offer.price.amount}</span>
    </div>
  `;
  document.querySelector('#offers').innerHTML += card;
});

3. Track Impressions

Call the impressions endpoint when offers are displayed:
// Track all displayed offers
await fetch("https://zeroclick.dev/api/v2/impressions", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    ids: offers.map(offer => offer.id)
  })
});
Impression requests must originate from the end user’s device, not your server. Requests will be rate limited per IP.

What’s Next?

Offers Reference

Learn about parameters and response schemas

Signal Collection

Improve offer quality with user preferences

Integration Guide

Compare REST API and MCP integration

Troubleshooting

401 Unauthorized:
  • Check that your API key is correct
  • Verify you’re using the x-zc-api-key header
Need help? Email developers@zeroclick.ai