# DB2 DB2 API

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

This page documents DB2 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).

> **Note: Permissions**
>
> Creating a datastore requires the **Manager** role, plus the **Editor** team permission on at least one of the assigned teams (the **Public** team when `teams` is left out). Admins are exempt.

> **Note: Names are stored in upper case**
>
> Qualytics converts `database` and `schema` to upper case, matching how DB2 stores unquoted
> identifiers. Sending `mydb` records it as `MYDB`. A value written as a Vault reference is left
> exactly as you sent it.

## Creating a Source Datastore

This section provides sample payloads for creating a DB2 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": "db2_database",
    "schema": "db2_schema",
    "enrichment_only": false,
    "trigger_sync": true,
    "connection": {
        "name": "your_connection_name",
        "type": "db2",
        "host": "db2_host",
        "port": 50000,
        "username": "db2_username",
        "password": "db2_password",
        "max_parallelization": 10,
        "parameters": {
            "ssl": true,
            "tls_certificate": "-----BEGIN CERTIFICATE-----\n<server certificate>\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\n<intermediate certificate>\n-----END CERTIFICATE-----"
        }
    }
}
```

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

```json
{
    "name": "your_datastore_name",
    "teams": ["Public"],
    "database": "db2_database",
    "schema": "db2_schema",
    "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 db2 \
    --name "your_connection_name" \
    --host ${DB2_HOST} \
    --port 50000 \
    --username ${DB2_USER} \
    --password ${DB2_PASSWORD}

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

## 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": "db2_database",
    "schema": "db2_enrichment_schema",
    "enrichment_only": true,
    "connection": {
        "name": "your_connection_name",
        "type": "db2",
        "host": "db2_host",
        "port": 50000,
        "username": "db2_username",
        "password": "db2_password",
        "max_parallelization": 10,
        "parameters": {
            "ssl": true,
            "tls_certificate": "-----BEGIN CERTIFICATE-----\n<server certificate>\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\n<intermediate certificate>\n-----END CERTIFICATE-----"
        }
    }
}
```

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

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

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

```bash
# Step 1: Create a Connection
qualytics connections create \
    --type db2 \
    --name "your_connection_name" \
    --host ${DB2_HOST} \
    --port 50000 \
    --username ${DB2_USER} \
    --password ${DB2_PASSWORD}

# Step 2: Create an Enrichment Datastore
qualytics datastores create \
    --name "your_datastore_name" \
    --connection-name "your_connection_name" \
    --database DB2 \
    --schema your_enrichment_schema \
    --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.*
