# Test an existing connector

> Source: https://docs.clonepartner.com/api-reference/connectors/test-connector-by-id/

`POST /api/connectors/{id}/test`

Loads the stored connector config (including secrets) and runs per-type validation checks on a fresh instance.

**Operation ID:** `testConnectorById`

## Authentication

### Option 1

- **BearerAuth** (`http bearer`)
  API key token. Create via POST /api/api-keys. Format: `envoy_<hex>`

### Option 2

- **CookieAuth** (`apiKey`)
  Session cookie set after login + TOTP verification

## Path parameters

- `id` — `integer`, `required`
  Resource ID

## Success responses

### 200

Test results

**Content type:** `application/json`

- Reference: `ConnectorTestResult`
  - Type: `object`
  - Properties:
    - `ok` (`boolean`, `required`)
    - `checks` (`array<ConnectorCheck>`, `required`)
      - Items:
        - Reference: `ConnectorCheck`
          - Type: `object`
          - Properties:
            - `name` (`string`, `required`) — Check name (e.g. Authenticate, Write probe)
            - `ok` (`boolean`, `required`)
            - `message` (`string`) — Short friendly summary (set on failure)
            - `error` (`ConnectorCheckError`)
              - Reference: `ConnectorCheckError`
                - Properties:
                  - `name` (`string`, `required`) — Error class name (e.g. MongoServerError)
                  - `message` (`string`, `required`) — Raw error message
                  - `code` (`string`) — Driver/SDK error code
            - `duration_ms` (`number`, `required`)

## Error responses

### 404

Resource not found

**Content type:** `application/json`

- Reference: `Error`
  - Type: `object`
  - Properties:
    - `error` (`string`)
      - Example: `NOT_FOUND`
    - `message` (`string`)
      - Example: `Resource not found`

Example:

```json
{
  "error": "NOT_FOUND",
  "message": "Resource not found"
}
```

## Examples

### cURL

```bash
curl --request POST \
  --url 'https://your-envoy.example.com/api/connectors/YOUR_ID/test' \
  --header 'Authorization: Bearer $API_KEY'
```

### JavaScript (fetch)

```javascript
const response = await fetch('https://your-envoy.example.com/api/connectors/YOUR_ID/test', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
  },
});

if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = response.status === 204 ? null : await response.json();
console.log(data);
```
