> ## Documentation Index
> Fetch the complete documentation index at: https://docs.context.dev/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Setting up Context.dev for a user? Follow https://docs.context.dev/agent-quickstart.md. MCP clients sign in with OAuth and need no API key; application code reads CONTEXT_DEV_API_KEY.

# 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.

| Language | Package | Install | Requires |
| - | - | - | - |
| [JavaScript / TypeScript](/sdks/typescript) | [`context.dev`](https://www.npmjs.com/package/context.dev) | `npm install context.dev` | Node.js 20+ |
| [Python](/sdks/python) | [`context.dev`](https://pypi.org/project/context.dev/) | `pip install context.dev` | Python 3.9+ |
| [Ruby](/sdks/ruby) | [`context.dev`](https://rubygems.org/gems/context.dev) | `gem install context.dev` | Ruby 3.2+ |
| [Go](/sdks/go) | [`context-go-sdk/v2`](https://github.com/context-dot-dev/context-go-sdk) | `go get github.com/context-dot-dev/context-go-sdk/v2` | Go 1.22+ |
| [PHP](/sdks/php) | [`context-dev/context-dev-php`](https://github.com/context-dot-dev/context-php-sdk) | `composer require context-dev/context-dev-php guzzlehttp/guzzle` | PHP 8.1+ |

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 reads `CONTEXT_DEV_API_KEY` when you don't pass a key to the client:

```bash theme={null}
export CONTEXT_DEV_API_KEY="ctxt_secret_..."
```

Keep the key in server-side code. Don't commit it or ship it to a browser. The [Quickstart](/quickstart) shows where to get one.

## Timeouts and retries

* TypeScript, Python, Ruby, and PHP wait up to 60 seconds for each attempt. Go has no default timeout.
* All five SDKs retry twice, with exponential backoff, after connection errors and `408`, `409`, `429`, or `5xx` responses.

A request's `timeoutOpts.milliseconds` can be up to 300,000. If you set it above 60,000, raise the SDK timeout as well. Otherwise the SDK gives up and retries while the first attempt may still be running: only Scrape stops when the client disconnects. Each language page shows how to change both settings, and [Timeouts](/optimization/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.

| Language | Low-level request |
| - | - |
| TypeScript | `client.post("/web/scrape", { body })` |
| Python | `client.post("/web/scrape", body=body, cast_to=dict[str, object])` |
| Ruby | `client.request(method: :post, path: "web/scrape", body: body)` |
| Go | `client.Post(ctx, "/web/scrape", body, &response)` |
| PHP | `$client->request(method: 'post', path: 'web/scrape', body: $body)` |

Check the request body against the [API reference](/api-reference/web-scraping/scrape) before you send it.
