All posts
Engineering

This API tells you when you're wrong

A bad parameter is a 400 that names it, never a silent drop. Why strict validation is the kindest thing an API can do with your quota.

HyperJobs Team7 min read

You want junior roles, so you send ?seniority=junior. You get:

JSON
{
  "error": "invalid request",
  "param": "seniority",
  "hint": "'junior' is not valid. Allowed: intern · entry · mid · senior · lead · director · executive"
}

A 400, the parameter that caused it, and the seven values that would have worked, one of which is visibly the one you meant. Total time lost: the time it takes to read a sentence.

That response is the whole design. There is exactly one failure mode for bad input, it is loud, and it names names.

The complete status code list

StatusMeaningRetry?
200Success.—
400A parameter was unknown, empty, or malformed. The body names it.No: fix the parameter
401Missing, unknown, or revoked API key.No: fix the key
301A company id merged into another. Location names the survivor.Follow it, store the new id
404Unknown job id, company id, or endpoint path.No
405Non-GET method. The API is read-only.No
402Monthly quota exhausted.No: until the 1st, or upgrade
403The company CSV export on the Free plan.No
429Per-minute rate limit exceeded.Yes: honor Retry-After
500Unhandled server error, with a request_id.Yes, with backoff

Read the second row for what it promises. Not "rarely a 400", not "a 400 on some endpoints": every parameter on every endpoint is validated against the same spec the server executes, and anything that doesn't hold is rejected before a single row is scanned.

  1. Your query string

    however many params, however spelled

  2. Validate every param

    unknown name? empty? bad value?

  3. 400 {error, param, hint}

    the first violation, named

  4. …or run the query

    every filter you sent, applied

One gate, before the query runs. Nothing bad gets past it quietly.

What gets rejected, exactly

You sendYou get told
?seniorty=directorunknown parameter: see /openapi.json for the full list
?seniority=junior'junior' is not valid. Allowed: intern · entry · …
?country=XZ'XZ' is not a known ISO-2 country code
?time_frame=1weekmust be <n><m|h|d>, e.g. 15m, 2h, 7d (m = minutes)
?limit=-1minimum is 1
?limit=0minimum is 1
?cursor=garbageinvalid cursor: pass the previous response's next_cursor verbatim
?title=(rust ORinvalid search syntax on the parameter, with the reason

In a lenient API, every one of those is a 200. The misspelled parameter is ignored and the count comes back inflated. The wrong enum runs literally and the count comes back zero. time_frame=1week is skipped entirely and quietly returns results from all time. limit=-1 can fall through to "no limit" and return the dataset.

Two of those failures lie upward, one lies downward, and one mails you everything. All four wear the same status code as success. That's the failure mode strict validation exists to prevent.

A silent drop is a quota-burning trap

Here's the argument in billing terms, because that's where it lands.

The monthly quota bills every row you're sent, including the ones that answer a question you didn't ask. A dropped filter doesn't just mislead you; it charges you for the privilege, and a dropped filter is exactly the kind that returns a full page. You paid for "remote senior roles in Germany" and received "every job on earth", 200 rows at a time, and nothing in the response said so. If the consumer of that number is a dashboard, a report, or a decision, the real cost isn't the request: it's everything built downstream on an answer to the wrong question, discovered much later, by someone else.

A 400 costs you no jobs at all and one sentence of reading. The trade is not close.

Silent drop (lenient)Strict 400 (this API)
Typo'd parameter nameInflated count, looks like a findingNamed in the body, fixed in a minute
Wrong enum valuecount: 0, looks like "nobody's hiring"The allowed list, in the hint
Unparseable time windowAll-time results, all plausibleThe format, with an example
What your quota boughtAn answer to a different questionAn error you can act on

The compatibility objection, answered

The honest defence of leniency was always vocabulary: the compatibility policy lets new enum values (new taxonomies, new source values) ship at any time, and a client-side validator that throws on an unheard-of value turns each addition into a breakage.

Strict server-side validation doesn't have that problem: it inverts it. The server validates against the vocabulary it executes, so a new taxonomy is valid the moment it exists, with no deploy coupling and no stale list anywhere. The advice that follows: don't maintain a validation table in your client. The server is the validator. Read vocabularies from /v1/vocabulary and the enums reference when you need to display them; let the 400 catch what's wrong. Your client stays tolerant of new values in responses (that part of the policy is unchanged) while the request side is checked by the one component that can't drift.

Matching is still exact. The difference is that seniority=Mid level, the label where the code mid belongs, is a correction delivered in the hint, not a zero delivered as a fact.

What can still be silently zero

Strictness covers closed vocabularies and formats. Three filters are open by design, and an open filter can't reject a value. It can only fail to match:

  • skill takes any word, so one nobody wrote is 0 rows. See skills & taxonomies.
  • source takes any string. source=Greenhouse is 0 rows: case-sensitive, and the vocabulary lives on /v1/meta, not in your memory.
  • q / organization are free text: a word search and a substring. A typo just matches nothing.

When one of those comes back suspiciously empty, /v1/jobs/count is the cheap way to test a filter set one change at a time.

Why values are codes, not labels

One trap validation can't see, because it happens before the server does. A filter value sent as a display name with a spaced ampersand (Finance & Accounting) breaks a hand-built URL: & is a query string separator, so the value ends at the ampersand, taxonomies arrives holding Finance , and the filters after the & vanish, with no way for a server to warn you about parameters it never received.

So every closed list here is a code (finance_accounting, art_design, data_analytics, customer_service_support), and no code carries an &:

BASH
curl -G https://api.hyperjobs.io/v1/jobs \
  -H "Authorization: Bearer $HYPERJOBS_KEY" \
  --data-urlencode "taxonomies=finance_accounting"

The display names are still there, as labels, for showing to a person, from /v1/vocabulary, never for sending back.

Strictness is a trust position

There's a reading of "never returns a 400" as generosity: the API that always tries its best with what you sent. Picture the documentation for that API: page after page of warnings explaining how to detect that your request had been quietly edited. An API that needs a debugging procedure for its own leniency is not being generous. It's outsourcing its parser to every client, one incident at a time.

The position here is simpler to state and simpler to trust: if you got a 200, every filter you sent was applied. A count means what it says. An empty result means nothing matched, not "nothing matched what survived". And when you're wrong, you find out from the API, immediately, with the fix in the body, not from a dashboard, three weeks later, with the fix in a postmortem.

The full error catalogue (the 402 for a spent quota beside the 429 for a spent minute) is in errors; every filter's exact semantics are in filtering.