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

# Create connection

> Store credentials for a connector as a reusable named connection.

Creates a new connector connection. Credentials are stored encrypted and never returned in plain text after creation.

<Warning>
  The `config` map contains raw credentials (API keys, tokens). Ensure you are making this request over HTTPS. Values are stored encrypted at rest.
</Warning>

## Request body

<ParamField body="name" type="string" required>Human-readable name. 1–100 characters.</ParamField>
<ParamField body="connectorId" type="string" required>The connector to configure, e.g. `slack`, `github`.</ParamField>
<ParamField body="authType" type="string" required>The auth method, e.g. `apiKey`, `basic`, `oauth2`.</ParamField>
<ParamField body="config" type="object" required>Key-value credential map. Keys and structure are connector-specific.</ParamField>
<ParamField body="visibility" type="string">`PRIVATE` (default) | `SPACE` | `GLOBAL`</ParamField>
<ParamField body="spaceId" type="string">Required if `visibility` is `SPACE`.</ParamField>

<RequestExample>
  ```bash theme={"dark"}
  curl -X POST "https://your-collabase.ch/api/v1/automation/connections" \
    -H "Authorization: Bearer cba_live_..." \
    -H "Content-Type: application/json" \
    -d '{
      "name": "GitHub Actions Bot",
      "connectorId": "github",
      "authType": "apiKey",
      "config": {
        "token": "ghp_xxxxxxxxxxxxxxxxxxxx"
      },
      "visibility": "SPACE",
      "spaceId": "space-001"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 201 theme={"dark"}
  {
    "id": "conn-xyz",
    "name": "GitHub Actions Bot",
    "connectorId": "github",
    "visibility": "SPACE"
  }
  ```
</ResponseExample>
