Quickstart

Five steps, about five minutes, ending at a working API call.

01

Get a token

Sign in to /settings, scroll to Developers, click Create token, label it, and copy the pat_… value. The token is shown once. Move it to a password manager or env file before you close the dialog.

02

Submit a URL

Validation is synchronous. A bad URL returns 400 invalid_url right away, no credit charged.

bash
export TOKEN=pat_your_token_here

curl -X POST https://adrevila.com/api/v1/analyses \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://www.facebook.com/ads/library/?id=971390442080128"}'
03

Poll for completion

The worker takes roughly a minute or two against live fal.ai and Firecrawl. A 2-3 second poll interval is fine. Concurrent analyses are what push you into the get-one rate limit (120/min/token), not a single tight loop.

bash
# Save the id from the previous response
ID=0190d2c1-8f3e-7000-bbaa-12cd34ef5678

# Poll every few seconds until status='done'
while true; do
  STATUS=$(curl -s -H "Authorization: Bearer $TOKEN" \
    https://adrevila.com/api/v1/analyses/$ID | jq -r .status)
  echo "status=$STATUS"
  [ "$STATUS" = "done" ] && break
  [ "$STATUS" = "failed" ] && exit 1
  sleep 3
done

# Fetch the full report
curl -H "Authorization: Bearer $TOKEN" \
  https://adrevila.com/api/v1/analyses/$ID
04

Fetch in your preferred format

One endpoint, three response shapes. The Accept header picks one. JSON is the default.

Markdown

bash
curl -H "Authorization: Bearer $TOKEN" \
  -H "Accept: text/markdown" \
  https://adrevila.com/api/v1/analyses/$ID > report.md

PDF

bash
curl -H "Authorization: Bearer $TOKEN" \
  -H "Accept: application/pdf" \
  https://adrevila.com/api/v1/analyses/$ID -o report.pdf
05

Wire it into your code

Node.js

ts
import { setTimeout as wait } from 'node:timers/promises';

const TOKEN = process.env.ADRIVELA_TOKEN!;
const BASE = 'https://adrevila.com/api/v1';
const headers = { Authorization: `Bearer ${TOKEN}`, 'Content-Type': 'application/json' };

const submit = await fetch(`${BASE}/analyses`, {
  method: 'POST',
  headers,
  body: JSON.stringify({ url: 'https://www.facebook.com/ads/library/?id=971390442080128' }),
});
const { id } = await submit.json() as { id: string };

let report;
for (let i = 0; i < 40; i++) {
  const r = await fetch(`${BASE}/analyses/${id}`, { headers });
  const body = await r.json() as { status: string; report: unknown };
  if (body.status === 'done') { report = body.report; break; }
  await wait(2000);
}
console.log(report);

Python

py
import os, time, requests

TOKEN = os.environ["ADRIVELA_TOKEN"]
BASE = "https://adrevila.com/api/v1"
headers = {"Authorization": f"Bearer {TOKEN}", "Content-Type": "application/json"}

r = requests.post(f"{BASE}/analyses", json={"url": "https://www.facebook.com/ads/library/?id=971390442080128"}, headers=headers)
analysis_id = r.json()["id"]

for _ in range(40):
    r = requests.get(f"{BASE}/analyses/{analysis_id}", headers=headers)
    body = r.json()
    if body["status"] == "done":
        print(body["report"])
        break
    time.sleep(2)
06

What next