# /repec/papers/search

`POST /api/repec/papers/search`

Price: 10 credits

Search the RePEc bibliography by free text, keywords, author name, JEL code, NEP subject report, record kind, software language and record age. Returns each record's RePEc handle, title, authors, the series or journal it appeared in, year, keywords, JEL codes and the dates it was created and last modified

## How to use it

This is the way to find a RePEc handle; pass the returned `id` to /repec/papers for the abstract, DOI and download links, which a search row does not carry. `logic` decides how several text fields combine: with the default `all_of` a record must match every field given, and `any_of` widens the result instead of narrowing it. `query` matches the whole record while `keywords` matches only the title and the author-supplied keywords, so a common word behaves very differently between them. `author` filters records by their author line, so the rows are records and never author profiles; a profile is reached through the `short_id` on a record from /repec/papers.

## 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 the whole record (title, abstract, keywords, authors, series) (examples: "inflation expectations", "minimum wage employment"; minLength: 1)
- `keywords` (string, nullable) — Text matched against the record's title and its author-supplied keywords only (examples: "inflation", "capital-skill complementarity"; minLength: 1)
- `author` (string, nullable) — Author name matched against the record's author line (examples: "Cecchetti", "Ben Bernanke"; minLength: 1)
- `jel_code` (string, nullable) — JEL classification code the record is filed under, such as E31 or C32 (examples: "E31", "J30"; minLength: 1)
- `nep_report` (string, nullable) — NEP subject report the record was circulated in, in either spelling: the hyphenated form /repec/papers returns in `nep_reports` (nep-mon) or the bare form (nepmon) (one of: "nepacc", "nepafr", "nepagr", "nepain", "nepban", "nepbig", "nepbec", "nephis", "nepcba", "neplam", "nepcwa", "nepcna", "nepcbe", "nepcdm", "nepcob", "nepcmp", "nepcis", "nepcta", "nepcfn", "nepcul", "nepdem", "nepdev", "nepdcm", "nepdge", "nepets", "nepecm", "nepdes", "nepgeo", "nepgro", "nepage", "nephap", "nepmig", "nepcse", "nepedu", "nepeff", "nepene", "nepent", "nepenv", "nepeec", "nepevo", "nepexp", "nepfdg", "nepfle", "nepfmk", "nepfor", "nepgth", "nepgen", "nepger", "nephea", "nephme", "nephpe", "nephre", "nephrm", "nepcom", "nepind", "nepiue", "nepict", "nepino", "nepias", "nepipr", "nepiaf", "nepifn", "nepint", "nepinv", "nepisf", "nepknm", "neplma", "neplab", "neplaw", "nepara", "nepmac", "nepmst", "nepmkt", "nepeur", "nepmic", "nepmfd", "nepmin", "nepmid", "nepmon", "nepnet", "nepneu", "nepnud", "nepopm", "nepore", "neppay", "neppol", "neppke", "neppbc", "nepppm", "neppbe", "neppub", "nepreg", "nepres", "neprmg", "nepsbm", "nepsoc", "nepsog", "nepsea", "nepspo", "neptid", "neptur", "neptra", "neptre", "nepltv", "nepuep", "nepure", "nepupt"; examples: "nep-mon", "nepmon")
- `item_types` (array, nullable) — Kinds of record to search. All four kinds are searched when this is left out (one of: "working_paper", "journal_article", "book_or_chapter", "software_component")
- `software_language` (string, nullable) — Programming language of a software component (one of: "C/C++", "Executable", "Fortran", "Gauss", "Mathematica", "Matlab/Octave", "Ox", "Perl", "Python", "Rats", "Shazam", "Stata")
- `age` (string, nullable) — Keep only records no older than this window (one of: "1 day", "2 days", "3 days", "4 days", "5 days", "6 days", "1 week", "2 weeks", "3 weeks", "4 weeks", "3 months", "6 months", "1 year", "2 years", "3 years", "4 years", "5 years", "10 years", "20 years")
- `age_basis` (string) — Which date `age` counts from: the record's own publication date, or the day RePEc added it (default: "added"; one of: "published", "added")
- `online_only` (boolean) — Keep only records whose full text is available online (default: false)
- `logic` (string) — Whether a record must match every text field given, or any one of them (default: "all_of"; one of: "all_of", "any_of")
- `sort` (string) — Order of the results: by match quality, by the record's date, or by title (default: "relevance"; one of: "relevance", "date", "alphabetical")
- `count` (integer, required) — Max number of results (examples: 100; min: 1; max: 10000)

## Response

### 200 — Successful Response

- `@type` (string) (default: "RepecItemCard")
- `id` (string, nullable)
- `url` (string, required)
- `record_title` (string, required)
- `item_type` (string, nullable)
- `authors` (array) (default: [])
- `source_name` (string, nullable)
- `series_id` (string, nullable)
- `number` (string, nullable)
- `year` (integer, nullable)
- `keywords` (array) (default: [])
- `jel_codes` (array) (default: [])
- `created_date` (string, nullable)
- `modified_date` (string, nullable)
- `citation_count` (integer, nullable)
- `has_downloads` (boolean, nullable)
- `related_works` (array) (default: [])
  - `@type` (string) (default: "RepecRelatedWork")
  - `id` (string, nullable)
  - `record_title` (string, required)
  - `url` (string, required)
  - `kind` (string, nullable)
  - `relation` (string, nullable)
  - `source_name` (string, nullable)
  - `year` (integer, nullable)
  - `citation_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.

