Your first SEC API request.
SEC API provides authenticated JSON endpoints for company discovery, SEC filing metadata, and XBRL company facts. This guide takes you from a ticker symbol to a list of filings.
https://sec-api.dev/api/v1All production endpoints require a bearer API key. The playground provides limited anonymous demonstrations.
1. Create your API key
Create an account, then generate an API key in your dashboard. Treat it like a password: keep it on your server and never put it in public repositories or client-side JavaScript.
Authorization: Bearer YOUR_API_KEY2. Find a company
Search by ticker or company name. The response gives you a Central Index Key (CIK), the SEC identifier you use in filing and facts requests.
curl "https://sec-api.dev/api/v1/companies?query=AAPL" \
-H "Authorization: Bearer YOUR_API_KEY"3. Retrieve its filings
Apple’s CIK is 320193. Use it to request filing metadata. Filter by a form, and use limit and offset to paginate.
curl "https://sec-api.dev/api/v1/filings?cik=320193&form=10-K&limit=5" \
-H "Authorization: Bearer YOUR_API_KEY"JavaScript / Node.js
Set SEC_API_KEY in your server environment, then use the standard fetch API.
const response = await fetch(
'https://sec-api.dev/api/v1/filings?cik=320193&form=10-K',
{ headers: { Authorization: `Bearer ${process.env.SEC_API_KEY}` } }
);
const payload = await response.json();
if (!response.ok) {
throw new Error(payload.error?.message ?? 'SEC API request failed');
}
console.log(payload.data);Python
This example uses Python’s standard library, with no SDK dependency.
import json
import os
from urllib.request import Request, urlopen
from urllib.error import HTTPError
request = Request(
'https://sec-api.dev/api/v1/filings?cik=320193&form=10-K',
headers={'Authorization': f"Bearer {os.environ['SEC_API_KEY']}"}
)
try:
with urlopen(request, timeout=30) as response:
print(json.load(response)['data'])
except HTTPError as error:
print(error.code, error.read().decode())What to keep in mind
Use the original SEC filing as the authority for financial interpretation. Reporting periods, units, taxonomies, and amendments matter. A filing’s acceptance date is not necessarily its financial reporting period.
The API returns source and fetch metadata. Inspect meta.stale where present before treating a response as freshly retrieved. Handle non-2xx responses explicitly, and respect any retry guidance in rate-limit errors.