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

# Usage

Here is how to connect and use REST API to MindsDB.

## Local MindsDB

This example shows how to execute SQL statements, either raw or parametrized, on MindsDB via REST APIs.

```
import requests

# connect
url = 'http://127.0.0.1:47334/api/sql/query'

# query
resp = requests.post(url, json={
                "query": "select * from my_datasource.my_table where name = :name and age = :age",
                "params": {"name": "acme", "age": 1},
            })

# response
print(resp.text) # alternative: print(resp.json())
```

Note that you can either send a raw SQL and omit the `params` parameter, or send a parametrized SQL in the `query` parameter and provide the `params` parameter that defines the values.
