# Every company gets an id that never changes

> Every company is keyed by a random co_ id. Why a name can't be a key, what a merge looks like on the wire, and the one line to add.

Source: https://hyperjobs.io/blog/a-company-id-that-never-changes

*HyperJobs Team · 13 October 2026 · 5 min read*

Every company profile is identified by an id like `co_7Hk2p9Qx`: `co_`
followed by eight letters and digits. It's the key of the [Company
object](/docs/objects/company), it's what
[`/v1/companies/{id}`](/docs/api-reference/companies-retrieve) takes, and
`company_id=` / `exclude_company_id=` filter `/v1/jobs` by it.

The id is *random*: not derived from a name, a board or a website. That
property is the point.

## A name is a terrible key

A derived key is a promise that the thing it was derived from never changes.
Company names fail that promise constantly, and in every direction:

- **They change.** A rebrand, an acquisition, a legal-name cleanup. A key built
  from the old name either changes with it, breaking every id you stored, or
  doesn't, and stops describing the company it names.
- **They collide.** There are a lot of companies called Apex. A key built from
  a name needs a tiebreaker, and the tiebreaker is usually whichever one we saw
  first, which is not a fact about either company.
- **They're wrong at first.** The first time we see an employer it's often a
  board token or a careers-site domain, not the company's real name. The key
  gets minted from the worst information we will ever have about it.

The last one matters most. Resolving postings to companies
is ongoing work: we learn that a careers domain belongs to a company we already
know, that two profiles are the same employer, that a board belongs to a parent
rather than a subsidiary. Every one of those discoveries is good for the data,
and under a derived key, every one of them is a key change you'd have to absorb.

**A key derived from what we know changes when we learn something. A random key
changes never.**

## What the id promises

| Property | What it means for you |
| --- | --- |
| Random | Not built from the name, the domain, or the board. You can't construct one: read it from a job or from `/v1/companies`. |
| Permanent | It doesn't change while the company exists. Store it as a foreign key. |
| Never reused | An id that stops naming a company never names a different one. |
| Present only on a profile | `company.id` is how you tell a full profile from the [minimal fallback](/docs/objects/company#the-three-shapes-on-a-job), which has no id. |

The last row is worth a second look. A job's `company` can be a full profile,
a four-field fallback built from the employer name the posting declared, or
`null`. `id` is the one field guaranteed on the first and impossible on the
second, so it's the test:

```js
const isProfile = job.company?.id != null;
```

## A merge is a redirect

Random keys raise the obvious question: if we discover that `co_A` and `co_B`
are the same company, what happens to the one that goes away?

It keeps its id, and the id becomes a pointer.

<Flow
  caption="A merged id is never deleted and never reassigned. It answers with the company it was folded into."
  steps={[
    { label: "Two profiles", note: "co_A and co_B" },
    { label: "Same employer", note: "we merge them" },
    { label: "co_B survives", note: "jobs move to it" },
    { label: "co_A answers 301", note: "→ /v1/companies/co_B", accent: true },
  ]}
/>

Concretely:

- **`/v1/companies/co_A` answers `301`** with a `Location` pointing at the
  survivor. One hop, always to a company that exists.
- **`company_id=co_A` on `/v1/jobs` matches the survivor's jobs.** A saved
  search keyed on the old id keeps returning the right postings; it doesn't go
  quietly empty.
- **`exclude_company_id=co_A` excludes the survivor**, for the same reason.
  Jobs with no resolved company survive the exclusion.

So nothing you stored breaks when a merge happens. It just gets one redirect
further from the truth than it needs to be.

## The one line to add

Most HTTP clients follow a `301` without telling you. That's fine for reading
(you get the survivor's profile), but it means the stale id stays in your
database forever, and every lookup pays a hop. Notice the redirect and store
where it landed:

```js
const res = await fetch(`https://api.hyperjobs.io/v1/companies/${id}`, {
  headers: { Authorization: `Bearer ${process.env.HYPERJOBS_KEY}` },
});
const company = await res.json();

if (res.redirected) {
  // The id we held was merged into another company. company.id is the survivor's.
  await db.companies.repoint(id, company.id);
}
```

With curl, pass `-L` to follow it, or leave it off and read the `Location`
header yourself, which is the cheaper way to sweep a list of stored ids for
merges: a `301` bills no jobs.

<Note title="Don't parse the id">
  There's nothing in it to read: the eight characters are random, so they say
  nothing about the company, its age, or its source. Store it as text and
  compare it as an opaque string.
</Note>

## Building on it

<Steps>
  <Step title="Key your companies table on id">
    Store `company.id` as the primary key, as text. Names, domains and
    LinkedIn pages are attributes that can change; the id is the one column
    that won't.
  </Step>
  <Step title="Filter by id, not by name">
    `company_id=` and `exclude_company_id=` on `/v1/jobs` take a comma list.
    A saved search keyed on ids keeps matching through a rebrand.
  </Step>
  <Step title="Detect the fallback with id">
    `job.company?.id != null` is a profile. A job without one carries the
    [minimal shape](/docs/objects/company#the-three-shapes-on-a-job): a name
    and little else, so don't upsert it into your companies table as if it were
    a profile.
  </Step>
  <Step title="Handle the 301">
    Follow it, and repoint the stored id when you see one. It's the only part
    that needs code of its own, and it's the part that keeps your data clean
    for good.
  </Step>
</Steps>

The ids you store keep working for as long as the company does, whatever we
find out about it next.
