Space-Track.org enforces rate limits of 30 requests per minute and 300 requests per hour. Exceeding these limits results in temporary account suspension. Brahe's RateLimitConfig controls a sliding-window rate limiter built into SpaceTrackClient that automatically delays requests to stay within the configured thresholds.
By default, the client uses conservative limits of 25 requests per minute and 250 requests per hour (~83% of the actual limits), providing safety margin for clock drift and shared accounts. Most users do not need to configure rate limiting at all -- the defaults are applied automatically.
usebraheasbh;usebh::spacetrack::{RateLimitConfig,SpaceTrackClient};fnmain(){// Default conservative limits (25/min, 250/hour)letconfig=RateLimitConfig::default();println!("Default config: {}/min, {}/hour",config.max_per_minute,config.max_per_hour);// Default config: 25/min, 250/hour// Custom limitsletconfig=RateLimitConfig{max_per_minute:10,max_per_hour:100,};println!("Custom config: {}/min, {}/hour",config.max_per_minute,config.max_per_hour);// Custom config: 10/min, 100/hour// Disable rate limiting entirelyletconfig=RateLimitConfig::disabled();println!("Disabled config: {}/min, {}/hour",config.max_per_minute,config.max_per_hour);// Disabled config: 4294967295/min, 4294967295/hour// Create a client with default rate limiting (no config needed)let_client=SpaceTrackClient::new("user@example.com","password");println!("\nClient with default rate limiting created");// Client with default rate limiting created// Create a client with custom rate limitingletconfig=RateLimitConfig{max_per_minute:10,max_per_hour:100,};let_client=SpaceTrackClient::with_rate_limit("user@example.com","password",config);println!("Client with custom rate limiting created");// Client with custom rate limiting created// Create a client with rate limiting disabledletconfig=RateLimitConfig::disabled();let_client=SpaceTrackClient::with_rate_limit("user@example.com","password",config);println!("Client with disabled rate limiting created");// Client with disabled rate limiting created}
Defaults Are Automatic
Creating a SpaceTrackClient without specifying a RateLimitConfig applies the default conservative limits (25/min, 250/hour). You only need RateLimitConfig if you want to change or disable the limits.
The rate limiter tracks request timestamps in two sliding windows (1-minute and 1-hour). Before each HTTP request, the client checks whether the configured limit has been reached in either window. If a limit would be exceeded, the calling thread sleeps until enough time has passed for the oldest request in the window to expire. This is transparent to the caller -- queries simply take longer when the limit is approached.
The limiter applies to all client operations: authentication, queries, file operations, and public file downloads.