Skip to content

End-to-End Automation Workflow

A reference pattern for wiring NeuronWriter into a content-generation pipeline: create a query, wait for recommendations, generate a draft with an LLM, score it, revise until it clears a target, then import the winner.

flowchart TD
  A[Pick keyword + project] --> B[/new-query/]
  B --> C[Poll /get-query until status=ready]
  C --> D[Extract terms_txt + entities + PAA + word_count target]
  D --> E[LLM writes draft using terms as the brief]
  E --> F[/evaluate-content/ -> content_score]
  F --> G{score >= target?}
  G -->|no| H[Feed missing terms back to LLM] --> E
  G -->|yes| I[/import-content/ saves final revision]
  I --> J[Human review in editor, tag 'Done']

Reference implementation (Python)

python
import json, requests, time

API_ENDPOINT = 'https://app.neuronwriter.com/neuron-api/0.5/writer'
API_KEY = '<your-neuron-api-key>'
HEADERS = {"X-API-KEY": API_KEY, "Accept": "application/json", "Content-Type": "application/json"}

def call(method, payload):
    r = requests.post(f"{API_ENDPOINT}/{method}", headers=HEADERS, data=json.dumps(payload))
    r.raise_for_status()
    return r.json()

def new_query(project, keyword, engine="google.com", language="English"):
    return call("new-query", {
        "project": project, "keyword": keyword,
        "engine": engine, "language": language,
        "competitors_mode": "top-intent",
    })

def wait_for_recs(query_id, timeout=300):
    start = time.time()
    while time.time() - start < timeout:
        data = call("get-query", {"query": query_id})
        if data.get("status") == "ready":
            return data
        time.sleep(15)
    raise TimeoutError("Recommendations not ready in time")

def evaluate(query_id, html):
    return call("evaluate-content", {"query": query_id, "html": html})

def import_final(query_id, html, title, description):
    return call("import-content", {
        "query": query_id, "html": html,
        "title": title, "description": description,
    })

# 1. Create + wait
q = new_query("c2fe46bce8019bff", "trail running shoes", engine="google.co.uk")
recs = wait_for_recs(q["query"])

# 2. Build a writing brief from the recommendations
brief = {
    "word_count_target": recs["metrics"]["word_count"]["target"],
    "title_terms": recs["terms_txt"]["title"],
    "body_terms": recs["terms_txt"]["content_basic"],
    "questions": [x["q"] for x in recs["ideas"]["people_also_ask"]],
    "entities": [e["t"] for e in recs["terms"].get("entities", [])],
    "top_intent": recs.get("serp_summary", {}).get("top_intent"),
}

# 3. Generate draft with your LLM of choice using `brief`, then score it
# html = your_llm_writer(brief)
# result = evaluate(q["query"], html)
# while result["content_score"] < TARGET:
#     html = your_llm_writer(brief, previous=html, score=result["content_score"])
#     result = evaluate(q["query"], html)

# 4. Save the winning revision
# import_final(q["query"], html, title="...", description="...")

Cost discipline

Every /new-query consumes a monthly query credit (same cost as creating one in the UI). Batch your keywords, dedupe before creating queries, and reuse existing queries with /get-query / /get-content wherever possible.