# Mint a Saffron connect session (cardamom / catalog)

> Source: https://docs.clonepartner.com/api-reference/connectors/create-connector-connect-session/

`POST /api/connectors/{id}/connect-session`

Cardamom / catalog connectors only. Uses the deploy's `SAFFRON_API_TOKEN`
(`sfk_…`) against Saffron `/v1`. Ensures the installed integration exists,
refreshes the environment redirect allow-list, and returns a `connect_url`.
Returns 400 `BYOA_REQUIRED` when the catalog OAuth `client.id` is `dummy`
and no customer OAuth app has been configured yet.

**Operation ID:** `createConnectorConnectSession`

## Authentication

### Option 1

- **BearerAuth** (`http bearer`)
  API key token. Create via POST /api/api-keys. Format: `envoy_<hex>`

### Option 2

- **CookieAuth** (`apiKey`)
  Session cookie set after login + TOTP verification

## Path parameters

- `id` — `integer`, `required`
  Resource ID

## Request body

### `application/json`

- Type: `object`
- Properties:
  - `integration_slug` (`string`) — Catalog slug to connect (falls back to connector config.integration)
  - `tenant_id` (`string`)
  - `environment_id` (`string`) — Ignored for /v1 (taken from the sfk_ token scope)
  - `redirect_uri` (`string`)
  - `reconnect_account_id` (`string`)

## Success responses

### 200

Connect session minted

**Content type:** `application/json`

- Type: `object`
- Properties:
  - `connect_session` (`string`, `required`)
  - `connect_url` (`string`, `required`)
    - Format: `uri`

## Error responses

### 400

Not a cardamom connector, BYOA required, or invalid body


### 404

Resource not found

**Content type:** `application/json`

- Reference: `Error`
  - Type: `object`
  - Properties:
    - `error` (`string`)
      - Example: `NOT_FOUND`
    - `message` (`string`)
      - Example: `Resource not found`

Example:

```json
{
  "error": "NOT_FOUND",
  "message": "Resource not found"
}
```

### 500

Connect session mint failed


## Examples

### cURL

```bash
curl --request POST \
  --url 'https://your-envoy.example.com/api/connectors/YOUR_ID/connect-session' \
  --header 'Authorization: Bearer $API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "integration_slug": "string",
  "tenant_id": "string",
  "environment_id": "string",
  "redirect_uri": "string",
  "reconnect_account_id": "string"
}'
```

### JavaScript (fetch)

```javascript
const response = await fetch('https://your-envoy.example.com/api/connectors/YOUR_ID/connect-session', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "integration_slug": "string",
    "tenant_id": "string",
    "environment_id": "string",
    "redirect_uri": "string",
    "reconnect_account_id": "string"
  }),
});

if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = response.status === 204 ? null : await response.json();
console.log(data);
```
