Skip to content
Integrations

REST API

The Needle REST API for n8n, Make, Zapier, Clay and scripts: leads, lead status, searches, reply drafts, trending problems and usage.

On this page

The REST API exposes the same operations as the MCP server, for automation tools (n8n, Make, Zapier, Clay) and scripts.

  • Base URL: https://api.useneedle.net/v1
  • OpenAPI 3.1: https://api.useneedle.net/v1/openapi.json (import it into Postman, Bruno, n8n or a client generator)
  • Auth: Authorization: Bearer ndl_live_… from Settings → API & MCP
  • Who can use it: Growth and Scale plans, and the free 7-day trial (full access)

Quick start

Check your key with the free usage call (it does not count against your quota):

export NEEDLE_API_KEY="ndl_live_…"
curl "https://api.useneedle.net/v1/usage" -H "Authorization: Bearer $NEEDLE_API_KEY"

Then fetch the last day's leads. Quote the URL: ? and & mean something to your shell.

curl "https://api.useneedle.net/v1/leads?since=24h&limit=10" -H "Authorization: Bearer $NEEDLE_API_KEY"

Responses are JSON. Lists page with limit (max 50) and cursor: pass next_cursor from one page as cursor for the next, with the same filters.

A full round trip

Find leads, draft a reply, and mark the lead once you have posted it:


curl "https://api.useneedle.net/v1/leads?since=7d&limit=5" -H "Authorization: Bearer $NEEDLE_API_KEY"

## 2. Two reply drafts for one of them (uses a daily draft)
curl -X POST "https://api.useneedle.net/v1/leads/LEAD_ID/drafts" \
  -H "Authorization: Bearer $NEEDLE_API_KEY" -H "Content-Type: application/json" \
  -d '{"tone":"casual"}'

## 3. After you post a reply yourself
curl -X PATCH "https://api.useneedle.net/v1/leads/LEAD_ID" \
  -H "Authorization: Bearer $NEEDLE_API_KEY" -H "Content-Type: application/json" \
  -d '{"status":"replied"}'

Run a live search for new keywords and wait for it:

const headers = {
  Authorization: `Bearer ${process.env.NEEDLE_API_KEY}`,
  'Content-Type': 'application/json',
};
let res = await fetch('https://api.useneedle.net/v1/search', {
  method: 'POST',
  headers,
  body: JSON.stringify({ keywords: ['crm for freelancers'], timeframe: '7d' }),
});
let search = await res.json();
// 202 means it is still running: poll the Location (free) every ~30 seconds.
while (res.status === 202 || search.status === 'running') {
  await new Promise(r => setTimeout(r, 30_000));
  res = await fetch(`https://api.useneedle.net/v1/searches/${search.search_id}`, { headers });
  search = await res.json();
}
if (!res.ok) throw new Error(`${search.error.code}: ${search.error.message}`);
console.log(search.status, search.leads.length, 'leads');

The same in Python:

import os, time, requests

headers = {"Authorization": f"Bearer {os.environ['NEEDLE_API_KEY']}"}
res = requests.post("https://api.useneedle.net/v1/search", headers=headers,
                    json={"keywords": ["crm for freelancers"], "timeframe": "7d"})
search = res.json()
while res.status_code == 202 or search.get("status") == "running":
    time.sleep(30)
    res = requests.get(f"https://api.useneedle.net/v1/searches/{search['search_id']}", headers=headers)
    search = res.json()
res.raise_for_status()
print(search["status"], len(search["leads"]), "leads")

Endpoints

Endpoint Operation What it does Scope Cost
GET /v1/brands list_brands List brands leads:read 1 call
GET /v1/leads get_leads Get leads leads:read 1 call
POST /v1/leads/status update_lead_status Update lead status leads:write 1 call
GET /v1/leads/{id} get_lead Get one lead leads:read 1 call
PATCH /v1/leads/{id} update_lead_status Update lead status leads:write 1 call
POST /v1/leads/{id}/drafts draft_reply Draft a reply drafts:write 1 call
POST /v1/search search Search communities search:run 1 call
GET /v1/searches/{id} get_search Get search results search:run free
GET /v1/trending-problems get_trending_problems Get trending problems trending:read 1 call
GET /v1/usage get_usage Get usage any free

Each operation's inputs and outputs are in the OpenAPI document. Leads use the needle.lead.v1 shape, the same as the lead object in webhook events.

Searches

POST /v1/search waits up to 25 seconds. A finished search answers 200 with up to 10 leads per network (40 in total). A longer one answers 202 with status: "running" and a Location: /v1/searches/{id} header; poll it about every 30 seconds (free) until status is complete or failed. A search's status and leads stay available from GET /v1/searches/{id} for 24 hours; the leads also stay in your Needle dashboard.

Headers

  • X-RateLimit-Limit, X-RateLimit-Remaining: the per-key minute window. A 429 adds Retry-After and X-RateLimit-Reset.
  • X-Needle-Quota-Monthly-Remaining: API calls left this month, after a counted call.
  • X-Request-ID: on every response. Send your own (8-128 letters, digits, ., _, :, -) to correlate logs; error bodies repeat it as request_id.

API keys

Create a key in Settings → API & MCP. Keys start with ndl_live_ and are shown once, so store them like a password. Revoke a key there at any time; it stops working within seconds. Keys never expire unless you pick an expiry (30, 90 or 365 days).

Each key has scopes. All are ticked by default; untick some for a narrower key, for example a read-only dashboard key.

Scope Allows
leads:read Read your brands and leads
leads:write Change lead status (replied, done, dismissed)
search:run Run searches (uses your daily search runs)
drafts:write Generate reply drafts (uses your daily drafts)
trending:read Read trending problems

Send the key as Authorization: Bearer ndl_live_… (or x-api-key: ndl_live_…). Never put it in a URL.

Plans and limits

The API and MCP server are included in the Growth and Scale plans and in the free 7-day trial (full access, no card).

Growth Scale
API calls a month 1,000 10,000
Requests a minute 60 per key, 300 per account 60 per key, 300 per account
Searches and reply drafts your daily plan limits, shared with the dashboard same
API keys up to 10 active up to 10 active
  • Every tool call counts as one API call, only when it succeeds. get_usage and get_search are free.
  • search counts when it starts. A search that fails or is interrupted later does not use one of your daily searches, but the call that started it stays counted.
  • Monthly calls reset on the 1st at 00:00 UTC. Daily searches and drafts reset at 00:00 UTC.
  • One search runs at a time per account.
  • Needle never posts for you. Reply drafts are text for you to review and post yourself.

Networks

Use these ids in networks (search) and platform (leads). Names work too ("Hacker News", "X"); an unknown id is a 400 listing the valid ones.

Id Network Plans Default search
reddit Reddit Solo+
stackoverflow Stack Overflow Solo+
devto Dev.to Growth+
hackernews Hacker News Solo+
youtube YouTube Growth+
github GitHub Solo+
mastodon Mastodon Solo+
lobsters Lobsters Solo+
tumblr Tumblr Growth+
twitter X Scale+ Only when named (slow, metered)
linkedin LinkedIn Scale+ Only when named (slow, metered)
bluesky Bluesky Solo+
forum Forums Growth+
producthunt Product Hunt Solo+
lemmy Lemmy Growth+

Without networks, a search covers every network your plan includes except the ones marked above.

Errors

Errors have a stable code you can rely on, a doc_url pointing at the row below, and the request_id to quote to support (also in the X-Request-ID header of every response):

{
  "error": {
    "code": "search_in_progress",
    "message": "You already have a search running. Wait for it with get_search, then start another.",
    "details": { "search_id": "aBcD1234eFgH5678iJkL" },
    "doc_url": "https://useneedle.net/docs/api#error-search_in_progress",
    "request_id": "3f1c9a2e-5d1b-4c3a-9e7f-2b8d6c4a1e0f"
  }
}

Over MCP, a failed tool call returns the same fields as text: the code and message on the first line, then details, doc_url and request_id as JSON.

Code Meaning
invalid_request Bad input. details.fields lists each problem (for example an unknown network id, with the valid ones).
invalid_token Missing, unknown, revoked or expired key or access token. MCP clients signed in with OAuth refresh and retry.
insufficient_scope The key lacks the scope in details.required_scope.
account_deleted The account was deleted.
api_plan_required The account has no API access right now: its plan doesn't include it, or the trial or subscription has ended (details.reason). Upgrade at details.upgrade_url; keys and connected apps are kept and work again after.
api_access_disabled API access was disabled for this account. Contact support.
not_found Not found, or not yours.
rate_limited Too many requests. Wait Retry-After seconds.
monthly_quota_exceeded Monthly API call limit reached. details.resets_at says when it resets (no Retry-After: retrying before then cannot succeed).
daily_limit_exceeded No searches or reply drafts left today. Resets 00:00 UTC.
plan_restricted The plan does not allow this network, timeframe or feature.
branding_required Add a company name and product description in Settings before drafting.
search_in_progress A search is already running (details.search_id). Poll it first.
search_failed The search failed on every network. Try again.
busy Capacity is busy. Retry shortly.
service_disabled The API is temporarily off. Retry later.
upstream_error An upstream service failed. Retry shortly.
internal_error Our fault. Retry; the call is not counted.

Versions and changes

Current version: 1.2.0 (the MCP server and the OpenAPI document share it). Changes are listed in the changelog.

  • Tools, endpoints, inputs and output fields are never renamed or removed, and an optional input never becomes required. New things are added alongside.
  • New optional output fields and new error codes can appear at any time; ignore what you do not know.
  • If a breaking change is ever unavoidable, it gets a new major version, a notice in the changelog, and at least a month in which the old behaviour keeps working.