{"openapi":"3.0.1","info":{"title":"Arquivo.pt Full-text Search API","description":"Full-text search over the web pages and documents preserved by [Arquivo.pt](https://arquivo.pt), the Portuguese\nweb archive, from 1996 onwards.\n\nEach result is an archived capture of a page or document (HTML, PDF, Office documents, ...): its title, a snippet of\nthe text matching the query, when it was captured, and links to replay it, see its screenshot, read its extracted text\nand download the original file.\n\n## Searching\n\nSearch with `GET /textsearch?q=<terms>`:\n\n- Every term must match, so adding terms narrows the results.\n- Terms within double quotes match as an exact phrase, e.g. `q=\"António Costa\"`.\n- A leading `-` excludes the pages containing a term, e.g. `q=Albert -Einstein`.\n- `q` takes words, not addresses: a URL in `q` is rejected with `400 Bad Request`. To list the captures of a URL use\n  `versionHistory`, or the [CDX server](https://arquivo.pt/cdxserverapi) and [Memento](https://arquivo.pt/memento)\n  APIs.\n\nThe results can be narrowed down by capture date (`from`, `to`), site (`siteSearch`), document type (`type`),\ncollection (`collection`), exact title (`titleSearch`) and detected language (`language`, `minLanguageConfidence`).\nA site matches that host only, e.g. `siteSearch=sapo.pt`. Prefix it with `*.` to also match its subdomains, e.g.\n`siteSearch=*.sapo.pt`.\n\n## Results\n\n- **Pagination**: `maxItems` results are returned per page (50 by default, at most 500), starting at `offset`.\n  `next_page` and `previous_page` link to the neighbouring pages. `estimated_nr_results` is an approximate count of\n  the matching pages.\n- **Deduplication**: pages are grouped by `dedupField` (the title, or the URL when searching within a site) and only\n  the newest `dedupValue` results of each group are returned. `dedupValue=-1` turns deduplication off.\n- **Fields**: `fields` restricts each result to the listed fields. Listing `spellcheck` also asks for a spelling\n  correction of the query, replied in `suggested_query` (empty when the query looks well spelled).\n- **Timeline**: `timeline=true` adds the number of matching pages per year, and the share of each year's archived\n  pages they make up.\n- **Ranking**: `yearBalance` lifts the pages of the years the archive holds the least of, which would otherwise be\n  outranked by the better covered years.\n\nResponses are JSON (`prettyPrint=true` indents them) and can be requested cross-origin from a browser.\n","license":{"name":"GPL-3.0","url":"https://github.com/arquivo/page-search-api/blob/master/LICENSE"},"version":"1.0"},"externalDocs":{"description":"Arquivo.pt API documentation","url":"https://arquivo.pt/api"},"servers":[{"url":"/"}],"tags":[{"name":"PageSearch","description":"Endpoints to search for Archived WebPages content"},{"name":"Metadata","description":"(Not Published) Endpoints to retrieve metadata information about an Archived Web Resource"},{"name":"HealthCheck","description":"Endpoints to check the connectivity of this service's dependencies"}],"paths":{"/textsearch":{"get":{"tags":["PageSearch"],"summary":"Search for Archived Pages that match the query parameters","description":"Full-text search over the archived pages, with q. Every term must match, terms within double quotes match as an exact phrase and a leading - excludes the pages containing a term. Instead of q, versionHistory lists the captures of a URL and metadata returns the metadata of a single capture. One of q, versionHistory or metadata is required.","operationId":"pageSearch","parameters":[{"name":"q","in":"query","description":"Search terms, e.g. q=\"António Costa\" or q=Albert -Einstein. URLs aren't accepted here, they're rejected with 400 Bad Request: use versionHistory, or the CDX server and Memento APIs, to search by URL.","required":false,"schema":{"type":"string"}},{"name":"versionHistory","in":"query","description":"URL whose captures should be listed, newest first, instead of searching by q. Can be bounded by from/to and paginated with offset/maxItems.","required":false,"schema":{"type":"string"}},{"name":"metadata","in":"query","description":"Capture whose metadata should be returned, instead of searching by q, as <URL>/<timestamp>, e.g. http://www.fccn.pt/20010610000000.","required":false,"schema":{"type":"string"}},{"name":"offset","in":"query","description":"Number of results to skip, to paginate through them.","required":false,"schema":{"type":"integer","format":"int32","default":0}},{"name":"maxItems","in":"query","description":"Number of results per page, at most 500 when searching by q.","required":false,"schema":{"type":"integer","format":"int32","default":50}},{"name":"titleMaxLength","in":"query","description":"Maximum number of characters returned in the title field. Titles longer than this are cut short and suffixed with an ellipsis (…). 0 disables truncation. Defaults to 300.","required":false,"schema":{"type":"integer","format":"int32"}},{"name":"snippetMaxLength","in":"query","description":"Maximum number of characters returned in the snippet field. Snippets longer than this are cut short. 0 disables truncation. Defaults to 300.","required":false,"schema":{"type":"integer","format":"int32"}},{"name":"siteSearch","in":"query","description":"Only return pages from these sites, as a comma separated list (a page from any of them is returned). A host matches that host only, not its subdomains: sapo.pt returns pages from sapo.pt but not from blogs.sapo.pt. Prefix a host with *. to also match all of its subdomains: *.sapo.pt returns pages from sapo.pt and from any subdomain of it. The * wildcard is only supported as a *. prefix of a host. A URL with a path matches every page whose URL starts with it, e.g. sapo.pt/noticias. The protocol and a leading www. are ignored, so http://www.sapo.pt, https://sapo.pt and sapo.pt are the same site.","required":false,"schema":{"type":"array","items":{"type":"string"}},"example":"publico.pt,*.sapo.pt"},{"name":"dedupField","in":"query","description":"Field results are deduplicated by, keeping only the newest per distinct value. title (the default) collapses on the exact title. collection collapses on the collection. type collapses on the mimetype. url collapses on the exact URL, so two pages are only deduplicated if they are the very same URL, not just the same site. site is meant to collapse per site/domain instead, but currently behaves exactly like url (see https://github.com/arquivo/pwa-technologies/issues/1619). Any other or missing value falls back to title.","required":false,"schema":{"type":"string","enum":["title","collection","type","url","site"]}},{"name":"dedupValue","in":"query","description":"Number of results returned per distinct dedupField value, the newest ones. 0 and 1 both return one result per value. -1 turns deduplication off.","required":false,"schema":{"type":"integer","format":"int32","default":2}},{"name":"from","in":"query","description":"Only return pages captured on or after this date (a timestamp, or a prefix of one, e.g. 2000 or 20000101). A prefix is read as the start of the period it names, e.g. 2000 is 20000101000000. Matched against a page's most recent capture, so a page first captured before this date can still be returned if it was captured again on or after it.","required":false,"schema":{"type":"string"}},{"name":"to","in":"query","description":"Only return pages captured on or before this date (a timestamp, or a prefix of one, e.g. 2025 or 20251231). A prefix is read as the end of the period it names, so the whole period is included, e.g. 2025 is up to 20251231235959 and 202502 up to 20250228235959. Matched against a page's oldest capture, so a page also captured after this date can still be returned if it was first captured on or before it.","required":false,"schema":{"type":"string"}},{"name":"type","in":"query","description":"Only return documents of these types, as a comma separated list (a document of any of them is returned). Case insensitive. pdf, doc/docx, xls/xlsx, ppt/pptx, ps/ai/eps, htm/html and rtf match the mimetypes of those formats (e.g. doc matches both Word formats). A value with a / is matched as an exact mimetype, e.g. application/pdf. Any other value matches every mimetype containing it, e.g. opendocument.","required":false,"schema":{"type":"array","items":{"type":"string"}},"example":"pdf,doc"},{"name":"collection","in":"query","description":"Restrict results to one or more collections. Accepts a trailing wildcard to match every collection sharing a prefix, e.g. FAWP* matches FAWP1, FAWP2, ..., FAWP34. Multiple collections/patterns can be comma-separated, e.g. FAWP*,MAWP*.","required":false,"schema":{"type":"array","items":{"type":"string"}}},{"name":"fields","in":"query","description":"Restrict the response to only these fields per result. Omit to return majority of fields. spellcheck isn't a result field: it asks for a spelling correction of the query, replied in suggested_query (empty when the query looks well spelled), e.g. fields=title,spellcheck. On its own, fields=spellcheck keeps the default result fields.","required":false,"schema":{"type":"array","items":{"type":"string","enum":["title","originalURL","linkToArchive","tstamp","contentLength","digest","mimeType","encoding","date","linkToScreenshot","linkToNoFrame","linkToExtractedText","linkToMetadata","linkToOriginalFile","snippet","fileName","collection","offset","statusCode","id","language","languageConfidence","spellcheck"]}}},{"name":"prettyPrint","in":"query","description":"When true, indent the JSON response to make it easier to read.","required":false,"schema":{"type":"boolean"}},{"name":"titleSearch","in":"query","description":"Only return pages whose title is exactly this one, e.g. titleSearch=Público.","required":false,"schema":{"type":"string"}},{"name":"timeline","in":"query","description":"When true, also return a timeline with the distribution of results per year.","required":false,"schema":{"type":"boolean","default":false}},{"name":"yearBalance","in":"query","description":"Lift the ranking of documents from the years the archive holds the least of. Takes true (default strength), false (no effect, the default), or a strength between 0.0 and 1.0.","required":false,"schema":{"type":"string"}},{"name":"language","in":"query","description":"Only return pages detected as being written in this language, e.g. pt","required":false,"schema":{"type":"string"}},{"name":"minLanguageConfidence","in":"query","description":"Lowest language detection confidence the results may have: HIGH (default), MEDIUM or LOW. The tiers are ordinal, so MEDIUM also includes the HIGH results and LOW includes every result. Only applies when filtering by language, unless explicitly requested.","required":false,"schema":{"type":"string","enum":["HIGH","MEDIUM","LOW"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PageSearchResponse"},{"$ref":"#/components/schemas/MetadataResponse"}]}}}}}}},"/textsearch/healthcheck":{"get":{"tags":["HealthCheck"],"summary":"Check connectivity to the configured Solr instance","operationId":"healthcheck","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"object"}}}}}}},"/textextracted":{"get":{"tags":["PageSearch"],"summary":"Get the extracted text of an Archived Page","operationId":"extractedText","parameters":[{"name":"m","in":"query","description":"Capture whose extracted text should be returned, as <URL>/<timestamp>, e.g. http://www.fccn.pt/20010610000000.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"string"}}}}}}},"/metadata":{"get":{"tags":["Metadata"],"summary":"Get the metadata information about an archived page","operationId":"getMetadata","parameters":[{"name":"id","in":"query","description":"Capture whose metadata should be returned, as <URL>/<timestamp>, e.g. http://www.fccn.pt/20010610000000.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/MetadataResponse"}}}}}}}},"components":{"schemas":{"PageSearchResponse":{"type":"object","properties":{"serviceName":{"type":"string","description":"Name of the service, e.g. Arquivo.pt - the Portuguese web-archive."},"linkToService":{"type":"string","description":"Base URL of the service, which next_page, previous_page and the links of each result start with."},"next_page":{"type":"string","description":"URL of the next page of results, with offset moved forward by maxItems. Left out on the last page."},"previous_page":{"type":"string","description":"URL of the previous page of results, with offset moved back by maxItems. Left out on the first page."},"estimated_nr_results":{"type":"integer","description":"Approximate number of matching results across every page. When searching by q it is estimated before deduplication, so it can be well above the number of results that can be paged through.","format":"int64"},"request_parameters":{"$ref":"#/components/schemas/SearchQuery"},"suggested_query":{"type":"string","description":"Spelling correction of q. Only replied when fields includes spellcheck, empty when the query looks well spelled."},"response_items":{"type":"array","description":"The results of this page, restricted to the requested fields.","items":{"$ref":"#/components/schemas/SearchResult"}},"timeline":{"$ref":"#/components/schemas/Timeline"}}},"SearchQuery":{"type":"object","properties":{"offset":{"type":"integer","format":"int32"},"titleMaxLength":{"type":"integer","format":"int32"},"snippetMaxLength":{"type":"integer","format":"int32"},"dedupValue":{"type":"integer","format":"int32"},"from":{"type":"string"},"to":{"type":"string"},"type":{"type":"array","items":{"type":"string"}},"collection":{"type":"array","items":{"type":"string"}},"fields":{"type":"array","items":{"type":"string"}},"dedupField":{"type":"string"},"language":{"type":"string"},"minLanguageConfidence":{"type":"string"},"q":{"type":"string"},"maxItems":{"type":"integer","format":"int32"},"siteSearch":{"type":"array","items":{"type":"string"}},"titleSearch":{"type":"string"},"timeline":{"type":"boolean"},"yearBalance":{"type":"number","format":"double"}},"description":"The parameters the search ran with, after defaults and limits were applied, named as the query parameters. Only replied when searching by q."},"SearchResult":{"type":"object","properties":{"title":{"type":"string","description":"Title of the page, cut to titleMaxLength. When listing captures with versionHistory it is the URL instead."},"originalURL":{"type":"string","description":"URL the capture was archived from."},"linkToArchive":{"type":"string","description":"Link to replay the capture in Arquivo.pt."},"tstamp":{"type":"string","description":"When the capture was made, in UTC, as yyyyMMddHHmmss, e.g. 20010610000000. Not when the page was published."},"contentLength":{"type":"integer","description":"Size of the capture in bytes, as stored in the archive.","format":"int64"},"digest":{"type":"string","description":"Digest of the content. When searching by q it is an MD5 of the page's text and title, the same as id. In versionHistory and metadata it is the digest of the archived payload, from the CDX index."},"mimeType":{"type":"string","description":"MIME type of the capture, e.g. text/html or application/pdf."},"encoding":{"type":"string","description":"Never replied, kept as an accepted value of fields for compatibility.","deprecated":true},"date":{"type":"string","description":"Never replied, kept as an accepted value of fields for compatibility. Use tstamp.","deprecated":true},"linkToScreenshot":{"type":"string","description":"Link to a screenshot of the capture."},"linkToNoFrame":{"type":"string","description":"Link to replay the capture without the Arquivo.pt frame around it."},"linkToExtractedText":{"type":"string","description":"Link to the text extracted from the capture, see /textextracted."},"linkToMetadata":{"type":"string","description":"Link to the metadata of the capture, see the metadata parameter."},"linkToOriginalFile":{"type":"string","description":"Link to the capture as it was archived, without any replay rewriting."},"snippet":{"type":"string","description":"Excerpt of the page's text around the query terms, which are wrapped in <em> tags. Cut to snippetMaxLength. Only replied when searching by q."},"fileName":{"type":"string","description":"Name of the WARC/ARC file holding the capture. Only replied by metadata."},"collection":{"type":"string","description":"Collection the capture belongs to, e.g. FAWP34."},"offset":{"type":"integer","description":"Byte offset of the capture within fileName. Only replied by metadata.","format":"int64"},"statusCode":{"type":"integer","description":"HTTP status code the capture was archived with. Only replied by versionHistory and metadata.","format":"int32"},"id":{"type":"string","description":"Identifier of the result, an MD5 of the page's text and title. Only replied when searching by q, and by default only when the service is configured to show it."},"language":{"type":"string","description":"Language detected in the page's text, e.g. pt. Left out when none was detected. Only replied when searching by q with language listed in fields."},"languageConfidence":{"type":"string","description":"How confident the language detection is. NONE is the least confident, the tier that minLanguageConfidence=LOW adds. Only replied when searching by q with languageConfidence listed in fields.","enum":["HIGH","MEDIUM","NONE"]}},"description":"An archived page or document. When searching by q, a result groups the captures with the same content and its URL, timestamp and links are those of the oldest capture that matches the query filters."},"Timeline":{"type":"object","properties":{"counts":{"type":"object","additionalProperties":{"type":"integer","description":"Number of matching documents per year, e.g. {\"2005\": 1200}. Years without matches are kept with a count of 0. When the query is bounded by from/to, years outside that range are also kept at 0: from/to match a page by its most recent/oldest capture rather than the one this count is bucketed by, so without this a year just outside the requested range could otherwise show a small, non representative count.","format":"int64"},"description":"Number of matching documents per year, e.g. {\"2005\": 1200}. Years without matches are kept with a count of 0. When the query is bounded by from/to, years outside that range are also kept at 0: from/to match a page by its most recent/oldest capture rather than the one this count is bucketed by, so without this a year just outside the requested range could otherwise show a small, non representative count."},"impact":{"type":"object","additionalProperties":{"type":"number","description":"Share of that year's archived documents that match the query, e.g. {\"2005\": 0.012}. Follows the same from/to zeroing as counts: years outside the requested range are always 0 here, even though the underlying search may still include some documents originating outside that range."},"description":"Share of that year's archived documents that match the query, e.g. {\"2005\": 0.012}. Follows the same from/to zeroing as counts: years outside the requested range are always 0 here, even though the underlying search may still include some documents originating outside that range."}},"description":"Yearly breakdown of the matching documents. Only replied when searching by q with timeline=true."},"MetadataResponse":{"type":"object","properties":{"serviceName":{"type":"string","description":"Name of the service, e.g. Arquivo.pt - the Portuguese web-archive."},"linkToService":{"type":"string","description":"Base URL of the service, which the links of each result start with."},"response_items":{"type":"array","description":"The requested capture: empty when it isn't archived, null when id isn't a valid <URL>/<timestamp>.","items":{"$ref":"#/components/schemas/SearchResult"}}}}}}}