{"openapi":"3.1.0","info":{"title":"Web Search","version":"1.0.0"},"paths":{"/v1/search":{"post":{"operationId":"searchPost","summary":"Returns a list of unified search results from web and news sources","description":"The You.com Web Search API allows you and your agent to programamtically search the web, retrieve webpage metadata,  and fetch page content of the results from a single call.\n\n\nWrite your queries in natural language and tune the results with filters like `freshness`, `country` and domain allow/blocklists. See all controls below.\n\n[`knowledge`](/docs/api-reference/search/v1-search#request.body.knowledge) draws on hundreds of licensed and public sources to find answers to specific kinds of questions that can’t be answered on typical public web data alone. No additional cost.\n\n[`extraction`](/docs/api-reference/search/v1-search#request.body.extraction) allows you to retrieve page content via two `extraction_mode`s: `highlights`, which are a set of query relevant passages from a search result (returned by default at no additional cost), and `full_page`, which is full webpage content as Markdown and/or HTML.\n\n<Note> If you are still using `GET /v1/search`: it is active, but not being developed. Please migrate to `POST v1/search`.  New features will be added to `POST` - `extraction` and `knowledge` are only available here. </Note>","responses":{"200":{"description":"A JSON object containing unified search results from web and news sources","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchPostResponse"}}}},"401":{"description":"Unauthorized. Problems with API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchPostRequestUnauthorizedError"}}}},"402":{"description":"Payment Required. The account cannot make paid API requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpgradeRequiredResponse"}}}},"403":{"description":"Forbidden. API key lacks scope for this path.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchPostRequestForbiddenError"}}}},"422":{"description":"Unprocessable Entity. Invalid request parameter combination.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchPostRequestUnprocessableEntityError"}}}},"500":{"description":"Internal Server Error during authentication/authorization middleware.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchPostRequestInternalServerError"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchRequestBody"}}}},"security":[{"ApiKeyAuth":[]}]}}},"servers":[{"url":"https://ydc-index.io","description":"Production"}],"components":{"schemas":{"SearchQuery":{"type":"string","description":"The query used to retrieve relevant results from the web. You can include [search operators](https://you.com/docs/guides/search/search-operators) to refine your search.","title":"SearchQuery"},"Count":{"type":"integer","minimum":1,"maximum":100,"default":10,"description":"Specifies the maximum number of search results to return. The value must be from 1 to 100. When using `\"extraction_mode\": \"highlights\"`, `count` is limited to 50 results.","title":"Count"},"Knowledge":{"type":"string","enum":["core"],"description":"Enables search over an index of hundreds of licensed and public results in addition to the standard web search, at no additional cost.\n\n[Learn about knowledge](/docs/guides/search/knowledge).","title":"Knowledge"},"ExtractionExtractionMode":{"type":"string","enum":["highlights","full_page"],"description":"Specifies which kind of extraction to run.\n\n`highlights` returns the passages of each page that address your query in `contents.highlights`, sized for token-sensitive agent workflows. Pass the optional `highlights` object to cap the number of total highlight tokens.\n\n`full_page` crawls each result and returns the page content. Pass the optional `full_page` object to override its defaults.","title":"ExtractionExtractionMode"},"ExtractionExtractionSource":{"type":"string","enum":["blend","cache","fetch"],"default":"blend","description":"Indicates where `full_page` content comes from. Valid only with `extraction_mode: \"full_page\"`. Sending `extraction_source` with `extraction_mode: \"highlights\"` returns `422` (`extraction_source is not supported with extraction_mode highlights`).\n\n`blend` serves cached content when it is available and crawls the page live when it is not. This is the default.\n\n`cache` returns cached content only. It is the fastest option, and `contents` is omitted for results that have no cached content.\n\n`fetch` always crawls the page live, which returns the freshest content at the cost of higher latency.","title":"ExtractionExtractionSource"},"HighlightsConfig":{"type":"object","properties":{"total_max_tokens":{"type":"integer","minimum":1024,"maximum":8192,"description":"Approximate maximum number of tokens returned for `highlights` across a shared pool. Must be between 1024 and 8192. Default's to 8192.\n\nFor example, given `total_max_tokens = 5000`, if `count` is `10`, you'll get ~500 tokens of highlights per search result, and if `count` is `5`, you'll get ~1000 tokens of highlights per search result."}},"description":"Tuning for `extraction_mode: \"highlights\"`.","title":"HighlightsConfig"},"FullPageConfigExtractionFormatsItems":{"type":"string","enum":["html","markdown"],"title":"FullPageConfigExtractionFormatsItems"},"FullPageConfig":{"type":"object","properties":{"extraction_formats":{"type":"array","items":{"$ref":"#/components/schemas/FullPageConfigExtractionFormatsItems"},"default":["markdown"],"description":"Content formats to return, one or both of `markdown` and `html`."}},"description":"Configures `extraction_mode: \"full_page\"`.","title":"FullPageConfig"},"Extraction":{"type":"object","properties":{"extraction_mode":{"$ref":"#/components/schemas/ExtractionExtractionMode","description":"Specifies which kind of extraction to run.\n\n`highlights` returns the passages of each page that address your query in `contents.highlights`, sized for token-sensitive agent workflows. Pass the optional `highlights` object to cap the number of total highlight tokens.\n\n`full_page` crawls each result and returns the page content. Pass the optional `full_page` object to override its defaults."},"extraction_source":{"$ref":"#/components/schemas/ExtractionExtractionSource","default":"blend","description":"Indicates where `full_page` content comes from. Valid only with `extraction_mode: \"full_page\"`. Sending `extraction_source` with `extraction_mode: \"highlights\"` returns `422` (`extraction_source is not supported with extraction_mode highlights`).\n\n`blend` serves cached content when it is available and crawls the page live when it is not. This is the default.\n\n`cache` returns cached content only. It is the fastest option, and `contents` is omitted for results that have no cached content.\n\n`fetch` always crawls the page live, which returns the freshest content at the cost of higher latency."},"highlights":{"$ref":"#/components/schemas/HighlightsConfig"},"full_page":{"$ref":"#/components/schemas/FullPageConfig"}},"required":["extraction_mode"],"description":"Specifies the content to extract from each search result. Omit `extraction` for a plain search that returns snippets only. Available on `POST /v1/search` only. For existing integrations, follow the [migration note](https://you.com/docs/guides/search/retrieve-page-content#migrate-to-extraction). `extraction_mode: \"highlights\"` accepts `count` up to 50. `count` above 50 returns `422` (`highlights supports count up to 50, got N`).\n\n**Pricing:** This feature may add additional cost depending on your configuration. See [billing](https://you.com/docs/administration/billing#web-search-api) for all details.","title":"Extraction"},"Freshness":{"type":"string","enum":["day","week","month","year"],"title":"Freshness"},"FreshnessValue":{"oneOf":[{"$ref":"#/components/schemas/Freshness"},{"type":"string"}],"description":"Specifies the freshness of the results to return. Provide either one of `day`, `week`, `month`, `year`, or a date range string in the format `YYYY-MM-DDtoYYYY-MM-DD`.\n\nWhen your search query includes a temporal keyword and you also set a freshness parameter, the broader of the two timeframes is used. For example, if you use `query=news+this+week&freshness=month`, the results will use `month`.","title":"FreshnessValue"},"Country":{"type":"string","enum":["AR","AU","AT","BE","BR","CA","CL","DK","FI","FR","DE","HK","IN","ID","IT","JP","KR","MY","MX","NL","NZ","NO","CN","PL","PT","PH","RU","SA","ZA","ES","SE","CH","TW","TR","GB","US"],"description":"The country code that determines the geographical focus of the web results.","title":"Country"},"Language":{"type":"string","enum":["AR","EU","BN","BG","CA","ZH-HANS","ZH-HANT","HR","CS","DA","NL","EN","EN-GB","ET","FI","FR","GL","DE","EL","GU","HE","HI","HU","IS","IT","JA","KN","KO","LV","LT","MS","ML","MR","NB","PL","PT-BR","PT-PT","PA","RO","RU","SR","SK","SL","ES","SV","TA","TE","TH","TR","UK","VI"],"default":"EN","description":"The language of the web results that will be returned (BCP 47 format).","title":"Language"},"IncludeDomains":{"type":"array","items":{"type":"string"},"description":"A strict allowlist of domains to restrict search results to. Supports up to 500 domains.\n\nCombining with `exclude_domains` is invalid.","title":"IncludeDomains"},"ExcludeDomains":{"type":"array","items":{"type":"string"},"description":"A strict denylist of domains to exclude from search results. Results from these domains will be filtered out. Supports up to 5000 domains.\n\nCombining with `include_domains` is invalid.","title":"ExcludeDomains"},"BoostDomains":{"type":"array","items":{"type":"string"},"description":"A list of domains to boost in search ranking. Matching results from these domains receive a fixed relative ranking boost, but this is not a filter. If the boosted domains do not have matching results, results from other domains can still appear. Supports up to 500 domains.\n\nCombining with `exclude_domains` is valid. Combining with `include_domains` is invalid.","title":"BoostDomains"},"StrictOperators":{"type":"boolean","default":false,"description":"Enforce search operators such as quoted phrases and `site:` exactly. By default, when a query's operators match no pages, the search relaxes them and returns the closest matches.\n\nHas no effect with `extraction_mode: \"highlights\"`.","title":"StrictOperators"},"CrawlTimeout":{"type":"integer","minimum":1,"maximum":60,"default":10,"description":"Maximum time, in seconds, to wait when fetching full page content using `extraction_mode: \"full_page\"`. Must be between 1 and 60 seconds. Default is 10 seconds. Not valid when using `extraction_mode: \"highlights\"`.","title":"CrawlTimeout"},"Offset":{"type":"integer","minimum":0,"maximum":9,"default":0,"description":"Indicates the `offset` for pagination. The `offset` is calculated in multiples of `count`. For example, if `count = 5` and `offset = 1`, results 5–10 will be returned. Range `0 ≤ offset ≤ 9`.","title":"Offset"},"SafeSearch":{"type":"string","enum":["off","moderate","strict"],"default":"moderate","description":"Configures the safesearch filter for content moderation. This allows you to decide whether to return NSFW content or not.","title":"SafeSearch"},"SearchRequestBody":{"type":"object","properties":{"query":{"$ref":"#/components/schemas/SearchQuery"},"count":{"$ref":"#/components/schemas/Count","default":10},"knowledge":{"$ref":"#/components/schemas/Knowledge"},"extraction":{"$ref":"#/components/schemas/Extraction"},"freshness":{"$ref":"#/components/schemas/FreshnessValue"},"country":{"$ref":"#/components/schemas/Country"},"language":{"$ref":"#/components/schemas/Language","default":"EN"},"include_domains":{"$ref":"#/components/schemas/IncludeDomains"},"exclude_domains":{"$ref":"#/components/schemas/ExcludeDomains"},"boost_domains":{"$ref":"#/components/schemas/BoostDomains"},"strict_operators":{"$ref":"#/components/schemas/StrictOperators","default":false},"crawl_timeout":{"$ref":"#/components/schemas/CrawlTimeout","default":10},"offset":{"$ref":"#/components/schemas/Offset","default":0},"safesearch":{"$ref":"#/components/schemas/SafeSearch","default":"moderate"}},"required":["query"],"title":"SearchRequestBody"},"WebContentsPost":{"type":"object","properties":{"html":{"type":"string","description":"The HTML content of the page."},"markdown":{"type":"string","description":"The Markdown content of the page."},"highlights":{"type":"array","items":{"type":"string"},"description":"Query-relevant passages from the page."}},"description":"Contents of a web result: contains `highlights` by default, or `html` and/or `markdown` when full page content is requested.","title":"WebContentsPost"},"WebResultPost":{"type":"object","properties":{"url":{"type":"string","description":"The URL of the specific search result."},"title":{"type":"string","description":"The title or name of the search result."},"description":{"type":"string","description":"A brief description of the content of the search result."},"snippets":{"type":"array","items":{"type":"string"},"description":"An array of short, keyword-centered text fragments from the search result. Use `extraction_mode: \"highlights\"` instead, which returns an improved set of query-relevant passages from the search result."},"thumbnail_url":{"type":"string","description":"URL of the thumbnail."},"page_age":{"type":"string","description":"The age of the search result."},"contents":{"$ref":"#/components/schemas/WebContentsPost"},"favicon_url":{"type":"string","description":"The URL of the favicon of the search result's domain."}},"title":"WebResultPost"},"KnowledgeAttribution":{"type":"object","properties":{"name":{"type":"string","description":"Data provider for the knowledge result."},"source_description":{"type":"string","description":"Description of the provider."}},"required":["name"],"title":"KnowledgeAttribution"},"KnowledgeResult":{"type":"object","properties":{"type":{"type":"string","description":"The kind of knowledge result retrieved. `answer` is the only value currently returned. Ignore a value you do not recognize rather than failing on it, since a new kind may populate a different set of fields."},"title":{"type":"string","description":"The title of the knowledge result."},"attribution":{"type":"array","items":{"$ref":"#/components/schemas/KnowledgeAttribution"},"description":"Display credit for the data behind the result. These are credits rather than citations: each entry names a provider and carries no URL."},"description":{"type":"string","description":"Description of the knowledge result, drawn from proprietary licensed data. Required on `type: answer` results."},"as_of":{"type":"string","description":"The date the result's underlying data covers, as `YYYY-MM-DD`. Optional, and omitted when the provider reports no date."}},"required":["type","title","attribution"],"description":"A single knowledge result. `type` identifies the kind of result and determines which fields it populates. `type`, `title`, and `attribution` are required on every kind.\n\nFor `type: answer`, the only kind currently returned, `description` is required and `as_of` is optional.","title":"KnowledgeResult"},"SearchPostResponseResults":{"type":"object","properties":{"web":{"type":"array","items":{"$ref":"#/components/schemas/WebResultPost"},"description":"Ranked web results. News articles appear here alongside other web results when the query has news intent."},"knowledge":{"type":"array","items":{"$ref":"#/components/schemas/KnowledgeResult"},"description":"Results backed by licensed data providers. Up to 25 are returned, limited to those relevant to the query. When none are relevant the key is omitted rather than returned as an empty array."}},"title":"SearchPostResponseResults"},"SearchMetadata":{"type":"object","properties":{"search_uuid":{"type":"string","format":"uuid"},"query":{"type":"string","description":"Returns the search query used to retrieve the results."},"latency":{"type":"number","format":"double"}},"title":"SearchMetadata"},"SearchPostResponse":{"type":"object","properties":{"results":{"$ref":"#/components/schemas/SearchPostResponseResults"},"metadata":{"$ref":"#/components/schemas/SearchMetadata"}},"title":"SearchPostResponse"},"SearchPostRequestUnauthorizedError":{"type":"object","properties":{"detail":{"type":"string","description":"Error detail message."}},"title":"SearchPostRequestUnauthorizedError"},"UpgradeRequiredResponse":{"type":"object","properties":{"error":{"type":"string","description":"The error code."},"message":{"type":"string","description":"A description of the error."},"upgrade_url":{"type":"string","description":"The URL for adding credits or upgrading the account."},"limit":{"type":"integer","description":"The usage limit, when available."},"used":{"type":"integer","description":"The usage consumed, when available."},"period":{"type":"string","description":"The usage period, when available."},"reset_at":{"type":"string","description":"The reset timestamp, when available."}},"required":["error","message","upgrade_url"],"title":"UpgradeRequiredResponse"},"SearchPostRequestForbiddenError":{"type":"object","properties":{"detail":{"type":"string"}},"title":"SearchPostRequestForbiddenError"},"SearchPostRequestUnprocessableEntityError":{"type":"object","properties":{"error":{"type":"string"}},"title":"SearchPostRequestUnprocessableEntityError"},"SearchPostRequestInternalServerError":{"type":"object","properties":{"detail":{"type":"string"}},"title":"SearchPostRequestInternalServerError"}},"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-Key","description":"A unique API Key is required to authorize API access. [Get your API Key with free credits](https://you.com/platform)."}}}}