---
title: "Databases and private networks"
description: "Context4 data-source connections and private networks: schema discovery, network attachments and access management through the API."
group: "Technical documentation"
order: 33
---

## Deployment addresses

- Documentation: https://ctx4.me/docs.md
- Agent index: https://ctx4.me/docs/agent-index.json
- Console and connections: https://console.ctx4.me/integrations
- MCP: https://ctx4.me/mcp
- HTTP API: https://ctx4.me/v1
- Composio base URL: https://ctx4.me/compat/context4/v1
- OpenAPI: https://ctx4.me/docs/openapi.json
- HTTP/MCP inventory: https://ctx4.me/docs/api-index.json
- Composio routes: https://ctx4.me/docs/compat-routes.json
- Connectors: https://ctx4.me/docs/connectors.json


# Databases and private networks

Generated from the public Context4 OpenAPI. Authenticate with `Authorization: Bearer` and an API key. General rules: [API](https://ctx4.me/docs/api.md). Full contract: [OpenAPI JSON](https://ctx4.me/docs/openapi.json). In the JSON below, `$ref` points to a named schema in the Schemas section.

## setNetworkAttachmentConnectivity

`PATCH /v1/network-attachments/{networkAttachmentId}/connectivity`

Deployment URL: `https://ctx4.me/v1/network-attachments/{networkAttachmentId}/connectivity`. Replace parameters in braces with actual IDs from the API.

Disconnect or reconnect a private-network attachment

Capability: `connections:write`.

### Parameters

| Name | Location | Required | Type and constraints |
| --- | --- | --- | --- |
| `networkAttachmentId` | path | yes | &#123;"type":"string","format":"uuid","example":"9b2f6f2e-4b0a-4bd2-8b7e-3f8a1c2d4e5f"&#125;  |

### Request body

Required. 

```json
{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "expected_version": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "enabled": {
            "type": "boolean"
          }
        },
        "required": [
          "expected_version",
          "enabled"
        ],
        "additionalProperties": false
      }
    }
  }
}
```

### Responses and errors

| HTTP | Meaning | Format and schema |
| --- | --- | --- |
| 200 | Persisted connectivity intent; status reason reports operator acknowledgement | `application/json` [NetworkAttachment](https://ctx4.me/docs/api-schemas-2.md#networkattachment) |
| 400 | Problem (validation_failed) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 401 | Problem (authentication_required, invalid_api_key, api_key_expired, api_key_revoked) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 403 | Problem (capability_missing) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 404 | Problem (not_found) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 409 | Problem (conflict) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 429 | Problem (rate_limited) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 500 | Problem (internal) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 503 | Problem (service_unavailable) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |

Successful response headers:
```json
{
  "X-Request-Id": {
    "description": "Correlation id echoed on every response",
    "schema": {
      "type": "string"
    }
  },
  "RateLimit-Limit": {
    "description": "Per-key request limit for the current window",
    "schema": {
      "type": "integer"
    }
  },
  "RateLimit-Remaining": {
    "description": "Requests remaining in the current window",
    "schema": {
      "type": "integer"
    }
  },
  "RateLimit-Reset": {
    "description": "Seconds until the current window resets",
    "schema": {
      "type": "integer"
    }
  }
}
```

## listNetworkAttachments

`GET /v1/network-attachments`

Deployment URL: `https://ctx4.me/v1/network-attachments`. Replace parameters in braces with actual IDs from the API.

List private-network attachments

Capability: `connections:read`.

### Parameters

| Name | Location | Required | Type and constraints |
| --- | --- | --- | --- |
| `cursor` | query | no | &#123;"type":"string","minLength":1,"maxLength":400,"pattern":"^[A-Za-z0-9_-]+$","description":"Opaque pagination cursor from a previous response"&#125; Opaque pagination cursor from a previous response |
| `limit` | query | no | &#123;"type":"integer","minimum":1,"maximum":100,"description":"Page size (1-100, default 20)"&#125; Page size (1-100, default 20) |

### Responses and errors

| HTTP | Meaning | Format and schema |
| --- | --- | --- |
| 200 | Tenant-scoped secret-free attachment views | `application/json` [NetworkAttachmentList](https://ctx4.me/docs/api-schemas-2.md#networkattachmentlist) |
| 400 | Problem (validation_failed) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 401 | Problem (authentication_required, invalid_api_key, api_key_expired, api_key_revoked) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 403 | Problem (capability_missing) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 429 | Problem (rate_limited) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 500 | Problem (internal) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 503 | Problem (service_unavailable) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |

Successful response headers:
```json
{
  "X-Request-Id": {
    "description": "Correlation id echoed on every response",
    "schema": {
      "type": "string"
    }
  },
  "RateLimit-Limit": {
    "description": "Per-key request limit for the current window",
    "schema": {
      "type": "integer"
    }
  },
  "RateLimit-Remaining": {
    "description": "Requests remaining in the current window",
    "schema": {
      "type": "integer"
    }
  },
  "RateLimit-Reset": {
    "description": "Seconds until the current window resets",
    "schema": {
      "type": "integer"
    }
  }
}
```

## createNetworkAttachment

`POST /v1/network-attachments`

Deployment URL: `https://ctx4.me/v1/network-attachments`. Replace parameters in braces with actual IDs from the API.

Create a typed direct, WireGuard, or OpenVPN attachment

Capability: `connections:write`.

### Parameters

| Name | Location | Required | Type and constraints |
| --- | --- | --- | --- |
| `Idempotency-Key` | header | yes | &#123;"type":"string"&#125; Client-chosen key (8-128 chars of [A-Za-z0-9._:-]); replays with the same payload return the original outcome |

### Request body

Required. [CreateNetworkAttachmentRequest](https://ctx4.me/docs/api-schemas-2.md#createnetworkattachmentrequest)

```json
{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/CreateNetworkAttachmentRequest"
      }
    }
  }
}
```

### Responses and errors

| HTTP | Meaning | Format and schema |
| --- | --- | --- |
| 201 | Created attachment; private credentials are never returned | `application/json` [NetworkAttachment](https://ctx4.me/docs/api-schemas-2.md#networkattachment) |
| 400 | Problem (validation_failed) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 401 | Problem (authentication_required, invalid_api_key, api_key_expired, api_key_revoked) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 403 | Problem (capability_missing) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 409 | Problem (conflict) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 429 | Problem (rate_limited) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 500 | Problem (internal) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 503 | Problem (service_unavailable) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |

Successful response headers:
```json
{
  "X-Request-Id": {
    "description": "Correlation id echoed on every response",
    "schema": {
      "type": "string"
    }
  },
  "RateLimit-Limit": {
    "description": "Per-key request limit for the current window",
    "schema": {
      "type": "integer"
    }
  },
  "RateLimit-Remaining": {
    "description": "Requests remaining in the current window",
    "schema": {
      "type": "integer"
    }
  },
  "RateLimit-Reset": {
    "description": "Seconds until the current window resets",
    "schema": {
      "type": "integer"
    }
  }
}
```

## getNetworkAttachment

`GET /v1/network-attachments/{networkAttachmentId}`

Deployment URL: `https://ctx4.me/v1/network-attachments/{networkAttachmentId}`. Replace parameters in braces with actual IDs from the API.

Get one private-network attachment

Capability: `connections:read`.

### Parameters

| Name | Location | Required | Type and constraints |
| --- | --- | --- | --- |
| `networkAttachmentId` | path | yes | &#123;"type":"string","format":"uuid","example":"9b2f6f2e-4b0a-4bd2-8b7e-3f8a1c2d4e5f"&#125;  |

### Responses and errors

| HTTP | Meaning | Format and schema |
| --- | --- | --- |
| 200 | Secret-free attachment health and desired state | `application/json` [NetworkAttachment](https://ctx4.me/docs/api-schemas-2.md#networkattachment) |
| 400 | Problem (validation_failed) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 401 | Problem (authentication_required, invalid_api_key, api_key_expired, api_key_revoked) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 403 | Problem (capability_missing) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 404 | Problem (not_found) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 429 | Problem (rate_limited) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 500 | Problem (internal) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 503 | Problem (service_unavailable) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |

Successful response headers:
```json
{
  "X-Request-Id": {
    "description": "Correlation id echoed on every response",
    "schema": {
      "type": "string"
    }
  },
  "RateLimit-Limit": {
    "description": "Per-key request limit for the current window",
    "schema": {
      "type": "integer"
    }
  },
  "RateLimit-Remaining": {
    "description": "Requests remaining in the current window",
    "schema": {
      "type": "integer"
    }
  },
  "RateLimit-Reset": {
    "description": "Seconds until the current window resets",
    "schema": {
      "type": "integer"
    }
  }
}
```

## updateNetworkAttachment

`PATCH /v1/network-attachments/{networkAttachmentId}`

Deployment URL: `https://ctx4.me/v1/network-attachments/{networkAttachmentId}`. Replace parameters in braces with actual IDs from the API.

Replace the approved destination policy

Capability: `connections:write`.

### Parameters

| Name | Location | Required | Type and constraints |
| --- | --- | --- | --- |
| `networkAttachmentId` | path | yes | &#123;"type":"string","format":"uuid","example":"9b2f6f2e-4b0a-4bd2-8b7e-3f8a1c2d4e5f"&#125;  |

### Request body

Required. 

```json
{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "dns_servers": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "ip"
                },
                {
                  "type": "string",
                  "format": "ip"
                }
              ]
            },
            "maxItems": 3
          },
          "expected_version": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "destinations": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "host": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 253,
                  "pattern": "^(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\\.)*[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$"
                },
                "port": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 65535
                }
              },
              "required": [
                "host",
                "port"
              ],
              "additionalProperties": false
            },
            "minItems": 1,
            "maxItems": 64
          }
        },
        "required": [
          "expected_version",
          "destinations"
        ],
        "additionalProperties": false
      }
    }
  }
}
```

### Responses and errors

| HTTP | Meaning | Format and schema |
| --- | --- | --- |
| 200 | Updated desired generation | `application/json` [NetworkAttachment](https://ctx4.me/docs/api-schemas-2.md#networkattachment) |
| 400 | Problem (validation_failed) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 401 | Problem (authentication_required, invalid_api_key, api_key_expired, api_key_revoked) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 403 | Problem (capability_missing) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 404 | Problem (not_found) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 409 | Problem (conflict) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 429 | Problem (rate_limited) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 500 | Problem (internal) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 503 | Problem (service_unavailable) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |

Successful response headers:
```json
{
  "X-Request-Id": {
    "description": "Correlation id echoed on every response",
    "schema": {
      "type": "string"
    }
  },
  "RateLimit-Limit": {
    "description": "Per-key request limit for the current window",
    "schema": {
      "type": "integer"
    }
  },
  "RateLimit-Remaining": {
    "description": "Requests remaining in the current window",
    "schema": {
      "type": "integer"
    }
  },
  "RateLimit-Reset": {
    "description": "Seconds until the current window resets",
    "schema": {
      "type": "integer"
    }
  }
}
```

## revokeNetworkAttachment

`DELETE /v1/network-attachments/{networkAttachmentId}`

Deployment URL: `https://ctx4.me/v1/network-attachments/{networkAttachmentId}`. Replace parameters in braces with actual IDs from the API.

Drain and revoke a private-network attachment

Capability: `connections:write`.

### Parameters

| Name | Location | Required | Type and constraints |
| --- | --- | --- | --- |
| `networkAttachmentId` | path | yes | &#123;"type":"string","format":"uuid","example":"9b2f6f2e-4b0a-4bd2-8b7e-3f8a1c2d4e5f"&#125;  |
| `expected_version` | query | yes | &#123;"type":"integer","exclusiveMinimum":0&#125;  |

### Responses and errors

| HTTP | Meaning | Format and schema |
| --- | --- | --- |
| 200 | Draining or ready-to-revoke attachment | `application/json` [NetworkAttachment](https://ctx4.me/docs/api-schemas-2.md#networkattachment) |
| 400 | Problem (validation_failed) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 401 | Problem (authentication_required, invalid_api_key, api_key_expired, api_key_revoked) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 403 | Problem (capability_missing) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 404 | Problem (not_found) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 409 | Problem (conflict) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 429 | Problem (rate_limited) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 500 | Problem (internal) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 503 | Problem (service_unavailable) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |

Successful response headers:
```json
{
  "X-Request-Id": {
    "description": "Correlation id echoed on every response",
    "schema": {
      "type": "string"
    }
  },
  "RateLimit-Limit": {
    "description": "Per-key request limit for the current window",
    "schema": {
      "type": "integer"
    }
  },
  "RateLimit-Remaining": {
    "description": "Requests remaining in the current window",
    "schema": {
      "type": "integer"
    }
  },
  "RateLimit-Reset": {
    "description": "Seconds until the current window resets",
    "schema": {
      "type": "integer"
    }
  }
}
```

## discoverSavedDatabases

`POST /v1/data-source-connections/{dataSourceConnectionId}/discover-databases`

Deployment URL: `https://ctx4.me/v1/data-source-connections/{dataSourceConnectionId}/discover-databases`. Replace parameters in braces with actual IDs from the API.

Discover databases using a stored, tenant-owned connection

Capability: `connections:write`.

### Parameters

| Name | Location | Required | Type and constraints |
| --- | --- | --- | --- |
| `dataSourceConnectionId` | path | yes | &#123;"type":"string","format":"uuid","example":"9b2f6f2e-4b0a-4bd2-8b7e-3f8a1c2d4e5f"&#125;  |

### Responses and errors

| HTTP | Meaning | Format and schema |
| --- | --- | --- |
| 200 | Bounded database catalog without returning credentials | `application/json` [DiscoverPostgresDatabasesResponse](https://ctx4.me/docs/api-schemas-2.md#discoverpostgresdatabasesresponse) |
| 400 | Problem (validation_failed) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 401 | Problem (authentication_required, invalid_api_key, api_key_expired, api_key_revoked) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 403 | Problem (capability_missing, forbidden) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 404 | Problem (not_found) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 429 | Problem (rate_limited) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 500 | Problem (internal) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 503 | Problem (service_unavailable) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |

Successful response headers:
```json
{
  "X-Request-Id": {
    "description": "Correlation id echoed on every response",
    "schema": {
      "type": "string"
    }
  },
  "RateLimit-Limit": {
    "description": "Per-key request limit for the current window",
    "schema": {
      "type": "integer"
    }
  },
  "RateLimit-Remaining": {
    "description": "Requests remaining in the current window",
    "schema": {
      "type": "integer"
    }
  },
  "RateLimit-Reset": {
    "description": "Seconds until the current window resets",
    "schema": {
      "type": "integer"
    }
  }
}
```

## addDatabaseFromConnection

`POST /v1/data-source-connections/{dataSourceConnectionId}/databases`

Deployment URL: `https://ctx4.me/v1/data-source-connections/{dataSourceConnectionId}/databases`. Replace parameters in braces with actual IDs from the API.

Add a database using the stored server credential

Capability: `connections:write`.

### Parameters

| Name | Location | Required | Type and constraints |
| --- | --- | --- | --- |
| `Idempotency-Key` | header | yes | &#123;"type":"string"&#125; Client-chosen key (8-128 chars of [A-Za-z0-9._:-]); replays with the same payload return the original outcome |
| `dataSourceConnectionId` | path | yes | &#123;"type":"string","format":"uuid","example":"9b2f6f2e-4b0a-4bd2-8b7e-3f8a1c2d4e5f"&#125;  |

### Request body

Required. [AddDatabaseFromConnectionRequest](https://ctx4.me/docs/api-schemas-2.md#adddatabasefromconnectionrequest)

```json
{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/AddDatabaseFromConnectionRequest"
      }
    }
  }
}
```

### Responses and errors

| HTTP | Meaning | Format and schema |
| --- | --- | --- |
| 201 | Independent database connection with its own revocable secret | `application/json` [DataSourceConnection](https://ctx4.me/docs/api-schemas-2.md#datasourceconnection) |
| 400 | Problem (validation_failed) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 401 | Problem (authentication_required, invalid_api_key, api_key_expired, api_key_revoked) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 403 | Problem (capability_missing, forbidden) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 404 | Problem (not_found) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 409 | Problem (conflict) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 429 | Problem (rate_limited) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 500 | Problem (internal) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 503 | Problem (service_unavailable) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |

Successful response headers:
```json
{
  "X-Request-Id": {
    "description": "Correlation id echoed on every response",
    "schema": {
      "type": "string"
    }
  },
  "RateLimit-Limit": {
    "description": "Per-key request limit for the current window",
    "schema": {
      "type": "integer"
    }
  },
  "RateLimit-Remaining": {
    "description": "Requests remaining in the current window",
    "schema": {
      "type": "integer"
    }
  },
  "RateLimit-Reset": {
    "description": "Seconds until the current window resets",
    "schema": {
      "type": "integer"
    }
  }
}
```

## discoverPostgresDatabases

`POST /v1/data-source-connections/discover-databases`

Deployment URL: `https://ctx4.me/v1/data-source-connections/discover-databases`. Replace parameters in braces with actual IDs from the API.

Discover PostgreSQL or SQL Server databases before creating a source

Capability: `connections:write`.

The contract defines no additional parameters.

### Request body

Required. [DiscoverPostgresDatabasesRequest](https://ctx4.me/docs/api-schemas-2.md#discoverpostgresdatabasesrequest)

```json
{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/DiscoverPostgresDatabasesRequest"
      }
    }
  }
}
```

### Responses and errors

| HTTP | Meaning | Format and schema |
| --- | --- | --- |
| 200 | Bounded database catalog with explicit session evidence | `application/json` [DiscoverPostgresDatabasesResponse](https://ctx4.me/docs/api-schemas-2.md#discoverpostgresdatabasesresponse) |
| 400 | Problem (validation_failed) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 401 | Problem (authentication_required, invalid_api_key, api_key_expired, api_key_revoked) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 403 | Problem (capability_missing, forbidden) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 429 | Problem (rate_limited) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 500 | Problem (internal) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 503 | Problem (service_unavailable) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |

Successful response headers:
```json
{
  "X-Request-Id": {
    "description": "Correlation id echoed on every response",
    "schema": {
      "type": "string"
    }
  },
  "RateLimit-Limit": {
    "description": "Per-key request limit for the current window",
    "schema": {
      "type": "integer"
    }
  },
  "RateLimit-Remaining": {
    "description": "Requests remaining in the current window",
    "schema": {
      "type": "integer"
    }
  },
  "RateLimit-Reset": {
    "description": "Seconds until the current window resets",
    "schema": {
      "type": "integer"
    }
  }
}
```

## listDataSourceConnections

`GET /v1/data-source-connections`

Deployment URL: `https://ctx4.me/v1/data-source-connections`. Replace parameters in braces with actual IDs from the API.

List database and topic source connections

Capability: `connections:read`.

### Parameters

| Name | Location | Required | Type and constraints |
| --- | --- | --- | --- |
| `cursor` | query | no | &#123;"type":"string","minLength":1,"maxLength":400,"pattern":"^[A-Za-z0-9_-]+$","description":"Opaque pagination cursor from a previous response"&#125; Opaque pagination cursor from a previous response |
| `limit` | query | no | &#123;"type":"integer","minimum":1,"maximum":100,"description":"Page size (1-100, default 20)"&#125; Page size (1-100, default 20) |

### Responses and errors

| HTTP | Meaning | Format and schema |
| --- | --- | --- |
| 200 | Tenant-scoped secret-free source views | `application/json` [DataSourceConnectionList](https://ctx4.me/docs/api-schemas-2.md#datasourceconnectionlist) |
| 400 | Problem (validation_failed) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 401 | Problem (authentication_required, invalid_api_key, api_key_expired, api_key_revoked) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 403 | Problem (capability_missing) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 429 | Problem (rate_limited) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 500 | Problem (internal) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 503 | Problem (service_unavailable) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |

Successful response headers:
```json
{
  "X-Request-Id": {
    "description": "Correlation id echoed on every response",
    "schema": {
      "type": "string"
    }
  },
  "RateLimit-Limit": {
    "description": "Per-key request limit for the current window",
    "schema": {
      "type": "integer"
    }
  },
  "RateLimit-Remaining": {
    "description": "Requests remaining in the current window",
    "schema": {
      "type": "integer"
    }
  },
  "RateLimit-Reset": {
    "description": "Seconds until the current window resets",
    "schema": {
      "type": "integer"
    }
  }
}
```

## createDataSourceConnection

`POST /v1/data-source-connections`

Deployment URL: `https://ctx4.me/v1/data-source-connections`. Replace parameters in braces with actual IDs from the API.

Create a typed database or topic source connection

Capability: `connections:write`.

### Parameters

| Name | Location | Required | Type and constraints |
| --- | --- | --- | --- |
| `Idempotency-Key` | header | yes | &#123;"type":"string"&#125; Client-chosen key (8-128 chars of [A-Za-z0-9._:-]); replays with the same payload return the original outcome |

### Request body

Required. [CreateDataSourceConnectionRequest](https://ctx4.me/docs/api-schemas-3.md#createdatasourceconnectionrequest)

```json
{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/CreateDataSourceConnectionRequest"
      }
    }
  }
}
```

### Responses and errors

| HTTP | Meaning | Format and schema |
| --- | --- | --- |
| 201 | Created source; credentials are never returned | `application/json` [DataSourceConnection](https://ctx4.me/docs/api-schemas-2.md#datasourceconnection) |
| 400 | Problem (validation_failed) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 401 | Problem (authentication_required, invalid_api_key, api_key_expired, api_key_revoked) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 403 | Problem (capability_missing, forbidden) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 409 | Problem (conflict) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 429 | Problem (rate_limited) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 500 | Problem (internal) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 503 | Problem (service_unavailable) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |

Successful response headers:
```json
{
  "X-Request-Id": {
    "description": "Correlation id echoed on every response",
    "schema": {
      "type": "string"
    }
  },
  "RateLimit-Limit": {
    "description": "Per-key request limit for the current window",
    "schema": {
      "type": "integer"
    }
  },
  "RateLimit-Remaining": {
    "description": "Requests remaining in the current window",
    "schema": {
      "type": "integer"
    }
  },
  "RateLimit-Reset": {
    "description": "Seconds until the current window resets",
    "schema": {
      "type": "integer"
    }
  }
}
```

## getDataSourceConnection

`GET /v1/data-source-connections/{dataSourceConnectionId}`

Deployment URL: `https://ctx4.me/v1/data-source-connections/{dataSourceConnectionId}`. Replace parameters in braces with actual IDs from the API.

Get one database or topic source connection

Capability: `connections:read`.

### Parameters

| Name | Location | Required | Type and constraints |
| --- | --- | --- | --- |
| `dataSourceConnectionId` | path | yes | &#123;"type":"string","format":"uuid","example":"9b2f6f2e-4b0a-4bd2-8b7e-3f8a1c2d4e5f"&#125;  |

### Responses and errors

| HTTP | Meaning | Format and schema |
| --- | --- | --- |
| 200 | Secret-free source connection view | `application/json` [DataSourceConnection](https://ctx4.me/docs/api-schemas-2.md#datasourceconnection) |
| 400 | Problem (validation_failed) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 401 | Problem (authentication_required, invalid_api_key, api_key_expired, api_key_revoked) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 403 | Problem (capability_missing) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 404 | Problem (not_found) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 429 | Problem (rate_limited) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 500 | Problem (internal) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 503 | Problem (service_unavailable) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |

Successful response headers:
```json
{
  "X-Request-Id": {
    "description": "Correlation id echoed on every response",
    "schema": {
      "type": "string"
    }
  },
  "RateLimit-Limit": {
    "description": "Per-key request limit for the current window",
    "schema": {
      "type": "integer"
    }
  },
  "RateLimit-Remaining": {
    "description": "Requests remaining in the current window",
    "schema": {
      "type": "integer"
    }
  },
  "RateLimit-Reset": {
    "description": "Seconds until the current window resets",
    "schema": {
      "type": "integer"
    }
  }
}
```

## revokeDataSourceConnection

`DELETE /v1/data-source-connections/{dataSourceConnectionId}`

Deployment URL: `https://ctx4.me/v1/data-source-connections/{dataSourceConnectionId}`. Replace parameters in braces with actual IDs from the API.

Revoke a database or topic source connection

Capability: `connections:write`.

### Parameters

| Name | Location | Required | Type and constraints |
| --- | --- | --- | --- |
| `dataSourceConnectionId` | path | yes | &#123;"type":"string","format":"uuid","example":"9b2f6f2e-4b0a-4bd2-8b7e-3f8a1c2d4e5f"&#125;  |

### Responses and errors

| HTTP | Meaning | Format and schema |
| --- | --- | --- |
| 200 | Revoked source connection | `application/json` [DataSourceConnection](https://ctx4.me/docs/api-schemas-2.md#datasourceconnection) |
| 400 | Problem (validation_failed) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 401 | Problem (authentication_required, invalid_api_key, api_key_expired, api_key_revoked) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 403 | Problem (capability_missing, forbidden) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 404 | Problem (not_found) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 409 | Problem (conflict) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 429 | Problem (rate_limited) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 500 | Problem (internal) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 503 | Problem (service_unavailable) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |

Successful response headers:
```json
{
  "X-Request-Id": {
    "description": "Correlation id echoed on every response",
    "schema": {
      "type": "string"
    }
  },
  "RateLimit-Limit": {
    "description": "Per-key request limit for the current window",
    "schema": {
      "type": "integer"
    }
  },
  "RateLimit-Remaining": {
    "description": "Requests remaining in the current window",
    "schema": {
      "type": "integer"
    }
  },
  "RateLimit-Reset": {
    "description": "Seconds until the current window resets",
    "schema": {
      "type": "integer"
    }
  }
}
```

## replaceDataSourceCredential

`POST /v1/data-source-connections/{dataSourceConnectionId}/credential`

Deployment URL: `https://ctx4.me/v1/data-source-connections/{dataSourceConnectionId}/credential`. Replace parameters in braces with actual IDs from the API.

Replace the password credential of a source connection

Capability: `connections:write`.

### Parameters

| Name | Location | Required | Type and constraints |
| --- | --- | --- | --- |
| `dataSourceConnectionId` | path | yes | &#123;"type":"string","format":"uuid","example":"9b2f6f2e-4b0a-4bd2-8b7e-3f8a1c2d4e5f"&#125;  |

### Request body

Required. [ReplaceDataSourceCredentialRequest](https://ctx4.me/docs/api-schemas-3.md#replacedatasourcecredentialrequest)

```json
{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/ReplaceDataSourceCredentialRequest"
      }
    }
  }
}
```

### Responses and errors

| HTTP | Meaning | Format and schema |
| --- | --- | --- |
| 200 | Source with the new credential version; a degraded source returns to pending until an inspection succeeds | `application/json` [DataSourceConnection](https://ctx4.me/docs/api-schemas-2.md#datasourceconnection) |
| 400 | Problem (validation_failed) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 401 | Problem (authentication_required, invalid_api_key, api_key_expired, api_key_revoked) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 403 | Problem (capability_missing, forbidden) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 404 | Problem (not_found) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 409 | Problem (conflict) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 429 | Problem (rate_limited) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 500 | Problem (internal) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 503 | Problem (service_unavailable) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |

Successful response headers:
```json
{
  "X-Request-Id": {
    "description": "Correlation id echoed on every response",
    "schema": {
      "type": "string"
    }
  },
  "RateLimit-Limit": {
    "description": "Per-key request limit for the current window",
    "schema": {
      "type": "integer"
    }
  },
  "RateLimit-Remaining": {
    "description": "Requests remaining in the current window",
    "schema": {
      "type": "integer"
    }
  },
  "RateLimit-Reset": {
    "description": "Seconds until the current window resets",
    "schema": {
      "type": "integer"
    }
  }
}
```

## getDataSourceSchema

`GET /v1/data-source-connections/{dataSourceConnectionId}/schema`

Deployment URL: `https://ctx4.me/v1/data-source-connections/{dataSourceConnectionId}/schema`. Replace parameters in braces with actual IDs from the API.

Get the latest discovered source schema

Capability: `connections:read`.

### Parameters

| Name | Location | Required | Type and constraints |
| --- | --- | --- | --- |
| `dataSourceConnectionId` | path | yes | &#123;"type":"string","format":"uuid","example":"9b2f6f2e-4b0a-4bd2-8b7e-3f8a1c2d4e5f"&#125;  |

### Responses and errors

| HTTP | Meaning | Format and schema |
| --- | --- | --- |
| 200 | Latest tenant-scoped source schema | `application/json` [SourceSchema](https://ctx4.me/docs/api-schemas-3.md#sourceschema) |
| 400 | Problem (validation_failed) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 401 | Problem (authentication_required, invalid_api_key, api_key_expired, api_key_revoked) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 403 | Problem (capability_missing, forbidden) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 404 | Problem (not_found) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 429 | Problem (rate_limited) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 500 | Problem (internal) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 503 | Problem (service_unavailable) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |

Successful response headers:
```json
{
  "X-Request-Id": {
    "description": "Correlation id echoed on every response",
    "schema": {
      "type": "string"
    }
  },
  "RateLimit-Limit": {
    "description": "Per-key request limit for the current window",
    "schema": {
      "type": "integer"
    }
  },
  "RateLimit-Remaining": {
    "description": "Requests remaining in the current window",
    "schema": {
      "type": "integer"
    }
  },
  "RateLimit-Reset": {
    "description": "Seconds until the current window resets",
    "schema": {
      "type": "integer"
    }
  }
}
```

## discoverDataSourceSchema

`POST /v1/data-source-connections/{dataSourceConnectionId}/schema`

Deployment URL: `https://ctx4.me/v1/data-source-connections/{dataSourceConnectionId}/schema`. Replace parameters in braces with actual IDs from the API.

Inspect a source, persist its schema, and activate the connection

Capability: `connections:write`.

### Parameters

| Name | Location | Required | Type and constraints |
| --- | --- | --- | --- |
| `Idempotency-Key` | header | yes | &#123;"type":"string"&#125; Client-chosen key (8-128 chars of [A-Za-z0-9._:-]); replays with the same payload return the original outcome |
| `dataSourceConnectionId` | path | yes | &#123;"type":"string","format":"uuid","example":"9b2f6f2e-4b0a-4bd2-8b7e-3f8a1c2d4e5f"&#125;  |

### Responses and errors

| HTTP | Meaning | Format and schema |
| --- | --- | --- |
| 200 | Discovered immutable source schema version | `application/json` [SourceSchema](https://ctx4.me/docs/api-schemas-3.md#sourceschema) |
| 400 | Problem (validation_failed) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 401 | Problem (authentication_required, invalid_api_key, api_key_expired, api_key_revoked) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 403 | Problem (capability_missing, forbidden) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 404 | Problem (not_found) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 409 | Problem (conflict) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 429 | Problem (rate_limited) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 500 | Problem (internal) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |
| 503 | Problem (service_unavailable) | `application/problem+json` [Problem](https://ctx4.me/docs/api-schemas-1.md#problem) |

Successful response headers:
```json
{
  "X-Request-Id": {
    "description": "Correlation id echoed on every response",
    "schema": {
      "type": "string"
    }
  },
  "RateLimit-Limit": {
    "description": "Per-key request limit for the current window",
    "schema": {
      "type": "integer"
    }
  },
  "RateLimit-Remaining": {
    "description": "Requests remaining in the current window",
    "schema": {
      "type": "integer"
    }
  },
  "RateLimit-Reset": {
    "description": "Seconds until the current window resets",
    "schema": {
      "type": "integer"
    }
  }
}
```

