Blog
A profile stops at ten employers, so page the rest of the career history yourself
A person record holds the ten most recent employer groups. Here is how to tell a record is cut short, page the rest in as few credits as possible, and merge it.
experience[] on a person record holds at most the ten most recent employer groups. skills[]
holds at most twenty. Those are the source’s limits, not a page size you can raise, and the record
does not tell you when it has hit them. A profile with exactly ten groups might be the whole
career, or the first ten of twenty three.
For most jobs that does not matter. Detecting a job change only needs experience[0]. But tenure
scoring, alumni matching and “has this person ever worked at a company like ours” all read the
tail of the list, and the tail is exactly what gets cut.
Which jobs need the rest
| Job | Reads | Needs more than ten groups |
|---|---|---|
| Job change detection | experience[0] | no |
| Current title and seniority | experience[0].positions[0] | no |
| Total years of experience | every date_range | yes, for long careers |
| Alumni of a company or industry | every company_id | yes |
| Career path features for scoring | the whole sequence | yes |
If none of your fields read past the first few groups, stop here and keep the one credit lookup. The person records guide covers mapping the groups you already have.
How to tell a record is cut short
The rule is simple and it is the only signal you get:
- Fewer than ten groups: the list is complete.
- Exactly ten groups: it may be truncated. Only
totalfrom the experiences endpoint can say.
Do not try to infer it from dates. A person with ten employers who started their career recently looks the same as one with thirty who started long ago once you only see the most recent ten.
The experiences endpoint
GET /v1/people/experiences returns one page of employer groups in exactly the shape of the
profile’s experience[]: company, dates and nested positions[]. It takes three parameters.
| Parameter | Rule |
|---|---|
entity_urn | the bare ACo... value from the profile; a slug or a urn:li: string is a free 400 |
count | groups per page, 1 to 30, default 10 |
start | zero based offset, and it must be a multiple of count |
Every page costs one credit, whatever its size. The response carries total, the person’s true
employer count, and has_more.
curl -sS "https://api.triguna.ai/v1/people/experiences?entity_urn=$ENTITY_URN&start=0&count=30" \
-H "ApiKey: $TRIGUNA_KEY" -D -
Trimmed to one group and a few fields:
{
"entity_urn": "ACoAAB1exampleUrn9Xy",
"start": 0,
"count": 30,
"total": 23,
"has_more": false,
"experiences": [
{
"company_name": "Freelance",
"company_id": null,
"date_range": {
"start": { "year": 2012, "month": 1, "day": null, "iso": "2012-01" },
"end": { "year": 2013, "month": 5, "day": null, "iso": "2013-05" }
},
"positions": [
{ "title": "Contract Developer", "employment_type": "Freelance", "location_name": null }
]
}
]
}
The urn has to be the bare one. If you only hold a slug or a URL, the profile lookup resolves it
and returns entity_urn, which is one more reason to
key records on the stable identifier from the start.
The paging trap
The obvious plan is to skip what you already have: start at 10 and page forward. The multiple of
count rule quietly makes that the expensive plan. start=10 is only valid with a count of 1,
2, 5 or 10, so the most you can take per page is ten groups. Ask for start=10&count=30 and you get
a free 400 with this body:
invalid start: must be a multiple of count (10); walk the list from 0 adding count each page
The cheaper plan is to ignore the ten you already hold and walk from zero at the maximum page size. You re-read ten groups you had, and that costs nothing, because a page is one credit whether it holds ten groups or thirty.
Employer groups (total) | start=10, count=10 | start=0, count=30 |
|---|---|---|
| 11 to 20 | 1 page | 1 page |
| 21 to 30 | 2 pages | 1 page |
| 31 to 40 | 3 pages | 2 pages |
| 41 to 60 | 4 to 5 pages | 2 pages |
Walking from zero at thirty is never more pages than starting at ten, and it means the history you store comes from one endpoint in one consistent pass, instead of being stitched from two responses fetched at different times.
The code
This runs on Node 18 or later with the built in fetch. It skips the call entirely when the
profile is already complete, walks from zero at the maximum page size, and retries only what is
worth retrying.
const BASE = 'https://api.triguna.ai/v1';
const PAGE = 30;
type Group = {
company_id?: string | null;
company_name?: string | null;
date_range?: { start?: { iso?: string | null } | null; end?: { iso?: string | null } | null } | null;
positions?: unknown[] | null;
};
type Page = { total: number | null; has_more: boolean | null; experiences: Group[] };
const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
async function getPage(urn: string, start: number, key: string): Promise<{ page: Page; credits: number }> {
const url = `${BASE}/people/experiences?entity_urn=${encodeURIComponent(urn)}&start=${start}&count=${PAGE}`;
for (let attempt = 0; attempt < 5; attempt++) {
const res = await fetch(url, { headers: { ApiKey: key } });
// Credits are decimal, so parse as a number, never as an int.
const credits = Number(res.headers.get('X-Credits-Charged') ?? 0);
if (res.ok) return { page: (await res.json()) as Page, credits };
if (res.status === 429 || res.status === 502 || res.status === 503) {
const wait = Number(res.headers.get('Retry-After') ?? 0) * 1000 || 500 * 2 ** attempt;
await sleep(wait);
continue;
}
// 400, 401, 402 and 404 will not change on a retry. A 404 is charged, so never loop on it.
throw new Error(`experiences ${res.status}: ${await res.text()}`);
}
throw new Error('experiences: retries exhausted');
}
export async function fullHistory(profile: { entity_urn: string; experience?: Group[] | null }, key: string) {
const first = profile.experience ?? [];
if (first.length < 10) return { groups: first, total: first.length, credits: 0 };
const groups: Group[] = [];
let start = 0;
let total: number | null = null;
let credits = 0;
for (;;) {
const { page, credits: c } = await getPage(profile.entity_urn, start, key);
credits += c;
groups.push(...page.experiences);
total = page.total ?? total;
if (!page.has_more || page.experiences.length === 0) break;
start += PAGE;
}
return { groups, total: total ?? groups.length, credits };
}
Two details in there are deliberate. The loop stops on has_more, the field the endpoint defines
for that job, rather than counting groups against total. And it also stops on an empty page, so
a response that disagrees with itself can never make it spin.
Which enrichment errors to retry has the reasoning behind the retry set.
Merging and storing
Because the experiences pages hold the same shape as the profile’s experience[], the simplest
merge is no merge: when you fetch the full history, store it in place of the profile’s ten and keep
the profile’s copy only for records you did not page.
Store three more things next to it:
experience_total, thetotalfrom the response, so you can tell later that the list is complete.experience_fetched_at, because the history and the profile can be fetched on different days.- The raw page payloads, for the reasons in storing the raw payload.
If you key groups yourself, use company_id when it is present. It can be null: a group like
“Freelance” carries a company_name and no id. Fall back to the name plus date_range.start.iso
for those, and treat the whole group as nullable in the way
handling partial records describes.
What it costs
Every truncated record costs its profile lookup plus ceil(total / 30) pages. Everything else
costs nothing extra, because the code above never calls the endpoint for a record with fewer than
ten groups.
As a worked example, not a measurement: if 200 of 1,000 profiles come back with exactly ten groups
and none of those people has more than thirty employers, the history pass is 200 credits on top of
the 1,000 for the profiles. At $0.005 a credit, listed on pricing, that is one dollar.
Run it with start=10&count=10 instead and anyone with more than twenty employers costs you at least
one extra page.
How often to re-read it
Rarely. The tail of a career does not change. What changes is the top, and you already re-read the top every time you refresh the profile. Re-page the history when the profile’s first group changes, which is the signal in detecting job changes by diffing experience, and otherwise leave it alone. How often to re-enrich covers setting that window per field.
Next
- Person API: what
GET /v1/people/profilereturns, includingentity_urn. - Person records: reading
experience[]andpositions[], and deriving tenure. - Handling partial records: null company ids and thin groups.
- Detect job changes by diffing experience: the top of the list, watched over time.
- About Triguna: why the parsing traps, including this one, get written down.
- Pricing: what each endpoint costs. Sign up for fifty free credits at app.triguna.ai/signup.