> For the complete documentation index, see [llms.txt](https://docs.soda.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.soda.io/reference/soda-apis/rest-api.md).

# REST API

| **Cloud EU:** | ​<https://cloud.soda.io>​    |
| ------------- | ---------------------------- |
| **Cloud US:** | ​<https://cloud.us.soda.io>​ |

### Connect to the Soda Cloud API

The following example demonstrates how to connect to the Soda Cloud API using **Python**.

#### Requirements

* A **Soda Cloud account**
* **Python 3+**
* **Recommended:** A `.env` file containing `API_KEY_ID` and `API_KEY_SECRET`\
  Example of `.env`:

```
## Replace the following with your credentials
API_KEY_ID=333c3c33-3c33-3c3c-cccc-3c3c3333c333
API_KEY_SECRET=CcC3cCC3C_CCCc33cCC3cCcCC333c_C3Cc3C333CC33cCCC--33cCcC
```

> Learn how to [Broken mention](broken://pages/H6Piqnv5lUFCAv1Cvm75).

#### Example connection

You can use this example as a starting point for integrating Soda into your workflows, ensuring that you **replace placeholders** with your own credentials and project-specific details. In one `.py` file, you can:

1. Create a working session
2. Send a POST request
3. Send a GET request

```python
## 1. Create a working session
from dotenv import load_dotenv
import os
import json
import requests
import base64

# (Recommended) Load environment variables from a .env file
load_dotenv()
api_key_id = os.getenv("API_KEY_ID")
api_key_secret = os.getenv("API_KEY_SECRET")

# Create token from your credentials
TOKEN = base64.b64encode(f"{api_key_id}:{api_key_secret}".encode()).decode()

HOST = "cloud.us.soda.io"                  # Or "cloud.soda.io"
HEADERS = {"Authorization": f"Basic {TOKEN}", "Content-Type": "application/json"}

datasetId = "<YOUR_DATASET_ID>"            # Replace with your details
data = {"key": "value", "key2": "value2"}  # Replace with your details
```

```python
## 2. Send a POST request to create or update data for the specified dataset
response = requests.post(
    f"https://{HOST}/api/v1/datasets/{datasetId}",
    headers=HEADERS,
    json=data
)
print(response.json())
```

```python
## 3. Send a GET request to retrieve check results or details
response = requests.get(
    f"https://{HOST}/api/v1/checks",
    headers=HEADERS,
    params={"checkIds": ["abcd"]}          ## (optional) Replace with your details
)
print(response.json())
```

<br>

***

{% if (visitor.claims.plan === 'datasetStandard')%}
{% hint style="success" %}
You are **logged in to Soda** and seeing the **Dataset Standard license** documentation. Learn more about [Documentation access & licensing](/reference/documentation-access-and-licensing.md).
{% endhint %}
{% endif %}

{% if (visitor.claims.plan === 'enterprise')%}
{% hint style="success" %}
You are **logged in to Soda** and seeing the **Team license** documentation. Learn more about [Documentation access & licensing](/reference/documentation-access-and-licensing.md).
{% endhint %}
{% endif %}

{% if (visitor.claims.plan === 'enterpriseUserBased')%}
{% hint style="success" %}
You are **logged in to Soda** and seeing the **Enterprise license** documentation. Learn more about [Documentation access & licensing](/reference/documentation-access-and-licensing.md).
{% endhint %}
{% endif %}

{% if !(visitor.claims.plan === 'enterprise' || visitor.claims.plan === 'enterpriseUserBased' || visitor.claims.plan === 'datasetStandard')%}
{% hint style="info" %}
You are **not logged in to Soda** and are viewing the default public documentation. Learn more about [Documentation access & licensing](/reference/documentation-access-and-licensing.md).

If you do have a Soda license, make sure to **log in to Soda Cloud in this same browser**.
{% endhint %}
{% endif %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.soda.io/reference/soda-apis/rest-api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
