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

# Start with the Rust SDK

> Add the async SEC API Rust client, make one bounded request, and retain the source identity from the response.

## Prerequisites

* Rust and Cargo.
* An API key in `SECAPI_API_KEY`.

```bash theme={null}
cargo new --bin secapi-rust-quickstart
cd secapi-rust-quickstart
export SECAPI_API_KEY="secapi_..."
```

Replace the generated `[dependencies]` section in `Cargo.toml`:

```toml theme={null}
[dependencies]
sec-api-sdk-rust = "2.0.0"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
```

## Run a first request

Replace `src/main.rs`:

```rust theme={null}
use sec_api_sdk_rust::SecApiClient;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = SecApiClient::new(std::env::var("SECAPI_API_KEY").ok());
    let filing = client
        .latest_filing(&[("ticker", "AAPL"), ("form", "10-K"), ("view", "agent")])
        .await?;

    println!("{filing}");
    Ok(())
}
```

```bash theme={null}
cargo run
```

Expect a JSON response that identifies the current matching filing. Preserve its accession number, filing URL, and request ID when present. A response in agent view is intentionally smaller and may not include all default-view metadata.

## Special Situations workflow

The async client has helpers for a current roster and detail, filing-event activity, disclosed calendar dates, aggregate counts, archived weekly issues, Markdown exports, underwriting packs, and monitor creation.

```rust theme={null}
use sec_api_sdk_rust::SituationWatchDelivery;
use serde_json::json;

let roster = client.list_situations(&[("types", "merger"), ("statuses", "pending"), ("limit", "25")]).await?;
let detail = client.get_situation("sit_abc123", &[]).await?;
let by_form = client.situations_by_form("SC 13D", &[("limit", "25")]).await?;
let filings = client.situation_filings("sit_abc123", &[("limit", "25")]).await?;
let summary = client.situation_summary("sit_abc123", &[]).await?;
let feed = client.situations_feed(&[("tickers", "ACME")]).await?;
let calendar = client.situations_calendar(&[("date_types", "vote,expected_close"), ("days", "30")]).await?;
let stats = client.situations_stats(&[("window", "30d")]).await?;
let issues = client.situations_issues(&[("limit", "12")]).await?;
let brief = client.export_situation("sit_abc123", &[]).await?;
let underwriting = client.underwrite_situation("sit_abc123", &[]).await?;
let public_roster = client.embed_situations(&[("limit", "10")]).await?;
let public_brief = client.embed_situation_export("sit_abc123", &[]).await?;
let watch = client.watch_situations(
    &json!({"tickers": ["ACME"]}),
    SituationWatchDelivery::Email("research@example.com".to_string()),
    Some("ACME situation updates"),
    None,
).await?;
```

Current detail can change as filings arrive; an issue is an immutable historical publication. Retain source identifiers and request IDs with derived output, and review the underlying filing before relying on a disclosed term or date. See [Special Situations workflows](/special-situations-workflows) for the REST and CLI workflow.

## Errors and reliability

The SDK defaults to a 30-second request timeout and uses a bounded retry policy that honors `Retry-After`. A `429` can be retried even when it follows a mutating request; treatment of other failures depends on whether the client is issuing a read or mutation.

Use `with_timeout(...)` to set a service-appropriate budget. Before a mutation whose replay is unsafe, use `without_retries()` or ensure the operation is idempotent. Do not combine multiple unbounded retry layers.

```rust theme={null}
use sec_api_sdk_rust::SecApiClient;
use std::time::Duration;

let client = SecApiClient::new(std::env::var("SECAPI_API_KEY").ok())
    .with_timeout(Duration::from_secs(10));
```

## Production notes

* Keep credentials in the runtime environment or secret manager, never in source.
* Capture status, request ID, response version, and source identifiers with failures and persisted results.
* Prefer typed builders for common paths, but confirm each parameter and optional field in the API reference.
* Use the default response when a workflow needs provenance or freshness fields that an endpoint's compact view omits.

Next: [SDK reliability](/sdk-reliability), [API conventions](/api-conventions), or [error code catalog](/error-code-catalog).
