sec-api-sdk-rust is an async Rust client for querying SEC API filings, companies, filing sections, and search endpoints.
cargo add sec-api-sdk-rust
cargo add tokio --features macros,rt-multi-threadThis is a library crate, so use cargo add in an application rather than cargo install sec-api-sdk-rust, which has no default binary target to install.
Get an API key at secapi.ai/signup, then set it before running your program:
export SECAPI_API_KEY="secapi_live_..."use sec_api_sdk_rust::{LatestFilingRequest, SecApiClient};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = SecApiClient::new(None);
let filing = client
.latest_filing_with(&LatestFilingRequest::new().ticker("AAPL").form("10-K"))
.await?;
println!("{filing}");
Ok(())
}The request calls GET /v1/filings/latest?ticker=AAPL&form=10-K and prints the JSON response for the latest matching filing. Its contents can change when a newer filing is available.
SecApiClient::new(None) reads SECAPI_API_KEY and sends it in the x-api-key request header. To provide a key directly, use SecApiClient::new(Some("secapi_live_...".to_owned())). The client also supports SECAPI_BEARER_TOKEN for bearer-token authentication.
Methods return Result<serde_json::Value, SecApiError>. For a non-2xx response, inspect status(), code(), message(), request_id(), and body() on SecApiError; include the request ID when contacting support. By default, GET and text GET requests retry transport failures and HTTP 408, 429, 502, 503, and 504; POST requests retry only HTTP 429; DELETE requests are not retried.
For other endpoints, pagination, and request parameters, see the API documentation. Report SDK issues or request help in the Rust SDK repository. For declared edition and dependency compatibility, see Cargo.toml.
MIT