SDKs
Install an official Context.dev SDK for TypeScript, Python, Ruby, Go, or PHP, and learn the key, timeout, and retry defaults they share.
Official SDKs wrap the HTTPS API for server-side code. Each language page shows a first request and language-specific notes.
Go uses the /v2 module path, github.com/context-dot-dev/context-go-sdk/v2. The unversioned path is the older v1 SDK, which lacks the current Scrape, Map URLs, and Brand methods.
Set your API key
Every SDK needs an API key and reads CONTEXT_DEV_API_KEY when you don’t pass one to the client:
Keep the key in server-side code. Don’t commit it or ship it to a browser. The Quickstart shows where to get one.
The SDKs don’t send keyless requests. To try Web Search or Web Scrape without a key, use plain HTTP, such as cURL or fetch, or the MCP server.
Timeouts and retries
Scrape’s own deadline defaults to 90,000 ms, and a request’s timeoutOpts.milliseconds can be up to 300,000. For Scrape, Crawl (80,000 ms default budget), or any request with a deadline above 60,000 ms, raise the SDK timeout above that deadline. Otherwise the SDK gives up and retries while the first attempt may still be running: only Scrape and Parse stop when the client disconnects. Each language page shows how to change both settings, and Timeouts covers server deadlines.
Use the low-level request method
SDKs are generated from the API spec and released separately, so an installed version can lag the API. If a typed method doesn’t accept a field you need, send the request with the SDK’s low-level method. It keeps the SDK’s authentication, retries, and error handling.
Check the request body against the API reference before you send it.
Billing errors
402 USAGE_EXCEEDED means the authenticated account cannot cover the operation’s credit cost. Inspect error_data for the balance, required credits, retry condition, and available refill details. Save request_id when investigating a failed request. Use the free usage endpoint or MCP get-usage to inspect the account, and retry once the balance covers the operation. Token refresh and reconnection do not restore credits.
401 means authentication failed. 403 PAID_PLAN_REQUIRED identifies a feature entitlement, and 429 RATE_LIMITED identifies temporary throttling. For concurrency limits, inspect error_data and follow Retry-After before retrying. See billing and concurrency errors for response fields and recovery options.