# Test Connection

Check a connection against the provider it signs into. A test writes only its result: the status, the last successful test time, a renewed sign-in for an app that can renew one, and a refreshed name when the name was generated (a name someone typed never changes). changes lists exactly which of these moved. An app with no connection test answers 200 with supported false and status "unsupported" and changes nothing. Parent delegation cannot test Embedded end-user or installation connections. A key tests only the connections its creator may use: shared ones, and their own personal ones.

`POST https://connect.mindcloud.co/v2/connections/:connectionId/test`

Permissions: `credential:edit`.

## Parameters

### Path

- `connectionId` (string, required): The connection's id, from List Connections.

### Headers

- `X-Company-Id` (string): Optional. The id of the organization to act in. Leave it out to act in the API key's own organization. A key can also act in its child organizations, and, with "Use this key across all of your organizations" on, in every organization its creator can open in the app. List them with GET /v2/companies. Every response's X-Company-Id header names the organization it acted in. See [Organizations](https://mindcloud.co/docs/api/rest/introduction/organizations).

## Example request

```bash
curl --request POST \
  --url 'https://connect.mindcloud.co/v2/connections/Cn6vH3jW8qYt/test' \
  --header 'Authorization: Bearer $MINDCLOUD_API_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{}'
```

## Response fields

- `supported` (boolean): False when the app declares no connection test; then no test ran.
- `status` (string): The verdict: the stored connection status after the test, or "unsupported".
- `testedOn` (date): When the test ran.
- `message` (string): Why the test failed or could not run. Empty when it passed.
- `changes` (array of objects): Each field of the connection the test moved, with its value before and after. Empty when it moved nothing, as when the app declares no test.
  - `field` (string): The connection field that moved.
    Allowed values:
      - `status`: The verdict changed the stored status.
      - `testedOn`: The test passed, so it is the last successful test.
      - `authenticatedOn`: The sign-in was renewed before the test, for an app that can renew one.
      - `expiresOn`: The renewed sign-in expires at a new time.
      - `name`: A generated name was refreshed from the account the provider reported. A name someone typed is never changed.
  - `from` (object): Its value before the test.
  - `to` (object): Its value after the test.

## Example response

```json
{
  "success": true,
  "data": {
    "supported": true,
    "status": "valid",
    "testedOn": "2026-07-26T10:00:00.000Z",
    "message": null,
    "changes": [
      {
        "field": "testedOn",
        "from": "2026-07-20T09:12:00.000Z",
        "to": "2026-07-26T10:00:00.000Z"
      }
    ]
  }
}
```

## Errors

- 400 Bad request: `VALIDATION_FAILED` / `INVALID_QUERY` ""connectionId" is required."
- 403 Missing permission (API_KEY_PERMISSION_DENIED, API_KEY_CREATOR_INACTIVE): `FORBIDDEN` / `API_KEY_PERMISSION_DENIED` "This API key needs the workflow:run permission for this operation."
- 404 Connection not found: `NOT_FOUND` "Connection "Cn6vH3jW8qYt" was not found."
- 503 App definition unavailable: `UNAVAILABLE` / `CONNECTION_APP_UNAVAILABLE` "The app definition for "salesforce" could not be loaded, so this connection cannot be tested right now."
