> ## Documentation Index
> Fetch the complete documentation index at: https://docs.galtea.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Test Connection

> Test an endpoint connection by making a sample request.

> [!WARNING]
>
> You are reading the docs of Galtea 5.15. [Read this page in the latest version](https://docs.galtea.ai/sdk/api/endpoint-connection/test-connection.md).

## Returns

Returns a `TestConnectionResult` object containing:

* `success` (bool): Whether the test request succeeded.
* `status_code` (int): The HTTP status code returned by the endpoint.
* `latency` (float): Round-trip latency in milliseconds.
* `response` (any): The raw response body from the endpoint.
* `error` (string | None): Error message if the request failed.
* `extracted_output` (dict | None): Values extracted via `output_mapping`, if provided.
* `extraction_error` (string | None): Error message if extraction failed.

## Modes

This method can be called in two ways:

**With an existing connection ID** — the stored connection is used as a base and any provided fields act as overrides:

```python theme={"system"}
    test_result = galtea.endpoint_connections.test(
        id=endpoint_connection_id,
    )
```

**Without an ID** — all connection fields are provided directly (useful during creation flow):

```python theme={"system"}
    test_result = galtea.endpoint_connections.test(
        url="https://api.example.com/v1/chat",
        http_method="POST",
        auth_type="BEARER",
        auth_token="YOUR_AUTH_TOKEN",
        input_template='{"message": "{{ input.user_message }}"}',
        output_mapping={"output": "$.response"},
        type=EndpointConnectionType.CONVERSATION,
        timeout=30,
    )
```

## Parameters

**id** `string`

ID of an existing endpoint connection to test. When provided, stored connection data is used as the base and remaining fields act as overrides. With `id`, the call needs permission to edit that connection, because the test sends the stored credentials and secret header values and returns the answer. The API answers `403` without that permission. Without `id`, the call needs permission to create a connection.

**url** `string`

The endpoint URL to test. For [multi-step session lifecycles](https://docs.galtea.ai/v5.15/concepts/product/endpoint-connection.md#multi-step-session-lifecycle-advanced), supports a `{{ session_id }}` placeholder (requires an `INITIALIZATION` endpoint).

**http\_method** `string`

HTTP method. Valid values: `GET`, `POST`, `PUT`, `PATCH`, `DELETE`. Other string values are sent
to the API unchanged, so values added in newer API versions can be used; the API rejects invalid
ones.

**input\_template** `string`

Input template with Jinja2 placeholders. See [Input Template](https://docs.galtea.ai/v5.15/concepts/product/endpoint-connection-configuration.md#input-template).

> [!NOTE]
>
> The test renders a placeholder attachment for `input_files`. Its URL points at nothing your endpoint can download, so a failed download in this test is expected. See [Attached Files and Audio](https://docs.galtea.ai/v5.15/concepts/product/endpoint-connection-template-syntax.md#attached-files-and-audio).

**auth\_type** `string`

Authentication type. Valid values: `NONE`, `BEARER`, `API_KEY`, `BASIC`. Other string values are
sent to the API unchanged, so values added in newer API versions can be used; the API rejects
invalid ones.

**auth\_token** `string`

Authentication token.

**username** `string`

Username for `BASIC` authentication.

**password** `string`

Password for `BASIC` authentication.

**headers** `dict[string, string]`

Custom headers. Supports placeholders: credentials (e.g., `{{ bearer_token }}`, `{{ api_key }}`) and call values (e.g., `{{ trace_id }}`, `{{ session_id }}`). When you test a stored connection, a `••••••••` value sends the stored value of that header. See [Secret Header Values](https://docs.galtea.ai/v5.15/concepts/product/endpoint-connection-configuration.md#secret-header-values).

**output\_mapping** `dict[string, string]`

Output mapping using JSONPath expressions. See [Output Mapping](https://docs.galtea.ai/v5.15/concepts/product/endpoint-connection-configuration.md#output-mapping).

**type** `string`

Endpoint connection type. Valid values: `INITIALIZATION`, `CONVERSATION`, `FINALIZATION`.
`CONVERSATION` is required for all products. `INITIALIZATION` and `FINALIZATION` are only needed
for [complex session management](https://docs.galtea.ai/v5.15/concepts/product/endpoint-connection.md#multi-step-session-lifecycle-advanced).
Other string values are sent to the API unchanged, so values added in newer API versions can be
used; the API rejects invalid ones.

**timeout** `int`

Request timeout in seconds.

**acknowledged\_insecure\_http** `bool`

Set to `true` to test an `http://` URL that is not saved yet. Required when `url` is not HTTPS, unless the deployment allows plain HTTP for every connection. See [HTTP Endpoints](https://docs.galtea.ai/v5.15/concepts/product/endpoint-connection.md#http-endpoints).

> [!NOTE]
>
> All fields except `id` default to `PydanticUndefined` (from `pydantic_core`).
> Omit a field (or pass `PydanticUndefined`) to exclude it from the test request.
> Pass `None` to explicitly send null — useful to override a stored value when testing with an existing connection ID.
> Pass a value to include it.
>
> `auth_token` and `password` are the exception: `None` or an empty string keeps the stored credential. Changing `auth_type` drops the credentials the new type does not use, so the test matches what saving would produce.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.