> For the complete documentation index, see [llms.txt](https://llm-aws.course.gspivey.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://llm-aws.course.gspivey.com/foundations/project-sec-edgar-api-library/filter-submissions-and-retrieve-doc.md).

# Filter Submissions and Retrieve Doc

Under `filings -> recent`

There are 3 key arrays along the CIK number that is key data needed to find a document

* accessionNumber
* primaryDocument
  * This is the name of the document we are going to use
* primaryDocumentDescription
  * These will describe what the document is. In our case we care about the `10-K` and `10-Q` documents.
  * You could think about making your program configurable to handle any document type

Remember arrays are ordered. So you can use the index number to help you find the other values you care about.

The URL for the document will follow this format

`https://www.sec.gov/Archives/edgar/data/{CIK}/{accessionNumber}/{primaryDocument}`

Note: accession numbers in the SEC API response contain dashes (e.g., `0000320193-24-000069`), but the URL path uses the dash-stripped form (e.g., `000032019324000069`). Strip the dashes when constructing the URL.

#### Example

> **Capture-Dated Example** — results shown may differ from your own.

`curl -A "<your organization> <your name> <your email>" -v https://www.sec.gov/Archives/edgar/data/320193/000032019324000069/aapl-20240330.htm`

Replace the CIK, accession number, and document name with values from your own submission lookup. Use a recent filing from any company you choose.
