Skip to main content

Rust REST Guide

Use SEC API from async Rust services with direct REST calls today. The examples keep the canonical API contract visible so request IDs, freshness, provenance, and materialization metadata are easy to preserve.

Status

Direct REST today

Use the documented REST contract from any async Rust HTTP client.

Async-first

Built around reqwest and serde for async service workloads.

REST parity

It mirrors the canonical API so freshness, provenance, and materialization stay visible.
1

Add an HTTP client

Use reqwest, serde, and SECAPI_API_KEY to call the public REST API.
2

Exercise one fast path

Start with a volatility or entity lookup to confirm the runtime wiring.
3

Exercise one structured workflow

Move to filings, statements, or ownership so you are validating the real contract shape.

Example

let api_key = std::env::var("SECAPI_API_KEY")?;
let client = reqwest::Client::new();
let response = client
    .get("https://api.secapi.ai/v1/entities/resolve")
    .query(&[("ticker", "AAPL")])
    .header("x-api-key", api_key)
    .send()
    .await?
    .error_for_status()?;

let entity: serde_json::Value = response.json().await?;
println!("{entity:#?}");
Use direct REST requests when you want explicit control over retries, logging, and response metadata in Rust.

Dilution intelligence

// Top 10 highest-dilution-risk issuers
let response = client
    .get("https://api.secapi.ai/v1/dilution/ratings")
    .query(&[("overall_risk", "high"), ("limit", "10")])
    .header("x-api-key", api_key)
    .send()
    .await?
    .error_for_status()?;

// Single-ticker dilution rollup
let response = client
    .get("https://api.secapi.ai/v1/dilution/score")
    .query(&[("ticker", "BBBB")])
    .header("x-api-key", api_key)
    .send()
    .await?
    .error_for_status()?;

// ATM offerings only (boolean filter on the events list)
let response = client
    .get("https://api.secapi.ai/v1/dilution/events")
    .query(&[("ticker", "BBBB"), ("is_atm", "true")])
    .header("x-api-key", api_key)
    .send()
    .await?
    .error_for_status()?;

// Coverage + freshness rollup (no agent shape — already compact)
let response = client
    .get("https://api.secapi.ai/v1/dilution/coverage")
    .query(&[("ticker", "BBBB")])
    .header("x-api-key", api_key)
    .send()
    .await?
    .error_for_status()?;
The full dilution API is available under /v1/dilution/*. Pass ("view", "agent") in list-call query params, except /v1/dilution/coverage, for the compact agent-mode shape.

Copy this SEC API prompt for your agent.

Smoke path

cargo test

API Reference

Open the underlying REST calls for exact request and response details.

Libraries & SDKs

Compare the Rust API with the other runtime options.