> ## 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.

# Create Endpoint Connection

> Create a new endpoint connection for a product.

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

## Returns

Returns an [Endpoint Connection](https://docs.galtea.ai/v5.11/concepts/product/endpoint-connection.md) object for the given parameters, or `None` if an error occurs.

## Example

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

## Parameters

**name** `string` *required*

Name of the endpoint connection. Must be unique per product.

**product\_id** `string` *required*

ID of the product this connection belongs to.

**url** `string` *required*

The endpoint URL (HTTPS only). For [multi-step session lifecycles](https://docs.galtea.ai/v5.11/concepts/product/endpoint-connection.md#multi-step-session-lifecycle-advanced), the URL supports a `{{ session_id }}` placeholder for dynamic session IDs (e.g., `https://api.example.com/v1/threads/{{ session_id }}/messages`). Only available when an `INITIALIZATION` endpoint connection returns a `session_id`.

**type** `string` *required*

Type of endpoint connection. 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.11/concepts/product/endpoint-connection.md#multi-step-session-lifecycle-advanced)
(e.g., when your API requires a separate setup call that returns a session ID, or a cleanup call
after the conversation ends). Other string values are sent to the API unchanged, so values added
in newer API versions can be used; the API rejects invalid ones.

**http\_method** `string` (default: POST)

HTTP method. Valid values: `GET`, `POST`, `PUT`, `PATCH`, `DELETE`. Defaults to `POST`. 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\_type** `string` (default: BEARER)

Authentication type. Valid values: `NONE`, `BEARER`, `API_KEY`, `BASIC`. Defaults to `BEARER`. 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. Required for `BEARER` and `API_KEY` auth types.

**username** `string`

Username for `BASIC` authentication.

**password** `string`

Password for `BASIC` authentication.

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

Custom headers as key-value pairs. Supports placeholders: credentials (e.g., `{{ bearer_token }}`, `{{ api_key }}`) and call values (e.g., `{{ trace_id }}`, `{{ session_id }}`). See [Custom Headers](https://docs.galtea.ai/v5.11/concepts/product/endpoint-connection-configuration.md#custom-headers).

**input\_template** `string`

Input template with Jinja2 placeholders. Required for `CONVERSATION` type. Must name at least one input field, such as `{{ input.user_message }}`. Add `{{ input_files[0].url }}` or `{{ input_files[0].base64 }}` to send an attached file to your endpoint. A test case that attaches files is refused without one of them. See [Templates & Mapping](https://docs.galtea.ai/v5.11/concepts/product/endpoint-connection-configuration.md#input-template).

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

Output mapping configuration using JSONPath expressions. Required for `INITIALIZATION` (needs `session_id`) and `CONVERSATION` (needs `output`) types. See [Templates & Mapping](https://docs.galtea.ai/v5.11/concepts/product/endpoint-connection-configuration.md#output-mapping).

**timeout** `int`

Per-attempt request timeout in seconds. Defaults to `15`. Maximum `120` (values above this are rejected by the API).

**rate\_limit** `int`

Maximum requests per minute. Leave empty for no limit (no throttling).

**retry\_enabled** `bool`

Whether automatic retry is enabled. Defaults to `true`. See [Retry Configuration](https://docs.galtea.ai/v5.11/concepts/product/endpoint-connection-configuration.md#retry-configuration).

**retry\_max\_attempts** `int`

Maximum retry attempts (0–10). Defaults to `1`. These are retries after the first call, so N attempts means up to N+1 calls to your endpoint, and each call uses credits. `0` is only valid when retry is disabled; with retry enabled the minimum is `1`.

**retry\_initial\_delay\_ms** `int`

Initial delay in milliseconds before first retry. Defaults to `1000`.

**retry\_backoff\_strategy** `string`

Backoff strategy. Valid values: `FIXED`, `EXPONENTIAL`, `LINEAR`. Defaults to `EXPONENTIAL`. Other
string values are sent to the API unchanged, so values added in newer API versions can be used;
the API rejects invalid ones.

**retry\_max\_delay\_ms** `int`

Maximum delay between retry attempts, in milliseconds. Defaults to `3000`. Capped at `60000`; values above this are rejected.

**retryable\_status\_codes** `list[int]`

HTTP status codes that trigger retry. Defaults to `[429, 500, 502, 503, 504]`. Each value must be a valid HTTP status code (100–599).

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

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

**conversation\_end\_rules** `list[ConversationEndRule]`

Replies that mean your agent ended the conversation. On a match, the session completes and is evaluated instead of failing, and the match is never retried. Each `ConversationEndRule` has a `status_code` (100–599) and an optional `body_match`, a `ConversationEndBodyMatch` with a JSONPath `path` and the expected value `equals`. A `2xx` rule needs a `body_match`. At most 20 rules, and only for `CONVERSATION` type. Defaults to no rules. For example, `ConversationEndRule(status_code=409, body_match=ConversationEndBodyMatch(path="$.error.code", equals="conversation_ended"))`. See [Conversation End Rules](https://docs.galtea.ai/v5.11/concepts/product/endpoint-connection-configuration.md#conversation-end-rules).


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