# Live sync

> Changes sent to you as they happen: every new, changed and closed job, written into your PostgreSQL, Supabase, Neon or MongoDB database, your Algolia, Meilisearch or Elasticsearch index, or posted to your endpoint, so a copy of the data stays current without polling.

Source: https://hyperjobs.io/docs/guides/automatic-sync

Instead of asking the API what changed, choose where the jobs should go and we
keep it current: every job that is new, every job that changed, and every job
that closed, about every five minutes. Set it up under [Live sync](/sync) in your
dashboard, in four steps: the destination, its connection, which jobs, and
switching it on.

| Destination | What you get |
|---|---|
| PostgreSQL, Supabase, Neon | One table, a row per job ([below](#straight-into-postgresql)) |
| MongoDB | One collection, a document per job, `_id` = the job's id |
| Algolia, Meilisearch, Elasticsearch | One index, a record per job, keyed on its id |
| Webhook (Zapier, Make, n8n, your service) | Signed JSON posted to your HTTPS endpoint ([below](#a-delivery)) |

It follows the same changes as [`/v1/jobs/changes`](/docs/api-reference/jobs-changes),
so it covers the jobs the API serves. It can start with every job that matches
your filter, or only with what changes from the moment you switch it on.

## A delivery

A `POST` to your URL, with a JSON body:

```json
{
  "delivery": "d_8c1f0e6a2b7d4f3c9a5e1b0d7c6f2a48",
  "destination": "12",
  "sent_at": "2026-12-02T10:05:03.000Z",
  "events": [
    {
      "type": "job.upsert",
      "id": "j_47f2149e25e4c693",
      "change": "new",
      "changed_at": "2026-12-02T10:01:38.294Z",
      "job": { "id": "j_47f2149e25e4c693", "title": "Senior Manager, Family Office Advisory", "…": "…" }
    },
    {
      "type": "job.remove",
      "id": "j_2b1b0584bd736c34",
      "reason": "closed",
      "changed_at": "2026-12-02T10:02:29.418Z"
    }
  ]
}
```

| Event | What it means | What to do |
| --- | --- | --- |
| `job.upsert` | The job is listed and matches your filter. `job` is the whole [Job object](/docs/objects/job), as `/v1/jobs` returns it. `change` is `new`, `updated`, or `existing` during a first load. | Write it over yours, by `id`. |
| `job.remove` | The job is not yours to hold now. `reason` is `closed`, or `not_in_filter` when it changed and doesn't match your filter as it is now. | Delete it, by `id`. |

<Note>
  **A `job.remove` can name a job you never received.** A closure has to reach
  whoever holds the job, and with a filter every job that changes outside it
  is named too, so that a copy you loaded elsewhere is never left wrong.
  Deleting an id you don't have should simply do nothing. Removals are not
  billed.
</Note>

A delivery carries up to 500 events, or 100 when you asked for descriptions.
Events are in the order the changes happened; a job that changed twice within a
delivery appears once, as it ended.

## Check the signature

Every delivery is signed with your destination's secret (shown when you create
it, and again whenever you ask for it on the Live sync page):

```text
X-HyperJobs-Signature: t=1796206503,v1=5f2b…c9e1
X-HyperJobs-Delivery: d_8c1f0e6a2b7d4f3c9a5e1b0d7c6f2a48
```

`v1` is the HMAC-SHA256, in hex, of `<t>.<the raw body>` under the secret, and
`t` is when we sent it, in Unix seconds. Compute the same over the body exactly
as it arrived, compare, and refuse a `t` more than five minutes old.

```js
import { createHmac, timingSafeEqual } from "node:crypto";
import { createServer } from "node:http";

const SECRET = process.env.HYPERJOBS_SIGNING_SECRET; // whsec_…

function verified(header, body) {
  const { t, v1 } = Object.fromEntries(header.split(",").map((part) => part.split("=")));
  if (!t || !v1 || Math.abs(Date.now() / 1000 - Number(t)) > 300) return false;
  const want = createHmac("sha256", SECRET).update(`${t}.${body}`).digest();
  const got = Buffer.from(v1, "hex");
  return want.length === got.length && timingSafeEqual(want, got);
}

createServer((req, res) => {
  const chunks = [];
  req.on("data", (chunk) => chunks.push(chunk));
  req.on("end", async () => {
    const body = Buffer.concat(chunks).toString("utf8");
    if (!verified(String(req.headers["x-hyperjobs-signature"] ?? ""), body)) {
      res.writeHead(401).end();
      return;
    }
    for (const event of JSON.parse(body).events) {
      if (event.type === "job.upsert") await saveJob(event.id, event.job);   // write over yours
      if (event.type === "job.remove") await deleteJob(event.id);            // nothing to do if you never had it
    }
    res.writeHead(200).end();
  });
}).listen(8080);
```

## What your endpoint must do

- **Answer `2xx` within 15 seconds.** If a delivery takes longer to process,
  store it and answer first.
- **Accept the same delivery twice.** Anything but a `2xx` and we send that
  delivery again, so a delivery can arrive more than once. Both events are safe
  to repeat: an upsert writes the same job, a remove deletes what is already gone.
- **Be reachable over HTTPS on the public internet.** Redirects are not followed.

When a delivery fails we try again after 5 minutes, then 10, 20, 40, and every
hour after that. Nothing is skipped meanwhile: deliveries stay in order, and the
next one waits for the one that failed.

## Straight into PostgreSQL

Choose **PostgreSQL**, **Supabase** or **Neon** and there is nothing to run on
your side: we write the changes into one table of your database. For Supabase,
use the values under **Connect → Session pooler**; for Neon, the parameters under
**Connect**.

```sql
CREATE TABLE hyperjobs_jobs (
  id         text PRIMARY KEY,
  job        jsonb NOT NULL,         -- the job, as /v1/jobs returns it
  changed_at timestamptz NOT NULL,   -- when it changed in our catalogue
  synced_at  timestamptz NOT NULL    -- when we wrote it
);
```

- **A new or changed job** is written over the row with its `id`; **a closed
  job**, or one that left your filter, is deleted.
- **Each delivery is one transaction:** your table never holds half of one, and a
  delivery sent twice leaves it as it was.
- **We make the table** if it isn't there. To make it yourself, use the columns
  above (add your own indexes and views on top); then the user needs only
  `SELECT`, `INSERT`, `UPDATE` and `DELETE` on it.
- **Give us a user of its own**, one that can write this table and nothing else:

  ```sql
  CREATE USER hyperjobs_writer WITH PASSWORD '…';
  GRANT USAGE, CREATE ON SCHEMA public TO hyperjobs_writer;  -- CREATE only if we make the table
  ```
- **The connection string** looks like
  `postgres://hyperjobs_writer:…@db.example.com:5432/analytics`. We always
  connect with TLS; add `?sslmode=verify-full` to have the server's certificate
  checked as well. The database must be reachable on the public internet; if its firewall lists who may connect, allow the addresses the setup shows at its Connect step. The
  connection string is stored encrypted and never shown again; to change it,
  paste a new one.

**Send a test** connects, makes or checks the table, and writes nothing.

## Into MongoDB or a search engine

The same changes, written the way each one stores data:

- **MongoDB:** one document per job in the collection you choose, with `_id` set
  to the job's id, the job under `job`, and `changed_at` and `synced_at` as
  dates. Give us a user with `readWrite` on one database. In Atlas, allow our
  addresses under **Network Access**: the setup shows them at its Connect step.
- **Algolia:** one record per job, `objectID` set to the job's id. Use an API key
  with the `addObject` and `deleteObject` rights, limited to the index. A record
  has a size limit on Algolia's side: send descriptions as plain text, or leave
  them out.
- **Meilisearch:** one document per job, primary key `id`. The key needs
  `documents.add`, `documents.delete`, `indexes.create`, `indexes.get` and
  `tasks.get`.
- **Elasticsearch:** one document per job, `_id` set to the job's id. The API key
  needs to write and create the index.

A changed job replaces its record whole; a closed job, or one that left your
filter, is deleted. When the sync made the first load itself, it is told only to
delete what it sent you. Keys and connection strings are stored encrypted and never
shown again. **Send a test** checks the connection and the rights, and writes
no job.

## Which jobs

Leave the filter empty to receive every job, or give it the same filters as
[`/v1/jobs`](/docs/guides/filtering), written as in a URL:

```text
country=US&remote=true
country=DE&posted_gte=2026-06-01
```

Descriptions are left out unless you ask for them, as plain text or as HTML.

## What it starts with

When you switch it on, choose:

- **Every matching job first.** We send every job the API lists now that passes
  your filter, as `job.upsert` events with `change: "existing"`, then follow
  the changes from the moment you switched it on, so nothing in between is
  missed (a job that changed during the load is sent again, as it is now). The
  page shows how many jobs match, and how many your month has left, before you
  accept.
- **Changes from now.** Only what is new, changed or closed from that moment.
  Load what you already want first, from [the files](/docs/guides/dataset-files)
  or the API.

Closed jobs and older history are not in the sync: they come as
[files](/docs/guides/dataset-files).

## What it costs

A job sent is counted like a job returned by the API: one job of your plan's
month for each `job.upsert`, first load included. Removals and test deliveries
are not counted. A delivery is never larger than what your month has left; when
it runs out the sync stops, and carries on from where it was when you switch it
on again, next month or on a larger plan. For a larger load,
[talk to us](/docs/support).

## When it stops

The sync stops by itself, and we email you, when:

- **no delivery got through for a day**: fix your endpoint, then switch it on
  again and it carries on from where it stopped;
- **the month's jobs are used up**: it carries on when you switch it on again,
  after the month turns or on a larger plan;
- **it has fallen more than 30 days behind**, which is as far back as changes
  are kept: load your copy again, then switch it on and it starts from that
  moment.

You can pause it, change it or delete it at any time. An account can have two
destinations.

## Next

<CardGroup cols={2}>
  <Card title="The dataset in files" icon="Briefcase" href="/docs/guides/dataset-files">
    Load everything first, then let the sync keep it current.
  </Card>
  <Card title="Syncing the feed" icon="RefreshCw" href="/docs/guides/feed-sync">
    The same result, pulled from your side on your own schedule.
  </Card>
</CardGroup>
