All posts
Engineering

The same role posted twice is one job

A role mirrored to Greenhouse and LinkedIn is one posting, not two. What deduplication has to decide, and what the API lets you see.

HyperJobs Team7 min read

A company opens a role on its ATS. An aggregator picks it up. A job board syndicates it. Read all three boards and one role arrives as three rows from three sources, with three ids and three apply URLs.

There is one job. Deciding that is deduplication, and it is one of two mechanisms in this API that reduce the number of rows you get back. The two are constantly mistaken for each other, so start here:

DedupCollapse
What it mergesThe same posting mirrored across boardsDifferent postings sharing company + title
ExampleOne Stripe job on Greenhouse and LinkedIn40 separate "Barista" postings, one per store
TriggerAutomatic on the whole catalogueOpt-in via ?collapse=true
Can you change it?Yes: include_duplicates, and a source filter includes themIt's off by default
EffectThe mirror rows are marked, and left out of the default listingRows are grouped, with an openings count

The one-line version: dedup hides a posting you would otherwise see twice. Collapse folds genuinely separate postings that happen to share a name.

Dedup is a flag, not a delete

When mirrors of one posting are identified, the extras get a duplicate_of pointing at the row we kept. Both /v1/jobs and /v1/jobs/feed leave flagged rows out by default. include_duplicates=true asks for the mirrors, each with its duplicate_of, and /v1/jobs/{id} returns one like any posting.

The flag is the important design decision. Marking is reversible and non-destructive: a row identified as a duplicate is flagged, never deleted. If the matching turns out to be wrong, the flag clears and the row comes back.

That is why duplicate_of is a column and not a DELETE. Any dedup system is making a judgement call about identity, some of those calls are wrong, and a DELETE makes being wrong permanent. A flag makes it a bug you can fix.

The one place it shows

Dedup costs you nothing to think about, with one exception, and it is about counting.

Without a source filter, /v1/jobs/count counts distinct jobs, not postings. That is almost always what you wanted. With one, it counts every posting that board carries:

BASH
# Every posting on Greenhouse, mirrors of jobs we keep elsewhere included.
curl -G https://api.hyperjobs.io/v1/jobs/count \
  -H "Authorization: Bearer $HYPERJOBS_KEY" \
  --data-urlencode "source=greenhouse"

A role that exists on both Greenhouse and LinkedIn is counted under both, so per-source totals add up to more than the whole catalogue's. Add include_duplicates=false and ?source= counts only the postings Greenhouse won. Either breakdown is fine; say which one you publish.

Read /v1/meta for the size of that gap rather than hardcoding a number that rots.

/v1/meta reports both counts. jobs is one per job, the number /v1/health reports too; postings is every posting, mirrors included, and what the per-source counts in sources add up to. The gap between them is the duplicates.

Collapse is a different question

Some employers post one row per location. A retailer hiring baristas in 40 stores files 40 real, distinct postings: 40 ids, 40 apply URLs, 40 legitimately separate applications. None of them are duplicates. They are just repetitive.

collapse=true groups them:

BASH
curl -G https://api.hyperjobs.io/v1/jobs \
  -H "Authorization: Bearer $HYPERJOBS_KEY" \
  --data-urlencode "organization=starbucks" \
  --data-urlencode "collapse=true"

The grouping key is the company and the title: the company's id where the job has one, else the employer's name as the posting writes it, capitals ignored.

Three things change in the response. collapsed: true appears at the top level. Every job gains an openings count. And each row is a group, so count is the number of groups on the page, not postings.

JSON
{
  "collapsed": true,
  "count": 50,
  "limit": 50,
  "offset": 0,
  "has_more": true,
  "data": [
    {
      "id": "j_5e81c07b2d94af36",
      "title": "Barista",
      "openings": 40,
      "company": { "id": "co_Sb8uX2kL", "name": "Starbucks" }
    }
  ]
}

That shape is illustrative: the counts are there to show you the structure, not to report anything.

The representative row is one real posting

`openings: 40` tells you 39 other postings exist. It does not give you any of them.

Each group is represented by whichever posting is most recent. It is not a merged or synthesised record. It is one real posting standing in for the group.

Everything posting-specific about the other 39 is not in the response and not reachable from it: their ids, their locations, and critically their apply_urls. There is no parameter to expand a group.

If a user needs to apply to the Denver store specifically, a collapsed response cannot serve them. Query without collapse and group client-side instead.

The corollary bites hardest with location filters. Filters run before the grouping, so city=Denver with collapse=true groups only the Denver postings: the representative is a Denver one, and openings counts the Denver stores, not the employer's 40. The filter and the grouping compose, just not into "groups that include Denver".

Collapse also groups on the exact title string. "Barista" and "Barista (Part Time)" are two groups, not one. It is a GROUP BY, not a fuzzy match, which makes it predictable, and means openings is a floor on how repetitive an employer actually is.

When to reach for it

Do collapse when the group is the unit you care about. Forty identical "Barista" cards is a broken result page; one card reading "Barista · 40 openings" is the correct presentation, in a single request. Same for "how many companies are hiring for X": without collapse you are counting postings, and one multi-location employer dominates the count.

Don't collapse when the posting is the unit. You need every apply_url, or location matters, or you are syncing a mirror, and the feed has no collapse anyway, because sync is posting-level by definition.

Expiry, the third mechanism

Not deduplication, but it is the other reason a row you expected is missing.

Postings are expired by board-diffing: every re-read compares the source board's current listing against what we hold, and a posting the board stops listing closes once that's confirmed. The employer taking the job down is the signal. We do not guess.

A closed posting is deleted. Its tombstone is how you hear.

/v1/jobs, the feed and /v1/jobs/{id} all stop returning a closed posting, the last with a 404. A sync consumer has to see a posting die in order to delete its own copy, and a row that just stops appearing can't tell "dead" from "unchanged". So each deletion leaves a tombstone on /v1/jobs/expired. Replay those as deletes. Syncing the feed has the loop.

Which one is eating my rows?

  1. Is `collapsed: true` in the response?

    Then every row is a group, standing in for openings others. Drop collapse to see postings.

  2. Is the row expired?

    Fetch it with /v1/jobs/{id}: a closed posting answers 404. Its tombstone on /v1/jobs/expired is the signature, and its reason says whether it left its board or we stopped serving it.

  3. Is the row a duplicate?

    If a posting exists on two boards and you only ever see one, dedup picked a winner. That is working correctly: pass include_duplicates=true, or filter by the other board's source, and it's there with duplicate_of.

  4. Or is it just a filter?

    Far more likely than any of the above. A bad enum value is a 400 naming the allowed values, but the open vocabularies (skill, source, …) just match nothing. See filtering.

The full reference is duplicates & collapsing.