# MySQL MySQL API

Source: https://userguide.qualytics.io/source-datastore/datastore/jdbc/mysql/how-tos/api/

This page documents MySQL payloads for the datastore API: sample requests with placeholder values to replace with your own. For generic operations (get, list, update, delete, multi-schema bulk), see [Datastore API](https://userguide.qualytics.io/source-datastore/datastore/api/).

> **Tip: Complete API Reference**
>
> For the full interactive API documentation with all request/response schemas, visit the [API docs](https://userguide.qualytics.io/api/docs).

Each example includes endpoint details, sample payloads, and instructions on how to replace placeholder values with actual data relevant to your setup.

## Creating a Source Datastore

This section provides sample payloads for creating a MySQL datastore. Replace the placeholder values with actual data relevant to your setup.

**Endpoint**: `/api/datastores (post)`

**Tab: Create a Source Datastore with a new Connection**

```json
{
    "name": "your_datastore_name",
    "teams": ["Public"],
    "database": "mysql_database",
    "enrichment_only": false,
    "trigger_sync": true,
    "connection": {
        "name": "your_connection_name",
        "type": "mysql",
        "host": "mysql_host",
        "port": 3306,
        "username": "mysql_username",
        "password": "mysql_password"
    }
}
```

**Tab: Create a Source Datastore with an existing Connection**

```json
{
    "name": "your_datastore_name",
    "teams": ["Public"],
    "database": "mysql_database",
    "enrichment_only": false,
    "trigger_sync": true,
    "connection_id": 123
}
```

**Tab: Create a Source Datastore using the CLI**

```bash
# Step 1: Create a Connection
qualytics connections create \
    --type mysql \
    --name "your_connection_name" \
    --host ${DB_HOST} \
    --port 3306 \
    --username ${DB_USER} \
    --password ${DB_PASSWORD}

# Step 2: Create a Source Datastore
qualytics datastores create \
    --name "your_datastore_name" \
    --connection-name "your_connection_name" \
    --database your_database \
    --schema your_database
```

## Create an Enrichment Datastore

This section provides sample payloads for creating an enrichment datastore. Replace the placeholder values with actual data relevant to your setup.

**Endpoint:** `/api/datastores (post)`

**Tab: Create an Enrichment Datastore with a New Connection**

```json
{
    "name": "your_datastore_name",
    "teams": ["Public"],
    "database": "mysql_database",
    "enrichment_only": true,
    "connection": {
        "name": "your_connection_name",
        "type": "mysql",
        "host": "mysql_host",
        "port": 3306,
        "username": "mysql_username",
        "password": "mysql_password"
    }
}
```

**Tab: Create an Enrichment Datastore with an Existing Connection**

```json
{
    "name": "your_datastore_name",
    "teams": ["Public"],
    "database": "mysql_database",
    "enrichment_only": true,
    "connection_id": 123
}
```

**Tab: Create an Enrichment Datastore using the CLI**

```bash
# Step 1: Create a Connection
qualytics connections create \
    --type mysql \
    --name "your_connection_name" \
    --host ${DB_HOST} \
    --port 3306 \
    --username ${DB_USER} \
    --password ${DB_PASSWORD}

# Step 2: Create an Enrichment Datastore
qualytics datastores create \
    --name "your_datastore_name" \
    --connection-name "your_connection_name" \
    --database your_enrichment_database \
    --schema your_enrichment_database \
    --enrichment-only
```

## Link an Enrichment Destination

Use the provided endpoint to link a datastore to its enrichment destination:

**Endpoint Details:** `/api/datastores/{datastore-id}/enrichment/{enrichment-id} (patch)`

*Last updated: November 16, 2026.*
