Production Tips
Postman Collection
Import the official collection to explore every endpoint with pre-built environments, example payloads, and scripting helpers.
- Download the Near Space Labs Postman collection.
- Import into Postman and set
NSL_ID+NSL_SECRETenv vars. - Hit "Send" to test auth, surveys, coverage, and tile downloads in minutes.
Best Practices
- Use
If-None-Matchheaders when caching tile responses to avoid re-downloads. - Batch coverage queries by AOI to find the minimal set of tiles before downloading.
- Rotate tokens proactively and alert on 401/403 responses to catch expired credentials quickly.
- Cache footprints — geometry rarely changes once a survey is published.
- Page through surveys efficiently — the default page size is 25. Only fetch what you need.
- Use v2 endpoints — legacy
/tile/surveysroutes emit deprecation warnings.
Token Management
import time
class TokenManager:
def __init__(self, nsl_id, nsl_secret):
self.nsl_id = nsl_id
self.nsl_secret = nsl_secret
self.token = None
self.expires_at = 0
def get_token(self):
# Refresh 5 minutes before expiry
if time.time() > self.expires_at - 300:
self.token = get_auth_token(self.nsl_id, self.nsl_secret)
self.expires_at = time.time() + 3600
return self.token
Rate Limits & Performance
- Tokens are valid for 60 minutes.
- The tile service median latency is ~200 ms.
- For bulk downloads, use the coverage endpoint to precompute the tile list, then parallelize fetches.
- Consider using connection pooling (
requests.Session()in Python) for repeated requests.