StockFlow API Quick Start
Exclusive stock content for CIS. Integrate regional video, photo, and audio assets into your applications in under five minutes.
Step 1: Retrieve Your API Credentials
Access requires a developer token tied to your StockFlow enterprise account. Navigate to the Dashboard under Settings > Integrations to generate a new `sk_live_` or `sk_test_` key. Keys are scoped by permission level (read_media, upload_asset, manage_collections) and expire after 90 days of inactivity.
Your production keys are prefixed with `sk_live_` and should never be committed to public repositories. Use environment variables like `STOCKFLOW_API_KEY` in your deployment pipeline. Rate limits default to 1,200 requests per minute for standard tiers and scale to 5,000 RPM for enterprise contracts. Failed authentication attempts trigger a `401 Unauthorized` response with a `retry_after` header.
Step 2: Execute Your First Media Query
Authenticate every endpoint by attaching your token to the `Authorization` header. The `/v2/search` endpoint accepts JSON payloads with filters for resolution, duration, license type, and geographic metadata.
curl -X POST https://api.stockflow.io/v2/search \
-H "Authorization: Bearer sk_live_9f8a7b6c5d4e3f2a1b0c" \
-H "Content-Type: application/json" \
-d '{
"query": "urban infrastructure snow",
"media_type": "video",
"min_duration_sec": 15,
"license": "commercial",
"region": "CIS"
}'
A successful response returns a `results` array containing asset IDs, preview URLs, and metadata. Use the `next_page` cursor to paginate through batches of 50 items. The `status: 200` response includes a `request_id` for debugging rate limit or quota issues. Download links expire after 24 hours and require a separate `GET /v2/assets/{id}/download` call.
Step 3: Install the Official SDK
Accelerate development with the StockFlow client libraries for Python, Node.js, and Go. The SDKs handle authentication rotation, automatic retries, and response parsing out of the box.
Python
pip install stockflow-python
Supports async/await, strict type hints, and automatic pagination. Compatible with Python 3.9+ and includes a CLI for bulk asset export.
Node.js
npm install @stockflow/js-sdk
Built for Deno and Node 18+. Includes stream-based download handlers, webhook signature verification, and TypeScript definitions.
Go
go get github.com/stockflow/go-client
Concurrency-safe connection pooling with context-aware timeouts. Ideal for high-throughput asset pipelines and Kubernetes deployments.
After installation, initialize the client with your environment variable. The SDK automatically retries failed requests using exponential backoff and caps concurrent downloads at 8 per worker thread to respect fair usage policies. Enable debug logging by setting `STOCKFLOW_LOG_LEVEL=trace`.