# PDF Generator API Reference | SEC API > Complete API reference for the SEC EDGAR PDF Generator API. The query parameter, the response format, the 202 retry behaviour and every status code, with Python, JavaScript and cURL examples. Source: https://sec-api.io/api-reference/pdf-generator Filing search and retrieval GET`https://api.sec-api.io/filing-reader?url={url}` Convert any SEC EDGAR filing or exhibit into a PDF file. HTML, XML and text documents of every EDGAR form type are supported, and the PDF preserves the original formatting, including images and tables. [Read the guide for this API →](https://sec-api.io/docs/sec-filings-to-pdf-generator-api) ## Authentication Send the API key either as a header or as a query parameter. The header is preferred; the query parameter exists for cases where a header cannot be set, such as opening a URL directly in a browser. Authorization: required header The API key on its own. Do not prefix it with Bearer or any other word. Example `Authorization: YOUR_API_KEY` token: optional query parameter The API key, appended to the URL. Use this only when a header is not possible. ## Query parameters Appended to the URL as a query string. url: required string URL of the filing or exhibit under sec.gov/Archives. All file types are supported: HTML, XML and TXT. EDGAR links inline XBRL filings through a viewer URL that starts with /ix?doc=. That viewer page is not the file itself, so delete the /ix?doc= part before you pass the URL to the API. Example `https://www.sec.gov/Archives/edgar/data/320193/000032019323000106/aapl-20230930.htm` ## Response Content-Type: application/pdf. body: binary The PDF file itself. It preserves the original formatting of the filing, including images and tables. Images are scaled for high-quality printing, and invisible inline XBRL tags are removed to keep the file size down. Files already published as PDF on EDGAR are returned as filed. Content-Type: header application/pdf when the PDF is returned. application/json when the API answers with 202 and the conversion is still running. message: optional string Only present in the JSON body of a 202 response: Cache miss: PDF generation started. Retry in 5 seconds. ## Status codes | | | | --- | --- | | `200` | Success. The body is the PDF file, with content type application/pdf. | | `202` | The filing or exhibit is queued for conversion and the PDF is not ready yet. The body is JSON and holds message. Retry the same request after 5 seconds. Three to four retries usually return the PDF. Treat 4 minutes as the outer limit, then report the URL to support@sec-api.io. | | `403` | The API key is missing, or it is not valid. | | `404` | The url does not point at a file on www.sec.gov, or the file does not exist. | | `429` | Too many requests. Slow the request rate and retry. | | `500` | Server error. Retry, and report it if it persists. | ## Request example GET https://api.sec-api.io/filing-reader?url={url} ```bash GET https://api.sec-api.io/filing-reader?token=YOUR_API_KEY&url=https://www.sec.gov/Archives/edgar/data/320193/000032019323000106/aapl-20230930.htm ``` ```python from sec_api import PdfGeneratorApi pdfGeneratorApi = PdfGeneratorApi("YOUR_API_KEY") pdf = pdfGeneratorApi.get_pdf( "https://www.sec.gov/Archives/edgar/data/320193/000032019323000106/aapl-20230930.htm" ) with open("filing.pdf", "wb") as f: f.write(pdf) ``` ```javascript import fs from "fs"; import { pdfGeneratorApi } from "sec-api"; pdfGeneratorApi.setApiKey("YOUR_API_KEY"); const pdfBuffer = await pdfGeneratorApi.getPdf( "https://www.sec.gov/Archives/edgar/data/320193/000032019323000106/aapl-20230930.htm" ); fs.writeFileSync("filing.pdf", pdfBuffer); ``` ```bash curl -o filing.pdf \ -H "Authorization: YOUR_API_KEY" \ "https://api.sec-api.io/filing-reader?url=https://www.sec.gov/Archives/edgar/data/320193/000032019323000106/aapl-20230930.htm" ``` ## Response example 200 OK · application/pdf ```bash HTTP/1.1 200 OK Content-Type: application/pdf %PDF-1.7 ... binary PDF bytes, streamed in chunks ... ```