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

> ## Agent Instructions
> getclean's own MCP server is at https://mcp.getclean.ai/mcp. The /mcp path of this docs site is Mintlify's search over these pages, not getclean.
> Every answer of the API opens with outcome. A page that could not be read is a record whose outcome says why, never an HTTP error; read outcome before anything else.
> The API's contract is the OpenAPI 3.1 file at https://docs.getclean.ai/openapi.yaml; the SDKs are generated from it.
> The product's name is written getclean, in lower case.

# The getclean SDKs

> Five SDKs generated from the same contract, so every operation is a method with the API's own name and the API's own fields. This page says what every SDK does for you, how to install each one, and where the Python and TypeScript guides go from here.

getclean's SDKs for Python, TypeScript, Java, Go and C# are generated from the API's OpenAPI contract. That gives you the same thing in every language: each of the 22 operations is a method with the operation's own name, its fields are the fields the [API reference](https://docs.getclean.ai/api-reference/overview.md) lists, and its answer is a typed object whose members are the record's members. Every docstring is the operation's description from the contract, word for word, so your editor shows you the same text as the reference. On top of the generated code, each SDK carries a small hand-written layer for the things a research agent would otherwise write itself.

The release starts with Python and TypeScript. Java, Go and C# are generated from the same contract and follow.

## Install

```bash Python icon="https://mintcdn.com/getclean/tbR1dNv6q4hMPv6b/marks/python.svg?fit=max&auto=format&n=tbR1dNv6q4hMPv6b&q=85&s=c665e9b399eafe327329b01bf1ccbd98" theme={"theme":"css-variables"}
pip install getclean
```

```bash TypeScript icon="https://mintcdn.com/getclean/tbR1dNv6q4hMPv6b/marks/typescript.svg?fit=max&auto=format&n=tbR1dNv6q4hMPv6b&q=85&s=1eb812c7499287110cf94d657452e8f8" theme={"theme":"css-variables"}
npm install getclean
```

```bash Java icon="https://mintcdn.com/getclean/tbR1dNv6q4hMPv6b/marks/java.svg?fit=max&auto=format&n=tbR1dNv6q4hMPv6b&q=85&s=535915e5a04da4f9a92cf4b9e9754b86" theme={"theme":"css-variables"}
# Maven Central: ai.getclean:getclean
```

```bash Go icon="https://mintcdn.com/getclean/tbR1dNv6q4hMPv6b/marks/go.svg?fit=max&auto=format&n=tbR1dNv6q4hMPv6b&q=85&s=793c5aa0c9dbc82572415bfdc11a5fc6" theme={"theme":"css-variables"}
go get github.com/deterministic-labs/getclean-go
```

```bash title="C#" icon="https://mintcdn.com/getclean/tbR1dNv6q4hMPv6b/marks/csharp.svg?fit=max&auto=format&n=tbR1dNv6q4hMPv6b&q=85&s=4cfd76f6d2dacd68b77b6b1f86409d60" theme={"theme":"css-variables"}
dotnet add package GetClean
```

Each SDK lives in its own repository under `github.com/deterministic-labs`, under the MIT licence.

## What every SDK does for you

| What | How |
| - | - |
| The credential | The client reads `GETCLEAN_API_KEY` when you don't pass a key. A client built with no key at all fails right away with the SDK's own configuration error, before any request leaves, so a missing key never looks like a network problem. You can pass a function that returns an access token instead of a key; the SDK calls it when it needs a credential and never refreshes a token itself. |
| The address | `https://api.getclean.ai`, or whatever `GETCLEAN_BASE_URL` says. |
| Idempotency keys | On the eight operations that take `Idempotency-Key`, the SDK generates one per request when you don't give one, and sends the same key on every retry of that request. A retry is never charged twice. Give your own key when your program may repeat a request after a crash. |
| Retries | A `429`, a `502`, a `503` and a `504` are retried, up to five attempts in all, with a backoff that starts at one second and doubles to a ceiling of 30 seconds, plus jitter. When the response carries `Retry-After` within that ceiling, the SDK waits exactly that long. A `409 idempotency-key-in-flight`, which means the first attempt is still running, is retried the same way with the same key. A `Retry-After` beyond the ceiling ends the retries, and the response reaches your code as it arrived, with `retry_after_seconds` in its body. |
| Timeouts | One attempt gets 120 seconds until the client has read your limits, which it does once before the first request that can be charged. From then on each family's timeout is the API's own `call_seconds` bound plus ten seconds, so a fetch and a batch each get the time the API itself allows. A timeout you set on a request stands. |
| Pages | Every list operation returns a pager that reads the next page as you go: `list_contents`, `list_jobs`, `list_blocks`, `list_links`, `list_datasources`, `get_search` and `compare_contents`. The page's own members, such as a record's `fingerprint` on a page of blocks, are on the pager's response. On `list_contents` and `list_jobs`, an item that appears twice because something was created while you paged is dropped for you. |
| Long sections | A section too long for one response comes in pages, and the SDK walks them for you with `iter_section`. |
| Uploads | A document goes in as a path, as bytes or as a stream. With `wait`, the SDK follows an upload that runs as a job until the record exists and returns it, or raises the problem the job ended with. |
| Outcomes | A page that couldn't be read is never an exception. The API answers `201` with a record, and the record's `outcome` says why. Only a problem, the API's own refusal, raises or throws, as a typed error per status that carries the `Problem`. |
| Headers | The request id, the rate limit headers and `Retry-After` are read for you. `traceparent` goes through each SDK's per-request options. The User-Agent names the SDK and its version, and nothing else. |

There's no streaming and there are no webhooks, because the API is designed so you don't need them: `get_job` waits for a job on the server side for as long as you ask, and the SDK's `wait` does the rest.

## The client in each language

```python Python icon="https://mintcdn.com/getclean/tbR1dNv6q4hMPv6b/marks/python.svg?fit=max&auto=format&n=tbR1dNv6q4hMPv6b&q=85&s=c665e9b399eafe327329b01bf1ccbd98" theme={"theme":"css-variables"}
from getclean import GetClean

client = GetClean()  # reads GETCLEAN_API_KEY
record = client.fetch_contents(url="https://example.com/q3")
print(record.outcome.kind)
```

```typescript TypeScript icon="https://mintcdn.com/getclean/tbR1dNv6q4hMPv6b/marks/typescript.svg?fit=max&auto=format&n=tbR1dNv6q4hMPv6b&q=85&s=1eb812c7499287110cf94d657452e8f8" theme={"theme":"css-variables"}
import { GetClean } from "getclean";

const client = new GetClean({}); // reads GETCLEAN_API_KEY
const record = await client.fetchContents({ url: "https://example.com/q3" });
console.log(record.outcome.kind);
```

```java Java icon="https://mintcdn.com/getclean/tbR1dNv6q4hMPv6b/marks/java.svg?fit=max&auto=format&n=tbR1dNv6q4hMPv6b&q=85&s=535915e5a04da4f9a92cf4b9e9754b86" theme={"theme":"css-variables"}
GetClean client = GetClean.builder().build(); // reads GETCLEAN_API_KEY
Contents record = client.fetchContents(
    FetchContentsRequest.builder().url("https://example.com/q3").build());
System.out.println(record.getOutcome().getKind());
```

```go Go icon="https://mintcdn.com/getclean/tbR1dNv6q4hMPv6b/marks/go.svg?fit=max&auto=format&n=tbR1dNv6q4hMPv6b&q=85&s=793c5aa0c9dbc82572415bfdc11a5fc6" theme={"theme":"css-variables"}
c := getclean.NewClient() // reads GETCLEAN_API_KEY
record, err := c.FetchContents(ctx, &getclean.FetchContentsRequest{URL: "https://example.com/q3"})
if err != nil { return err }
fmt.Println(record.Outcome.Kind)
```

```csharp title="C#" icon="https://mintcdn.com/getclean/tbR1dNv6q4hMPv6b/marks/csharp.svg?fit=max&auto=format&n=tbR1dNv6q4hMPv6b&q=85&s=4cfd76f6d2dacd68b77b6b1f86409d60" theme={"theme":"css-variables"}
var client = new GetCleanClient(); // reads GETCLEAN_API_KEY
var record = await client.FetchContentsAsync(new FetchContentsRequest { Url = "https://example.com/q3" });
Console.WriteLine(record.Outcome.Kind);
```

The two guides that follow go through everything a research agent needs from the SDK, in the order it needs it: the credential, the first fetch and how to read it, the research loop in code, reading a record again for free, uploads and jobs, errors, retries and budgets.

> [card] [Python](https://docs.getclean.ai/sdks/python.md)
>
> Keyword arguments, pagers you loop over, typed errors per status, a sync and an async client.

> [card] [TypeScript](https://docs.getclean.ai/sdks/typescript.md)
>
> One request object per call, optional members the compiler makes you check, pagers you read with for await.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.