> 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.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://llm-aws.course.gspivey.com/foundations/project-sec-edgar-api-library/filter-submissions-and-retrieve-doc.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
