> 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

The Soda Cloud API enables you to trigger actions and query data in your Soda Cloud account.

| **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 [Generate API keys](/reference/soda-apis/generate-api-keys.md).

#### 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())
```

***

{% hint style="info" %}
You are **not logged in to Soda** and are viewing the default public documentation. Learn more about [Licensing & documentation access](/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 %}


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
