{"openapi":"3.1.0","info":{"title":"Extract","version":"1.0.0"},"paths":{"/v1/extract":{"post":{"operationId":"extract","summary":"Fetches any webpage or PDF and parses into clean Markdown or HTML","description":"The Extract API fetches any webpage or PDF and parses it into clean Markdown or HTML. Use it after a Web Search API call, when your agent needs the full document, such as a filing, a contract, or a research paper, instead of a highlight.\n\nPDF tables come back as Markdown or HTML tables with rows and columns intact. Set `parse_effort=standard` to also send complex PDF pages, such as charts and images, through an advanced model for the most complete output.","responses":{"200":{"description":"A JSON object containing the extracted content from the URL","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractResult"}}}},"401":{"description":"Unauthorized. Problems with API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractRequestUnauthorizedError"}}}},"402":{"description":"Payment Required. The prepaid credit balance is depleted. Retrying fails until credits are added at `details.upgrade_url`. The API gateway can also answer with its own body, so branch on the 402 status rather than the body.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractErrorResponse"}}}},"403":{"description":"Forbidden. API key lacks scope for this path.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractRequestForbiddenError"}}}},"422":{"description":"Unprocessable Entity. The request can't succeed as sent. `code` is `invalid_request` when the body failed validation, with one entry per problem in `details.fields`. Unknown fields, including the removed `crawl_timeout`, are rejected. `invalid_url` means the URL can never be fetched (malformed, not http or https, a private address, or a hostname that doesn't exist), with the cause in `details.reason`. `pdf_too_large` means the PDF needs more time than `timeout` allows, so a higher `timeout` can let it through.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractErrorResponse"}}}},"500":{"description":"Internal Server Error. `code` is `internal_error`. Retry only when `retryable` is `true`, and honor the `Retry-After` header when it is present. If the error persists, contact support with the `request_id`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractErrorResponse"}}}},"502":{"description":"Bad Gateway. The page itself can't be extracted, and retrying fails until the page changes. `code` is `site_blocked`, `site_unreachable`, or `unsupported_content`, with the cause in `details.reason`. `unsupported_content` can also include `details.content_type`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractErrorResponse"}}}},"503":{"description":"Service Unavailable. A dependency, including DNS, was down or rate limited. Retry after the number of seconds in the `Retry-After` header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractErrorResponse"}}}},"504":{"description":"Gateway Timeout. The request didn't finish within `timeout`. `details.timeout_s` is the timeout that applied. Below the 100-second maximum, retry with a higher `timeout`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractRequest"}}}},"security":[{"ApiKeyAuth":[]}]}},"/v1/contents":{"post":{"operationId":"contents","summary":"Returns the content of the web pages","description":"<Warning>\n  **Deprecated.** The Contents API still works and existing integrations keep running, but it will not receive new features. Use the [Extract API](/docs/api-reference/extract) for new integrations.\n</Warning>\n\nReturns the HTML or Markdown of a target webpage.","responses":{"200":{"description":"An array of JSON objects containing the page content of each web page. On a multi-URL request, a PDF that is too long to process can be left out of this array.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/V1ContentsPostResponsesContentApplicationJsonSchemaItems"}}}}},"401":{"description":"Unauthorized. Problems with API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContentsRequestUnauthorizedError"}}}},"403":{"description":"Forbidden. API key lacks scope for this path.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContentsRequestForbiddenError"}}}},"422":{"description":"A single-URL request can return 422 when a PDF is too long to process within the request time limit. In a multi-URL request, that URL is left out of the 200 array.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContentsRequestUnprocessableEntityError"}}}},"500":{"description":"Internal Server Error during authentication/authorization middleware.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContentsRequestInternalServerError"}}}}},"deprecated":true,"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"urls":{"type":"array","items":{"type":"string","format":"uri"},"description":"Array of URLs to fetch the contents from."},"formats":{"$ref":"#/components/schemas/ContentsFormats"},"crawl_timeout":{"type":"integer","minimum":1,"maximum":60,"default":10,"description":"Maximum time in seconds to wait for page content. Must be between 1 and 60 seconds. Default is 10 seconds."},"max_age":{"type":["integer","null"],"minimum":0,"description":"Maximum allowed age of cached content in seconds. When set, cached content older than this threshold is ignored and the page is re-fetched. Must be 0 or greater. Default is null (no age limit, cached content is returned regardless of age)."}}}}}},"security":[{"ApiKeyAuth":[]}]}}},"servers":[{"url":"https://ydc-index.io","description":"Production"}],"components":{"schemas":{"FullPageConfigExtractionFormatsItems":{"type":"string","enum":["markdown","html"],"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`. An empty array is treated as `[\"markdown\"]`."}},"description":"Options for the returned page content. When omitted, the page is returned as Markdown.","title":"FullPageConfig"},"ExtractRequestExtractionSource":{"type":"string","enum":["blend","cache","fetch"],"default":"blend","description":"Indicates where `full_page` content comes from.\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":"ExtractRequestExtractionSource"},"ExtractRequestParseEffort":{"type":"string","enum":["lite","standard"],"default":"standard","description":"How much effort to spend parsing PDF pages. Has no effect on web pages.\n\n`lite` extracts the content embedded in each page. Use it for digitally created PDFs when you want the lowest cost.\n\n`standard` also sends complex pages, such as charts and images, through an advanced model, and is billed per page. Use it when you want the most complete output.\n\nFor example, `lite` works well on a text-based contract, while an earnings report with revenue charts returns more complete content under `standard`.","title":"ExtractRequestParseEffort"},"ExtractRequest":{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"The URL to extract content from."},"full_page":{"$ref":"#/components/schemas/FullPageConfig"},"extraction_source":{"$ref":"#/components/schemas/ExtractRequestExtractionSource","default":"blend","description":"Indicates where `full_page` content comes from.\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."},"timeout":{"type":"integer","minimum":2,"maximum":100,"default":30,"description":"Seconds the request may take end to end, including the cache lookup and the crawl. Must be between 2 and 100. Default is 30. Past it the request returns a 504."},"parse_effort":{"$ref":"#/components/schemas/ExtractRequestParseEffort","default":"standard","description":"How much effort to spend parsing PDF pages. Has no effect on web pages.\n\n`lite` extracts the content embedded in each page. Use it for digitally created PDFs when you want the lowest cost.\n\n`standard` also sends complex pages, such as charts and images, through an advanced model, and is billed per page. Use it when you want the most complete output.\n\nFor example, `lite` works well on a text-based contract, while an earnings report with revenue charts returns more complete content under `standard`."}},"required":["url"],"title":"ExtractRequest"},"ExtractContentsFullPage":{"type":"object","properties":{"markdown":{"type":"string","description":"The Markdown content of the page."},"html":{"type":"string","description":"The HTML content of the page."}},"description":"The page content in each format requested in `full_page.extraction_formats`.","title":"ExtractContentsFullPage"},"ExtractContents":{"type":"object","properties":{"full_page":{"$ref":"#/components/schemas/ExtractContentsFullPage","description":"The page content in each format requested in `full_page.extraction_formats`."}},"description":"The extracted content from the URL.","title":"ExtractContents"},"ExtractMetadata":{"type":"object","properties":{"site_name":{"type":["string","null"],"description":"The OpenGraph site name of the webpage."},"favicon_url":{"type":"string","description":"The URL of the favicon of the webpage's domain."}},"description":"Metadata about the webpage.","title":"ExtractMetadata"},"ExtractResult":{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"The URL whose content was extracted."},"extraction_source":{"type":"string","description":"Where the request allowed content to come from. `blend` serves cached content when it is available and crawls the page live when it is not."},"title":{"type":"string","description":"The title of the webpage."},"contents":{"$ref":"#/components/schemas/ExtractContents"},"metadata":{"$ref":"#/components/schemas/ExtractMetadata"}},"description":"The extracted page. Every field is omitted, and the object is empty, when nothing was extracted.","title":"ExtractResult"},"ExtractRequestUnauthorizedError":{"type":"object","properties":{"detail":{"type":"string","description":"Error detail message."}},"title":"ExtractRequestUnauthorizedError"},"ExtractErrorDetailCode":{"type":"string","enum":["invalid_request","invalid_url","payment_required","pdf_too_large","site_blocked","site_unreachable","unsupported_content","timeout","service_unavailable","internal_error"],"description":"Stable error code to branch on. New codes may be added, but existing codes are never renamed or removed.","title":"ExtractErrorDetailCode"},"ExtractErrorDetailsFieldsItems":{"type":"object","properties":{"field":{"type":"string","description":"Dotted path to the invalid field, such as `full_page.extraction_formats.0`, or `body` when the body itself can't be parsed."},"message":{"type":"string","description":"What is wrong with the field."}},"title":"ExtractErrorDetailsFieldsItems"},"ExtractErrorDetails":{"type":"object","properties":{"fields":{"type":"array","items":{"$ref":"#/components/schemas/ExtractErrorDetailsFieldsItems"},"description":"`invalid_request` only. One entry per validation problem."},"reason":{"type":"string","description":"Cause of the error. For `invalid_url`: `malformed`, `unsupported_scheme`, `private_address`, or `unresolvable`. For `site_blocked`: `unsupported_site`, `anti_bot`, or `login_required`. For `site_unreachable`: `tls_error`, `connection_failed`, `load_failed`, or `not_found`. For `unsupported_content`: `unsupported_type`, `too_large`, `not_a_pdf`, `unparseable`, `no_text`, or `unreadable_text`."},"content_type":{"type":"string","description":"`unsupported_content` only, when known. The content type of the page."},"timeout_s":{"type":"integer","description":"`timeout` and `pdf_too_large` only. The timeout, in seconds, that applied to the request."},"page_count":{"type":"integer","description":"`pdf_too_large` only, when known. The number of pages in the PDF."},"upgrade_url":{"type":"string","format":"uri","description":"`payment_required` only. Where to add credits."}},"description":"Extra context for some codes. Omitted when there is none.","title":"ExtractErrorDetails"},"ExtractErrorDetail":{"type":"object","properties":{"code":{"$ref":"#/components/schemas/ExtractErrorDetailCode","description":"Stable error code to branch on. New codes may be added, but existing codes are never renamed or removed."},"message":{"type":"string","description":"Human-readable explanation. The wording can change, so don't parse it."},"retryable":{"type":"boolean","description":"Whether sending the same request again can succeed."},"request_id":{"type":["string","null"],"description":"The You.com ID for this request. Include it when you contact support."},"details":{"$ref":"#/components/schemas/ExtractErrorDetails"}},"required":["code","message","retryable","request_id"],"title":"ExtractErrorDetail"},"ExtractErrorResponse":{"type":"object","properties":{"error":{"$ref":"#/components/schemas/ExtractErrorDetail"}},"required":["error"],"description":"The body of every 402, 422, 500, 502, 503, and 504 response.","title":"ExtractErrorResponse"},"ExtractRequestForbiddenError":{"type":"object","properties":{"detail":{"type":"string"}},"title":"ExtractRequestForbiddenError"},"ContentsFormatsItems":{"type":"string","enum":["html","markdown","metadata"],"title":"ContentsFormatsItems"},"ContentsFormats":{"type":"array","items":{"$ref":"#/components/schemas/ContentsFormatsItems"},"description":"Array of content formats to return. All included formats are returned in the response. Include \"metadata\" to get JSON-LD and OpenGraph information, if available.","title":"ContentsFormats"},"ContentsMetadata":{"type":"object","properties":{"site_name":{"type":["string","null"],"description":"The OpenGraph site name of the web page."},"favicon_url":{"type":"string","description":"The URL of the favicon of the web page's domain."}},"description":"Metadata about the web page. Only returned when 'metadata' is included in the formats array.","title":"ContentsMetadata"},"V1ContentsPostResponsesContentApplicationJsonSchemaItems":{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"The webpage URL whose content has been fetched."},"title":{"type":"string","description":"The title of the web page."},"html":{"type":["string","null"],"description":"The retrieved HTML content of the web page."},"markdown":{"type":["string","null"],"description":"The retrieved Markdown content of the web page."},"metadata":{"$ref":"#/components/schemas/ContentsMetadata"}},"title":"V1ContentsPostResponsesContentApplicationJsonSchemaItems"},"ContentsRequestUnauthorizedError":{"type":"object","properties":{"detail":{"type":"string","description":"Error detail message."}},"title":"ContentsRequestUnauthorizedError"},"ContentsRequestForbiddenError":{"type":"object","properties":{"detail":{"type":"string"}},"title":"ContentsRequestForbiddenError"},"ContentsRequestUnprocessableEntityError":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"title":"ContentsRequestUnprocessableEntityError"},"ContentsRequestInternalServerError":{"type":"object","properties":{"detail":{"type":"string"}},"title":"ContentsRequestInternalServerError"}},"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)."}}}}