> ## Documentation Index
> Fetch the complete documentation index at: https://docs.secapi.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Build a Risk Factor Review Agent

> Retrieve the latest Item 1A section and save a source-linked review input.

Retrieve one issuer's latest Item 1A and save a reviewable source artifact. The
output is not a materiality score, legal conclusion, or prediction.

## Prerequisites

* Python 3.9+, `requests`, and an API key in `SECAPI_API_KEY`.
* An issuer ticker or CIK. This example uses `AAPL`.

```bash theme={null}
python -m pip install requests
export SECAPI_API_KEY="your_api_key"
```

## 1. Retrieve the latest Item 1A

```bash theme={null}
curl --get --fail-with-body -H "x-api-key: $SECAPI_API_KEY" \
  --data-urlencode "ticker=AAPL" --data-urlencode "form=10-K" \
  "https://api.secapi.ai/v1/filings/latest/sections/item_1a" \
  | jq '{key, contentMd, provenance, requestId, traceparent}'
```

The result contains the returned section content and filing provenance. Keep the
provenance with the text; a section is a retrieval aid and the filing is the
authoritative disclosure.

## 2. Save a review input

Create `risk_review.py`:

```python theme={null}
import json, os
from pathlib import Path
import requests

response = requests.get(
    "https://api.secapi.ai/v1/filings/latest/sections/item_1a",
    headers={"x-api-key": os.environ["SECAPI_API_KEY"]},
    params={"ticker": "AAPL", "form": "10-K"}, timeout=30,
)
response.raise_for_status()
payload = response.json()
Path("item-1a-review-input.json").write_text(json.dumps(payload, indent=2) + "\n")
print({"output": "item-1a-review-input.json", "requestId": payload.get("requestId")})
```

Run `python risk_review.py`. The expected result is a JSON file with the section,
filing provenance, and request metadata. Read the linked filing before quoting or
classifying a risk; wording and extraction boundaries can change without a new
economic disclosure.

## Common errors and production use

* `400` usually means the issuer identifier is absent; `401` and `403` indicate
  a credential or entitlement problem.
* `GET /v1/filings/latest/sections/item_1a` returns `502` with
  `section_lookup_failed` when the selected latest filing section cannot be
  resolved or rendered. Review that boundary; it is not a negative risk finding.
* Store the returned accession, source URL, section key, and request ID. When
  comparing periods, retrieve and retain each filing explicitly rather than
  treating a text diff as a materiality decision.

## Next steps

Use [filing search](/products/search) to locate a specific disclosure, then add
a reviewer-approved comparison process for two identified filings.
