Outreach Quickstart

Connect your platform to AIclicks outreach in six steps: one campaign per client, a Send to outreach button, one webhook handler, approve and decline buttons, and the balance.

This page walks through a full integration, from the first API call to a live link. Each step links to the endpoint reference.

1. Get an API key

  1. Create an API key in the AIclicks dashboard under Settings → Developers.
  2. Check the key with GET /api/v1/validate.
  3. Get the domain_id of each client with GET /api/v1/domains.

2. Create one campaign per client

Run this once when a client turns on outreach in your product.

curl -X POST https://api.aiclicks.io/api/v1/outreach/campaigns \
  -H "Authorization: Bearer $AICLICKS_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: create-campaign-client_4821" \
  -d '{
    "domain_id": "8f1d3c0a-2f9b-4c11-9b80-7a82e1f0c3f3",
    "external_id": "client_4821",
    "budget_cents": 500000,
    "max_link_price_cents": 40000,
    "approval_mode": "all",
    "criteria": { "min_domain_rating": 40, "exclude_competitors": true },
    "status": "launched"
  }'

Save data.id next to your client record. If the client is not tracked in AIclicks yet, create it with POST /api/v1/domains first.

3. Wire your "Send to outreach" button

Point the button at Send Sources. Send your own opportunity ID as external_id. If your team found the page, set origin: "partner" and pass any price or contact you already have.

async function sendToOutreach(campaignId, rows) {
  const resp = await fetch(
    `https://api.aiclicks.io/api/v1/outreach/campaigns/${campaignId}/sources`,
    {
      method: "POST",
      headers: {
        Authorization: `Bearer ${process.env.AICLICKS_API_KEY}`,
        "Content-Type": "application/json",
        "Idempotency-Key": `send-${campaignId}-${rows.map((r) => r.id).join("-")}`,
      },
      body: JSON.stringify({
        sources: rows.map((r) => ({
          url: r.url,
          external_id: r.id,
          origin: r.foundByUs ? "partner" : "aiclicks",
          quoted_price_cents: r.quotedPriceCents ?? undefined,
        })),
      }),
    },
  );
  const { data } = await resp.json();
  // data.accepted -> mark as "In outreach"
  // data.rejected -> show the reason (duplicate, competitor_domain, ...)
  return data;
}

4. Handle the webhook

One handler covers the whole lifecycle. Update your own row by external_id.

from flask import Flask, request, abort

app = Flask(__name__)

@app.post("/aiclicks/outreach")
def aiclicks_outreach():
    raw = request.get_data()
    if not verify(raw, request.headers["X-AIclicks-Signature"], WEBHOOK_SECRET):
        abort(401)
    event = request.get_json()
    if event["type"] == "ping" or already_processed(event["id"]):
        return "", 200

    opp = event["data"]
    if event["type"] == "opportunity.action_needed":
        queue_for_client_approval(opp["external_id"], opp["url"], opp["estimated_price_cents"])
    elif event["type"] == "opportunity.completed":
        mark_live(opp["external_id"], opp["placement"]["live_url"], opp["placement"]["placed_at"],
                  opp["final_price_cents"])
    elif event["type"] == "campaign.balance_low":
        notify_finance(event["campaign_external_id"], event["data"]["balance_cents"])
    else:
        update_status(opp["external_id"], opp["status"])

    mark_processed(event["id"])
    return "", 200

verify is on the webhooks page.

5. Wire approve and decline

When your client clicks Approve or Decline in your product, call:

# Approve
curl -X POST https://api.aiclicks.io/api/v1/outreach/opportunities/$OPPORTUNITY_ID/approve \
  -H "Authorization: Bearer $AICLICKS_API_KEY" \
  -H "Idempotency-Key: approve-$OPPORTUNITY_ID"

# Decline
curl -X POST https://api.aiclicks.io/api/v1/outreach/opportunities/$OPPORTUNITY_ID/decline \
  -H "Authorization: Bearer $AICLICKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "reason": "too_expensive" }'

AIclicks does not push a declined page again. If the client changes their mind, call Reconsider.

6. Show the balance

Read Get Balance when you render the campaign page, and listen to campaign.balance_low to warn the client before outreach stops. To add funds, AIclicks sends a Stripe payment link or bank transfer details for the campaign. The deposit is credited when the payment settles, and you get a transaction.created webhook.

Go-live checklist

  • One campaign per client, with external_id set.
  • Idempotency-Key on create campaign, send sources, approve and decline.
  • Webhook endpoint registered, signature verified on the raw body, duplicates dropped by event ID.
  • Approve and decline buttons call the API, and the UI shows action_required.
  • Low-balance alert goes to the person who pays the deposit.
  • Full flow tested on one campaign: processing → action_needed → approved → completed, plus one declined.

Questions during the integration? Email support@aiclicks.io with the X-Request-Id of the request.