seo / rest / pipelines

Add OpenSenpai to your Ahrefs or OpenSEO workflow with REST

Bring questions from your SEO research into OpenSenpai, save a weekly citation check, and return content opportunities to your backlog.

In this article

You can add OpenSenpai to an existing SEO pipeline by passing customer questions into its REST API and giving the results to your content agent. Start with topics you already research in Ahrefs or OpenSEO, then inspect how selected AI models answer those questions and cite your pages.

This is a workflow you assemble through exports or your own integration. The steps below use a saved request and Python’s standard library; they do not require a native connector between the products.

Bring a small set of questions

Ahrefs’ API supports custom integrations across its SEO datasets, including Brand Radar. OpenSEO provides agent workflows for SEO research. Choose five questions from the research you already have and save their exact wording.

Follow the REST quickstart to discover available models and create run.json. For citation checks, replace the quickstart’s search-off baseline with a supported search-enabled target. Complete one manually approved run before scheduling it.

Keep that file unchanged for the period you want to compare. Give each scheduled check its own saved copy with a fresh idempotency key. Retain the copy so a retry uses the same input and key.

Collect a weekly check

Save this script as citation_check.py beside your completed run.json. Set OPENSENPAI_API_KEY through your environment. The script starts paid work, so run it only after authorizing the saved request and checking your available balance. Set max_estimated_cost_usd to bound the service’s internal admission reservation. This does not forecast or guarantee final provider charges; inspect reported usage afterward.

import json
import os
import time
from pathlib import Path
from urllib.parse import quote, urlencode
from urllib.request import Request, urlopen
base = "https://api.noticedbysenp.ai/api/v1/research"
key = os.environ["OPENSENPAI_API_KEY"]
payload = json.loads(Path("run.json").read_text())
assert payload.get("max_estimated_cost_usd", 0) > 0, "Set an admission reservation cap"
def request(path, body=None):
data = None if body is None else json.dumps(body).encode()
headers = {"Authorization": f"Bearer {key}"}
if data is not None:
headers["Content-Type"] = "application/json"
with urlopen(Request(base + path, data=data, headers=headers), timeout=30) as response:
return json.load(response)
started = request("/runs", payload)
run = started["run"]
run_path = "/runs/" + quote(run["id"], safe="")
Path("run-id.txt").write_text(run["id"])
while run["status"] in {"queued", "running"}:
run = request(run_path + "?wait_ms=10000")
if run["status"] in {"queued", "running"}:
time.sleep(1)
Path("run-state.json").write_text(json.dumps(run, indent=2))
observations = []
cursor = None
while True:
params = {"limit": 100}
if cursor is not None:
params["cursor"] = cursor
page = request(run_path + "/observations?" + urlencode(params))
observations.extend(page["observations"])
cursor = page["next_cursor"]
if cursor is None:
break
Path("observations.json").write_text(json.dumps(observations, indent=2))
print(f"Saved {len(observations)} observations; run status: {run['status']}")

Run python3 citation_check.py in a separate folder for each weekly check. Your scheduler should create that folder and its run.json once per period, then reuse both if the task restarts. Configure a job timeout appropriate to your run size. If a request fails, inspect the saved run ID or replay the exact request with its existing key; avoid creating replacement work under a new key just because a response was lost.

The script retains unsuccessful observations too. A terminal run can be partial or failed, so have the agent inspect statuses and errors before reporting mention or citation counts. Keep the files private if prompts contain internal information.

Turn the saved answers into work

Give your agent run-state.json, observations.json, your product pages, and this instruction:

Find questions where our product is missing, misclassified, or described inaccurately. Inspect the citations. For each useful finding, propose an edit or a new content brief with the question ID, run ID, answer passage, source URL, and reason. Do not count failed checks as brand absences.

Write those findings into your content backlog and link the original evidence. A new guide should answer the customer’s question with actual product knowledge or first-hand work.

At Fulton Ring, we use scheduled tasks and Notion to connect checks to content planning. After publishing a change, repeat the same questions so the pipeline can learn from the next set of answers.