# /usajobs/jobs/facets

`POST /api/usajobs/jobs/facets`

Price: 1 credit

Get aggregated counts of open US federal job announcements broken down by agency, department, occupational series, hiring path, appointment type, work schedule, travel, security clearance, supervisory status, telework, remote and relocation. Accepts the same filters as the USAJOBS job search endpoint, so the aggregation is always computed over the matching subset of announcements.

## How to use it

Aggregate the US federal job market instead of listing individual jobs — use this to answer questions like 'which agencies hire the most IT specialists' or 'how many federal jobs are remote'. Takes the same filters as the USAJOBS job search endpoint (keyword, location, hiring_path, job_series, department, agency, salary, clearance and so on) and returns one group per facet: agency, department, job_series, hiring_path, appointment_type, work_schedule, travel, security_clearance, supervisory, telework, remote, relocation. Each group holds codes with their job_count. Codes for agency, department and job_series can be resolved to names with the USAJOBS agencies endpoint; other groups carry the readable name inline.

## Parameters

- `access-token` (string, required)

## Request body

- `timeout` (integer) — Max scrapping execution timeout (in seconds) (default: 300; min: 20; max: 1500)
- `keyword` (string, nullable) — Job title, occupation or keyword to search for (examples: "engineer")
- `location` (string, nullable) — City, state, ZIP code or country to search in (examples: "New York, New York")
- `radius` (string, nullable) — Search radius in miles around the location (one of: "5", "10", "25", "50", "100")
- `job_title` (array, nullable) — Restrict results to these exact job titles
- `min_salary` (integer, nullable) — Minimum yearly salary in USD (min: 0)
- `max_salary` (integer, nullable) — Maximum yearly salary in USD (min: 0)
- `pay_plan` (array, nullable) — Federal pay plan codes the position is paid under (examples: ["GS","FV"])
- `hiring_path` (array, nullable) — Who is eligible to apply (multi-select) (one of: "public", "fed-competitive", "fed-excepted", "fed-internal-search", "fed-transition", "land", "vet", "mspouse", "nguard", "student", "graduates", "ses", "disability", "overseas", "native", "peace", "special-authorities")
- `appointment_type` (array, nullable) — Type of appointment offered (multi-select) (one of: "15320", "15522", "15328", "15327", "15317", "15326", "15322", "15323", "15318", "15321", "15319")
- `is_supervisory` (boolean, nullable) — Only supervisory positions
- `work_schedule` (array, nullable) — Work schedule of the position (multi-select) (one of: "1", "2", "3", "4", "5", "6")
- `travel_percentage` (array, nullable) — How much travel is required (multi-select) (one of: "0", "1", "2", "5", "7", "8")
- `security_clearance` (array, nullable) — Required security clearance level (multi-select) (one of: "0", "1", "2", "3", "4", "5", "7", "8")
- `job_series` (array, nullable) — Four-digit federal occupational series codes (examples: ["0801","2210"])
- `cyber_work_role` (array, nullable) — Cyber workforce role codes (examples: ["422"])
- `cyber_work_grouping` (array, nullable) — Cyber workforce grouping codes (examples: ["1"])
- `department` (array, nullable) — Department codes to filter by (examples: ["VA","AR"])
- `agency` (array, nullable) — Agency codes to filter by (examples: ["VATA","ARCE"])
- `exclude_organizations` (boolean) — Exclude the given departments and agencies instead of restricting to them (default: false)
- `work_site` (string, nullable) — Restrict to remote or telework-eligible jobs (one of: "remote", "telework")
- `sort_by` (string) — Ordering of the results (default: "relevance"; one of: "relevance", "recently_posted", "closing_soon", "highest_salary", "lowest_salary")

## Response

### 200 — Successful Response

- `@type` (string) (default: "UsajobsJobFacetGroup")
- `name` (string, required)
- `code` (string, required)
- `values` (array) (default: [])
  - `@type` (string) (default: "UsajobsJobFacetValue")
  - `code` (string, required)
  - `name` (string, nullable)
  - `job_count` (integer, nullable)

## Errors

### 422 — Validation Error

The request body did not validate

What to do: Check the fields against this schema. A URN with the wrong prefix is the most common cause.

- `detail` (array)
  - `loc` (array, required)
  - `msg` (string, required)
  - `type` (string, required)
  - `input` (any)
  - `ctx` (object)

### 408

The request ran past its time limit

What to do: Raise `timeout` in the request body, up to the maximum this endpoint documents. Lowering `count` or turning off the `with_*` flags also helps, because less work finishes sooner.

### 412

The entity was not found, or a precondition failed

What to do: Retrying will not help: either the entity does not exist, or the input points at a different one.

### 429

Too many requests: a rate limit or a usage window is exhausted

What to do: When the response carries an X-Retry-After header, wait that many seconds and retry: the same number is in the body as `detail.retry_after`, and the limit clears once that window passes. The message in the body names the limit that was hit.

### 500

Something broke on our side

What to do: Retrying will not help. If it keeps happening, send us the X-Request-ID from the response headers.

### 529

Rate limit reached, or the endpoint is overloaded

What to do: Wait at least 30 seconds, then retry.

## Response envelope

Success: Array of objects (may be empty if no results)

Error: Error may coexist with partial results if it occurs mid-execution. Check X-Error header and status code.

Every response carries these headers:

- `X-Error` — Error message text (present only on error)
- `X-Request-ID` — Unique request identifier
- `X-Execution-Time` — Execution time in seconds
- `X-Result-Count` — How many records the body carries. 0 means an empty result, which is a normal answer and not by itself an error. A non-zero count can come back together with X-Error when the failure happened partway through — read this header and X-Error independently.
- `X-Total-Available-Results` — How many records exist for this query, when the endpoint can say. On a `dry_run` request this is the answer and the body is empty. It saturates: the endpoint's documented maximum means 'at least that many', any smaller number is exact.
- `X-Warning` — Present when the request body carried keys this endpoint does not document. They were ignored, so any filter you meant to apply through them did not apply. Check the spelling against this schema and retry.
- `X-Retry-After` — Seconds to wait before retrying. Present only on 429.

