USAJOBS API: how to search US federal jobs in code
USAJOBS, the US federal government's jobs site, publishes its open job announcements through a free Search API at data.usajobs.gov. It's the official source, it's free, and it needs a key.
Getting access
Request a key on the USAJOBS developer site. Every request then sends three headers:
| Header | Value |
|---|---|
Host |
data.usajobs.gov |
User-Agent |
the email address you used to request the key |
Authorization-Key |
your API key |
The limits
- 500 rows a page (
ResultsPerPage), and 10,000 rows a query. For anything bigger, split the search by location, agency, series orDatePosted. - Public jobs by default.
WhoMayApply=Publicis the default.AllandStatusneed extra authorisation from USAJOBS. DatePostedgoes up to 60 days. It's a whole number of days, 0 to 60.
Python: data scientist jobs posted this week
import os, requests
headers = {
"Host": "data.usajobs.gov",
"User-Agent": os.environ["USAJOBS_EMAIL"],
"Authorization-Key": os.environ["USAJOBS_API_KEY"],
}
params = {"Keyword": "data scientist", "DatePosted": 7, "ResultsPerPage": 500, "Page": 1}
jobs = []
while True:
r = requests.get("https://data.usajobs.gov/api/Search", headers=headers, params=params, timeout=30)
r.raise_for_status()
result = r.json()["SearchResult"]
jobs += [item["MatchedObjectDescriptor"] for item in result["SearchResultItems"]]
if params["Page"] >= int(result["UserArea"]["NumberOfPages"]):
break
params["Page"] += 1
for job in jobs[:5]:
pay = job["PositionRemuneration"][0]
print(job["PositionTitle"], "|", job["DepartmentName"], "|", pay["MinimumRange"], "to", pay["MaximumRange"], pay["Description"])
Where it trips people up
- Salary filters work in buckets.
RemunerationMinimumAmountmatches $25,000-wide salary buckets, not the exact figure, so check the pay range yourself if the number matters. - Pay isn't always yearly. Each
PositionRemunerationhas aRateIntervalCodesuch asPA(per year) orPH(per hour). Convert before you compare. - Codes, not words. Schedules, offering types and hiring paths come back as codes. The code list APIs (
/api/codelist/...) give their names and need no key. - Check the closing date.
ApplicationCloseDateis the last day applications are accepted. Link to the official job page (PositionURI) rather than copying the announcement.
We built this
Disclosure: Your Evenings Ltd built and sells this. It isn't operated, sponsored, approved or endorsed by OPM, USAJOBS or any federal agency. USAJOBS API (Unofficial): Federal Government Jobs on the Apify Store reads the official USAJOBS Search API with its own key, so you don't need one:
- Filters: keyword, job title, location and radius, remote or telework, agency, occupational series, GS grade, minimum yearly salary, schedule, appointment type, hiring path, posted date and closing window.
- Flat rows: pay range with a yearly figure for every standard pay interval, grades, closing date, hiring paths, codes turned into words, and the official job and apply links.
- Exact salary and closing filters, run in code before a row is delivered, so jobs your filters drop are never charged.
- Monitor mode: schedule it daily and it returns only jobs it hasn't returned before.
- Optional fields: full announcement text, and the agency contact email and phone from the USAJOBS feed, are opt-in and off by default.
Pricing: $0.002 per job, and $0.01 per monitor run that finds new jobs (base prices; higher Apify plans pay less). Status rows and jobs your filters drop are free.
FAQ
Do I need a key for the USAJOBS API?
Yes. Request one on developer.usajobs.gov and send it in the Authorization-Key header, with your email as the User-Agent.
How many results can the USAJOBS API return? Up to 500 a page and 10,000 a query.
Why do I see fewer jobs than on usajobs.gov? The API returns jobs open to the public by default. Announcements for current federal employees and other status candidates need extra authorisation.
Can I apply through the API? No. Each job has an official apply link. Apply on usajobs.gov using the instructions in the announcement.
Product names and logos belong to their owners. Your Evenings Ltd is not affiliated with or endorsed by them. Job data from the USAJOBS Search API. Your Evenings Ltd is not operated, sponsored, approved or endorsed by OPM, USAJOBS or any federal agency.
