Webhooks

A search that is not fast enough returns 202. You can poll it, or give Humos a URL to call.

Ask for a webhook

Set webhook_url on the search. wait_seconds controls how long the first call may wait. It is 0 to 60, default 30.

{
  "titles": ["Head of Operations"],
  "wait_seconds": 0,
  "webhook_url": "https://app.yourcompany.example/hooks/humos/7f3a9c1e5b"
}
{
  "id": "srch_example_03",
  "status": "queued",
  "created_at": "2026-12-03T11:00:00Z"
}

What is not specified yet

Webhook delivery is still being built. The contract defines the webhook_url field and nothing about the call itself.

TopicStatus
Request method and bodyNot specified yet
Signing and verificationNot specified yet
Retries, timeouts and orderNot specified yet
Expected reply from youNot specified yet
Calls for searches that finish in time, or that failNot specified yet

Treat a webhook as a hint

This advice holds however delivery ends up working.

  • Do not trust the body. Read the search again with GET /v1/searches/{id} and your API key.
  • Use a URL with a long random part, one per search, and map it to the search id yourself. Anyone who learns the URL can call it.
  • Use HTTPS and a publicly reachable address.
  • Reply quickly with a 2xx status and do the work afterwards.
  • Expect no call, a late call or repeated calls. Make your handler safe to run twice.
  • Poll as a fallback for any search you have not heard about.

Example handler

This Node 22 server ignores the request body. It looks up the search it created for that URL and reads it from the API.

import { createServer } from "node:http";

// Random URL part -> search id. Save this when you create the search.
// Use a database in real code.
const pending = new Map<string, string>();

async function refresh(token: string, id: string) {
  const res = await fetch(`${process.env.HUMOS_API_URL}/v1/searches/${id}`, {
    headers: { Authorization: `Bearer ${process.env.HUMOS_API_KEY}` },
  });
  if (!res.ok) return; // your polling job tries again later
  const search = await res.json();
  if (search.status === "completed" || search.status === "failed") {
    pending.delete(token);
    // store the outcome here
  }
}

createServer((req, res) => {
  req.resume();
  const token = req.url?.split("/").pop() ?? "";
  const id = pending.get(token);
  res.writeHead(id ? 204 : 404).end();
  if (id) refresh(token, id).catch(console.error);
}).listen(3000);

A call could arrive before you have saved the id from the first response. Your polling fallback covers that case.