# Instantiating the SDK client

Whenever you call the Textual SDK, you first instantiate the SDK client.

To work with Textual datasets, or to redact individual files, you instantiate `TonicTextual`.

## Instantiating when the API key is already configured <a href="#api-key-configured" id="api-key-configured"></a>

If the API key is configured as the value of the [environment variable](/textual/textual-install-administer/configuring-textual/textual-env-var-configure.md) `TONIC_TEXTUAL_API_KEY`, then you do not need to provide the API key when you instantiate the SDK client.

For Textual datasets, or to use the `redact` method:

```python
from tonic_textual.redact_api import TextualNer
# The default URL is https://textual.tonic.ai (Textual Cloud)
# If you host Textual, provide your Textual URL
textual = TextualNer()
```

## Instantiating when the API key is not configured <a href="#api-key-not-configured" id="api-key-not-configured"></a>

If the API key is not configured as the value of the [environment variable](/textual/textual-install-administer/configuring-textual/textual-env-var-configure.md) `TONIC_TEXTUAL_API_KEY`, then you must include the API key in the request.

For Textual datasets, or to use the `redact` method:

```python
from tonic_textual.redact_api import TonicTextual
api_key = "your-tonic-textual-api-key"
# The default URL is https://textual.tonic.ai (Textual Cloud)
# If you host Textual, provide your Textual URL
textual = TonicTextual(api_key=api_key)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tonic.ai/textual/tonic-textual-api/textual-api-instantiate-sdk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
