# /nber/papers/search

`POST /api/nber/papers/search`

Price: 5 credits

Search NBER working papers by free text, topic, research program, working group, project, author and issue date. Returns each record's node id, URL, title, authors, display date and abstract. Set `content_type` to search NBER's books, chapters, journal articles, conferences, projects, videos and datasets instead

## How to use it

A search row carries no topics, programs, DOI or PDF link — take `alias` from a working-paper row and pass it to /nber/papers for those. `topic`, `program`, `working_group`, `project` and `author` match NBER's own spelling exactly and a near miss returns nothing rather than an error, so take these values from a record NBER itself returned: `programs[].name` on a paper, or the name of a program from /nber/programs. `start_date` and `end_date` filter the issue date and only work as a pair. There are no JEL codes anywhere in NBER's catalogue.

## Parameters

- `access-token` (string, required)

## Request body

- `timeout` (integer) — Max scrapping execution timeout (in seconds) (default: 300; min: 20; max: 1500)
- `query` (string, nullable) — Free text matched against titles, abstracts and author names (examples: "inflation expectations", "minimum wage"; minLength: 1)
- `content_type` (string) — Kind of NBER content to search (default: "working_paper"; one of: "working_paper", "chapter", "article", "book", "conference", "project", "video", "center_paper", "page", "dataset", "program")
- `topic` (string, nullable) — NBER topic the record is filed under, spelled exactly as NBER writes it (examples: "Macroeconomics", "Labor Economics"; minLength: 1)
- `program` (string, nullable) — NBER research program the record belongs to, spelled exactly as NBER writes it (examples: "Monetary Economics", "Public Economics"; minLength: 1)
- `working_group` (string, nullable) — NBER working group the record belongs to, spelled exactly as NBER writes it (examples: "Behavioral Finance", "Market Design"; minLength: 1)
- `project` (string, nullable) — NBER project or centre the record belongs to, spelled exactly as NBER writes it (examples: "Conference on Research in Income and Wealth"; minLength: 1)
- `author` (string, nullable) — Author or editor, spelled exactly as NBER writes the name on its own pages (examples: "Michael D. Bordo", "Stephen G. Cecchetti"; minLength: 1)
- `publication_type` (string, nullable) — NBER publication the record appeared in (one of: "Reporter", "Digest", "News", "BAH", "BRD", "BH", "BE")
- `start_date` (string, nullable) — Keep only records issued on or after this date, as YYYY-MM-DD. Must be given together with end_date (examples: "2020-01-01"; minLength: 1)
- `end_date` (string, nullable) — Keep only records issued on or before this date, as YYYY-MM-DD. Must be given together with start_date (examples: "2020-12-31"; minLength: 1)
- `sort_by` (string) — Order of the results (default: "relevance"; one of: "relevance", "date", "public_date")
- `count` (integer, required) — Max number of results (examples: 100; min: 1; max: 5000)

## Response

### 200 — Successful Response

- `@type` (string) (default: "NberSearchResult")
- `id` (string, required)
- `url` (string, required)
- `alias` (string, nullable)
- `record_title` (string, required)
- `content_type` (string, required)
- `content_type_name` (string, nullable)
- `display_date` (string, nullable)
- `authors` (array) (default: [])
  - `@type` (string) (default: "NberPersonRef")
  - `name` (string, required)
  - `alias` (string, nullable)
  - `profile_url` (string, nullable)
- `editors` (array) (default: [])
  - `@type` (string) (default: "NberPersonRef")
  - `name` (string, required)
  - `alias` (string, nullable)
  - `profile_url` (string, nullable)
- `presenters` (array) (default: [])
  - `@type` (string) (default: "NberPersonRef")
  - `name` (string, required)
  - `alias` (string, nullable)
  - `profile_url` (string, nullable)
- `abstract` (string, nullable)
- `quote` (string, nullable)
- `image` (string, nullable)
- `publication_type_name` (string, nullable)
- `issue_print_url` (string, nullable)
- `conference_type_name` (string, nullable)
- `producer_label` (string, nullable)
- `job_title` (string, nullable)
- `university_affiliation` (string, nullable)
- `back_office_id` (string, nullable)
- `source_title` (string, nullable)
- `source_url` (string, nullable)
- `summer_institute_title` (string, nullable)
- `summer_institute_url` (string, nullable)
- `video_image` (string, nullable)
- `video_type_name` (string, nullable)
- `programs` (array) (default: [])
  - `@type` (string) (default: "NberTermRef")
  - `name` (string, required)
  - `alias` (string, nullable)
  - `url` (string, nullable)
- `projects` (array) (default: [])
  - `@type` (string) (default: "NberTermRef")
  - `name` (string, required)
  - `alias` (string, nullable)
  - `url` (string, nullable)
- `related_papers` (array) (default: [])
  - `@type` (string) (default: "NberPaperRef")
  - `id` (string, required)
  - `alias` (string, nullable)
  - `url` (string, nullable)
- `is_conference_announced` (boolean, nullable)
- `is_certified_random` (boolean, nullable)
- `is_new_this_week` (boolean, 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.

