{"id":5053,"library":"sec-api","title":"SEC API Python Client","description":"The `sec-api` Python library provides a robust client for accessing SEC EDGAR filings data. It offers various APIs for querying, full-text searching, real-time streaming, and converting/extracting structured data from over 20 million filings and 800,000+ entities, dating back to 1993 with real-time updates. The library is actively maintained, with frequent updates adding new API wrappers and features. The current version is 1.0.35.","status":"active","version":"1.0.35","language":"en","source_language":"en","source_url":"https://github.com/janlukasschroeder/sec-api-python","tags":["SEC","EDGAR","Filings","API","Finance","10-K","10-Q","8-K","XBRL","Financial Data"],"install":[{"cmd":"pip install sec-api","lang":"bash","label":"Install sec-api"}],"dependencies":[],"imports":[{"note":"Used for searching and filtering SEC EDGAR filings metadata.","symbol":"QueryApi","correct":"from sec_api import QueryApi"},{"note":"For searching the full text of SEC filings and their exhibits.","symbol":"FullTextSearchApi","correct":"from sec_api import FullTextSearchApi"},{"note":"DownloadApi is the current class for downloading filings and exhibits. RenderApi was an alias or an older name for this functionality and is now a dedicated class in recent versions (>=1.0.34).","wrong":"from sec_api import RenderApi","symbol":"DownloadApi","correct":"from sec_api import DownloadApi"},{"note":"For converting XBRL data to JSON and extracting financial statements.","symbol":"XbrlApi","correct":"from sec_api import XbrlApi"},{"note":"Introduced in v1.0.34 for managing and downloading bulk datasets.","symbol":"Datasets","correct":"from sec_api import Datasets"}],"quickstart":{"code":"import os\nfrom sec_api import QueryApi\n\n# Get your free API key at sec-api.io\nAPI_KEY = os.environ.get(\"SEC_API_KEY\", \"YOUR_API_KEY\") \n\nqueryApi = QueryApi(api_key=API_KEY)\n\nsearch_params = {\n    \"query\": \"ticker:TSLA\",\n    \"from\": \"0\",\n    \"size\": \"50\",\n    \"sort\": [{\"filedAt\": {\"order\": \"desc\"}}]\n}\n\nresponse = queryApi.get_filings(search_params)\n\nprint(f\"Total filings for TSLA: {response['total']['value']}\")\nfor filing in response['filings']:\n    print(f\"  - {filing['formType']} filed on {filing['filedAt']}: {filing['linkToFilingDetails']}\")","lang":"python","description":"This quickstart demonstrates how to use the QueryApi to retrieve metadata for the latest 50 EDGAR filings for Tesla. Remember to replace 'YOUR_API_KEY' with a valid API key or set the 'SEC_API_KEY' environment variable."},"warnings":[{"fix":"Ensure `api_key` is provided when instantiating any API client class, e.g., `QueryApi(api_key=\"YOUR_API_KEY\")`. It is recommended to use environment variables for keys.","message":"An API key is required for all interactions with the SEC API. Obtain a free API key from sec-api.io.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For datasets larger than 10,000 records, you will need to break down your queries by narrower time ranges or other filters to retrieve all data.","message":"Search APIs (e.g., QueryApi, Form D API) have a maximum limit of 10,000 records per query, even when using the 'from' parameter for pagination.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Implement proper rate-limiting in your application to stay within the allowed request rate. Check your specific plan for exact limits.","message":"The SEC API imposes rate limits. Exceeding approximately 40 requests per second can lead to temporary blocks of your API key.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Update imports and instantiation from `RenderApi` to `DownloadApi`. For example, `from sec_api import DownloadApi` and `downloadApi = DownloadApi(...)`.","message":"The `RenderApi` class for downloading filings has been superseded by `DownloadApi`. While `RenderApi` might still function due to aliases, using `DownloadApi` is recommended.","severity":"deprecated","affected_versions":"Introduced in 1.0.34"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}