---
title: "Add a connection to a space"
---

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

# Add a connection to a space

Path: CloudRaker Workspace API › Connections

`POST /spaces/{spaceId}/connections`

Creates a connection in this space. `type` is `remote_mcp` (a remote MCP server), `authenticated_http` (one authenticated endpoint), `openapi` (an imported spec) or `slack`; `config` carries the plaintext, non-secret settings for that type (never a credential — use `POST …/credentials` or the OAuth flow). `operationPolicy` defaults to `read_only`: discovered write operations stay off until a builder opts in, and flipping it to `all` is what provisions the approval-gated `conn-<slug>` action. The space comes from the path and is never read from the body. Authorization: `space:contribute`. Returns 201 `{ data: Connection }`.

## Authentication

- `bearerAuth`, http, header `Authorization`

## Path parameters

- `spaceId` (`createConnection.path.spaceId`; string, required)

## Request body

_Required._

- `type` (`createConnection.type`; string, required)
  - one of `"remote_mcp"`, `"authenticated_http"`, `"openapi"`, `"slack"`
- `name` (`createConnection.name`; string, required)
  - minLength 1; maxLength 200
- `slug` (`createConnection.slug`; string, optional)
  - minLength 1; maxLength 64; pattern `^[a-z0-9]+(-[a-z0-9]+)*$`
- `config` (`createConnection.config`; map<unknown>, optional)
- `operationPolicy` (`createConnection.operationPolicy`; string, optional) — A connection only becomes write-capable when a builder opts in.
  - one of `"read_only"`, `"all"`; default `"read_only"`
- `scope` (`createConnection.scope`; string, optional)
  - one of `"space"`

## Example request

```json
{
  "type": "remote_mcp",
  "name": "string",
  "slug": "string",
  "config": {
    "property1": null,
    "property2": null
  },
  "operationPolicy": "read_only",
  "scope": "space"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.cloudraker.com/spaces/<spaceId>/connections' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "type": "remote_mcp",
  "name": "string",
  "slug": "string",
  "config": {
    "property1": null,
    "property2": null
  },
  "operationPolicy": "read_only",
  "scope": "space"
}
'
```

### TypeScript

```typescript
const url = 'https://api.cloudraker.com/spaces/<spaceId>/connections';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    type: 'remote_mcp',
    name: 'string',
    slug: 'string',
    config: {property1: null, property2: null},
    operationPolicy: 'read_only',
    scope: 'space'
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.cloudraker.com/spaces/<spaceId>/connections"

payload = {
    "type": "remote_mcp",
    "name": "string",
    "slug": "string",
    "config": {
        "property1": None,
        "property2": None
    },
    "operationPolicy": "read_only",
    "scope": "space"
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 201

The created connection.

#### Example

```json
{
  "data": {
    "id": "string",
    "slug": "slack-acme",
    "scope": "space",
    "spaceId": "string",
    "ownerUserId": "string",
    "type": "remote_mcp",
    "name": "Slack (Acme)",
    "config": {
      "property1": null,
      "property2": null
    },
    "credentialRef": "string",
    "definitionId": "string",
    "operationPolicy": "read_only",
    "authStatus": "connected",
    "authErrorCode": "string",
    "authErrorMessage": "string",
    "authCheckedAt": "string",
    "tokenExpiresAt": "string",
    "verificationStatus": "ready",
    "verificationMessage": "string",
    "verificationCheckedAt": "string",
    "installedActionId": "string",
    "enabled": true,
    "createdBy": "string",
    "createdAt": "string",
    "updatedAt": "string",
    "deletedAt": "string",
    "contract": {
      "schemaVersion": 1,
      "connectionType": "string",
      "driver": "remote_mcp",
      "capabilities": [
        "mcp_tools"
      ],
      "verification": {
        "strategy": "mcp_discovery",
        "live": true
      },
      "permissions": {
        "read": true,
        "write": true
      },
      "provenance": "builtin"
    }
  }
}
```

- `data` (`createConnection.response.201.data`; object, required)
  - `id` (`createConnection.response.201.data.id`; string, required)
  - `slug` (`createConnection.response.201.data.slug`; string, required)
    - example `"slack-acme"`
  - `scope` (`createConnection.response.201.data.scope`; string, required)
    - one of `"space"`, `"user"`
  - `spaceId` (`createConnection.response.201.data.spaceId`; string, required)
  - `ownerUserId` (`createConnection.response.201.data.ownerUserId`; string | null, required)
  - `type` (`createConnection.response.201.data.type`; string, required)
    - example `"remote_mcp"`
  - `name` (`createConnection.response.201.data.name`; string, required)
    - example `"Slack (Acme)"`
  - `config` (`createConnection.response.201.data.config`; map<unknown>, required) — Plaintext, non-secret settings. A credential is never stored here — secrets live in the encrypted secret store.
  - `credentialRef` (`createConnection.response.201.data.credentialRef`; string | null, required) — An opaque reference to the stored secret — never a secret value.
  - `definitionId` (`createConnection.response.201.data.definitionId`; string | null, required)
  - `operationPolicy` (`createConnection.response.201.data.operationPolicy`; string, required)
    - one of `"read_only"`, `"all"`
  - `authStatus` (`createConnection.response.201.data.authStatus`; string, required)
    - one of `"connected"`, `"needs_reauth"`, `"missing_scopes"`, `"setup_incomplete"`, `"unknown"`
  - `authErrorCode` (`createConnection.response.201.data.authErrorCode`; string | null, required)
  - `authErrorMessage` (`createConnection.response.201.data.authErrorMessage`; string | null, required)
  - `authCheckedAt` (`createConnection.response.201.data.authCheckedAt`; string | null, required)
  - `tokenExpiresAt` (`createConnection.response.201.data.tokenExpiresAt`; string | null, required)
  - `verificationStatus` (`createConnection.response.201.data.verificationStatus`; string, required)
    - one of `"ready"`, `"configured"`, `"needs_authorization"`, `"misconfigured"`, `"degraded"`, `"unknown"`
  - `verificationMessage` (`createConnection.response.201.data.verificationMessage`; string | null, required)
  - `verificationCheckedAt` (`createConnection.response.201.data.verificationCheckedAt`; string | null, required)
  - `installedActionId` (`createConnection.response.201.data.installedActionId`; string | null, required) — The auto-provisioned `conn-<slug>` installed action, set only when the contract permits writes — that action is how a write reaches the approval gate.
  - `enabled` (`createConnection.response.201.data.enabled`; boolean, required)
  - `createdBy` (`createConnection.response.201.data.createdBy`; string, required)
  - `createdAt` (`createConnection.response.201.data.createdAt`; string, required)
  - `updatedAt` (`createConnection.response.201.data.updatedAt`; string, required)
  - `deletedAt` (`createConnection.response.201.data.deletedAt`; string | null, required)
  - `contract` (`createConnection.response.201.data.contract`; object, required) — What this connection can do, derived purely from its type and configuration. `permissions.write` is the whole gate: it is true only when the builder opted into writes, and it is what makes the connection appear as an approval-gated action instead of a read-only agent tool.
    - `schemaVersion` (`createConnection.response.201.data.contract.schemaVersion`; number, required)
    - `connectionType` (`createConnection.response.201.data.contract.connectionType`; string, required)
    - `driver` (`createConnection.response.201.data.contract.driver`; string, required)
      - one of `"remote_mcp"`, `"authenticated_http"`, `"channel"`, `"configuration"`
    - `capabilities` (`createConnection.response.201.data.contract.capabilities`; array<string>, required)
      - one of `"mcp_tools"`, `"typed_operations"`, `"authenticated_fetch"`, `"channel_send"`
    - `verification` (`createConnection.response.201.data.contract.verification`; object, required)
      - `strategy` (`createConnection.response.201.data.contract.verification.strategy`; string, required)
        - one of `"mcp_discovery"`, `"http_configuration"`, `"slack_auth"`, `"credential_configuration"`
      - `live` (`createConnection.response.201.data.contract.verification.live`; boolean, required)
    - `permissions` (`createConnection.response.201.data.contract.permissions`; object, required)
      - `read` (`createConnection.response.201.data.contract.permissions.read`; boolean, required)
      - `write` (`createConnection.response.201.data.contract.permissions.write`; boolean, required)
    - `provenance` (`createConnection.response.201.data.contract.provenance`; string, required)
      - one of `"builtin"`, `"imported"`


Source: https://docs.cloudraker.com/workspace/api/connections/create-connection/index.md
