# SEC Filings to Markdown for RAG (`nexgendata/sec-filings-rag-markdown`) Actor

Convert SEC EDGAR filings (10-K, 10-Q, 8-K, 13F) into clean, chunked, citation-tagged Markdown for RAG and LLM pipelines. Official data, no login.

- **URL**: https://apify.com/nexgendata/sec-filings-rag-markdown.md
- **Developed by:** [NexGenData](https://apify.com/nexgendata) (community)
- **Categories:** Business, AI, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $40.00 / 1,000 markdown chunks

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## 📑 SEC Filings to Markdown for RAG · EDGAR → LLM-Ready

Convert SEC EDGAR filings into clean, chunked, citation-tagged Markdown — built for AI engineers feeding financial filings into RAG pipelines and LLM agents.

### ⚡ What you get
| Field | Description |
|---|---|
| `company` / `cik` / `ticker` | Issuer identity |
| `form` | Filing type (10-K, 10-Q, 8-K, 13F, …) |
| `filingDate` | Date filed |
| `accessionNumber` | SEC accession number (citation) |
| `sourceUrl` | Direct link to the source document (citation) |
| `chunkIndex` / `totalChunks` | Position within the filing |
| `markdown` | Clean Markdown chunk, ready for embedding |

### 🎯 Use cases
1. AI engineers building financial-research copilots / RAG over filings
2. Quant & fundamental analysts loading 10-Ks into a vector store
3. Compliance teams building searchable filing knowledge bases
4. Fintech products needing LLM-ready filing text with citations

### 🚀 Sample inputs
```json
{ "companies": ["AAPL","MSFT"], "formTypes": ["10-K","10-Q"], "maxFilingsPerCompany": 2, "chunkWords": 800 }
````

```json
{ "companies": ["NVDA"], "formTypes": ["8-K"], "maxFilingsPerCompany": 5 }
```

```json
{ "companies": ["320193"], "formTypes": ["13F-HR"] }
```

### 📦 Sample output

```json
{ "company": "Apple Inc.", "cik": "0000320193", "ticker": "AAPL", "form": "10-K",
  "filingDate": "2025-11-01", "accessionNumber": "0000320193-25-000123",
  "sourceUrl": "https://www.sec.gov/Archives/edgar/data/320193/.../aapl-20250927.htm",
  "chunkIndex": 0, "totalChunks": 42, "markdown": "## Item 1. Business\nThe Company designs..." }
```

### 📊 Sample Output

![Sample output](https://api.apify.com/v2/key-value-stores/8gLgXMBveEI1tTz1z/records/sec-filings-rag-markdown-output.png)

### 🛠 How it works

1. **Source** — resolves tickers→CIK and reads filings from the official SEC EDGAR APIs (`data.sec.gov`, `www.sec.gov/Archives`).
2. **Parser** — strips scripts/styles and converts filing HTML to ATX Markdown.
3. **Chunking** — splits into ~`chunkWords`-word chunks for embedding.
4. **Schema** — one row per chunk with full citation fields (accession + source URL).
5. **Fallback** — unresolved tickers / failed docs are logged and skipped; the run still succeeds.

### 🔗 Related Actors

- [SEC EDGAR Scraper](https://apify.com/nexgendata/sec-edgar-filings-scraper?fpr=2ayu9b) — structured filing data
- [SEC Form 13F Holdings Tracker](https://apify.com/nexgendata/sec-form-13f-tracker-pro?fpr=2ayu9b) — institutional holdings
- [RAG Web Browser](https://apify.com/nexgendata/rag-web-browser?fpr=2ayu9b) — web content for retrieval
- [Website Content Crawler](https://apify.com/nexgendata/website-content-crawler?fpr=2ayu9b) — full-site Markdown for AI

### 💰 Pricing Example

Pay-per-event: **$0.005 per run + $0.04 per Markdown chunk** (`document-record`).
| Chunks | Cost |
|---|---|
| 100 | ~$4.00 |
| 500 | ~$20.00 |
| 2,000 | ~$80.00 |
Apify's **$5 free credit** covers ~124 chunks. [Start free →](https://apify.com/?fpr=2ayu9b)

### ⚖️ Legal & data sources

Data is from the **public SEC EDGAR system** (`data.sec.gov`, `www.sec.gov`) — U.S. government public-domain filings. Requests use an identified, contact-bearing User-Agent per SEC access guidance. You are responsible for your downstream use.

### ❓ FAQ

**Which forms are supported?** Any EDGAR form type — pass them in `formTypes` (10-K, 10-Q, 8-K, 13F-HR, DEF 14A, …).
**Ticker or CIK?** Either; tickers are resolved to CIK automatically.
**Are citations included?** Yes — every chunk carries the accession number and source URL.
**How big are chunks?** ~`chunkWords` words (default 800); tune for your embedder.
**Is the data fresh?** Pulled live from EDGAR at run time.
**Cost control?** Use `maxFilingsPerCompany` and `formTypes` to bound output.

### 🆘 Troubleshooting

- **Company not found** — check the ticker symbol or pass the CIK directly.
- **0 chunks** — the requested `formTypes` may not exist in that issuer's recent filings.
- **Huge output** — lower `maxFilingsPerCompany` or narrow `formTypes`.
- **Markdown noise from exhibits** — narrow to the primary form types you need.

### 🏷️ About NexGenData

NexGenData builds structured public-data tools for analysts, developers, and operators. Full catalog: [thenextgennexus.com](https://thenextgennexus.com/actors-by-workflow/).

# Actor input Schema

## `companies` (type: `array`):

Tickers or CIKs, e.g. \["AAPL","MSFT","320193"].

## `formTypes` (type: `array`):

SEC form types to include (e.g. 10-K, 10-Q, 8-K, 13F-HR).

## `maxFilingsPerCompany` (type: `integer`):

How many recent matching filings to convert per company.

## `chunkWords` (type: `integer`):

Approximate words per Markdown chunk for RAG ingestion.

## Actor input object example

```json
{
  "companies": [
    "AAPL",
    "MSFT"
  ],
  "formTypes": [
    "10-K",
    "10-Q",
    "8-K"
  ],
  "maxFilingsPerCompany": 3,
  "chunkWords": 800
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "companies": [
        "AAPL",
        "MSFT"
    ],
    "formTypes": [
        "10-K",
        "10-Q",
        "8-K"
    ],
    "maxFilingsPerCompany": 3,
    "chunkWords": 800
};

// Run the Actor and wait for it to finish
const run = await client.actor("nexgendata/sec-filings-rag-markdown").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "companies": [
        "AAPL",
        "MSFT",
    ],
    "formTypes": [
        "10-K",
        "10-Q",
        "8-K",
    ],
    "maxFilingsPerCompany": 3,
    "chunkWords": 800,
}

# Run the Actor and wait for it to finish
run = client.actor("nexgendata/sec-filings-rag-markdown").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "companies": [
    "AAPL",
    "MSFT"
  ],
  "formTypes": [
    "10-K",
    "10-Q",
    "8-K"
  ],
  "maxFilingsPerCompany": 3,
  "chunkWords": 800
}' |
apify call nexgendata/sec-filings-rag-markdown --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=nexgendata/sec-filings-rag-markdown",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "SEC Filings to Markdown for RAG",
        "description": "Convert SEC EDGAR filings (10-K, 10-Q, 8-K, 13F) into clean, chunked, citation-tagged Markdown for RAG and LLM pipelines. Official data, no login.",
        "version": "0.0",
        "x-build-id": "dhqXCLOXjiLSrKyhA"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/nexgendata~sec-filings-rag-markdown/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-nexgendata-sec-filings-rag-markdown",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/nexgendata~sec-filings-rag-markdown/runs": {
            "post": {
                "operationId": "runs-sync-nexgendata-sec-filings-rag-markdown",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/nexgendata~sec-filings-rag-markdown/run-sync": {
            "post": {
                "operationId": "run-sync-nexgendata-sec-filings-rag-markdown",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "companies"
                ],
                "properties": {
                    "companies": {
                        "title": "Companies",
                        "type": "array",
                        "description": "Tickers or CIKs, e.g. [\"AAPL\",\"MSFT\",\"320193\"].",
                        "items": {
                            "type": "string"
                        }
                    },
                    "formTypes": {
                        "title": "Form types",
                        "type": "array",
                        "description": "SEC form types to include (e.g. 10-K, 10-Q, 8-K, 13F-HR).",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxFilingsPerCompany": {
                        "title": "Max filings per company",
                        "type": "integer",
                        "description": "How many recent matching filings to convert per company."
                    },
                    "chunkWords": {
                        "title": "Chunk size (words)",
                        "type": "integer",
                        "description": "Approximate words per Markdown chunk for RAG ingestion."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
