# Create connection

> Source: https://elaichi.ai/docs/api-reference/connections/connection/createconnection/

`POST /connection`

Resource: **Connection** · API: **Connections**

## Request body

- **`connector_slug`** _(string)_
- **`scope`** _(string)_
  Allowed: `user`, `team`, `org`
- **`team_id`** _(string,null)_
- **`redirect_uri`** _(string)_
- **`name`** _(string)_

## Response body

- **`connection`** _(object)_
  - **`id`** _(string)_
  - **`connector_slug`** _(string)_
  - **`name`** _(string)_
  - **`scope`** _(string)_
    Allowed: `user`, `team`, `org`
  - **`team_id`** _(string,null)_
  - **`owner_user_id`** _(string)_
  - **`saffron_account_id`** _(string,null)_
  - **`status`** _(string)_
  - **`last_error`** _(string,null)_
  - **`created_at`** _(string)_
  - **`updated_at`** _(string)_
- **`connect_url`** _(string)_

## Code examples

### curl

```bash
curl -X POST 'https://api.elaichi.ai/connection' \
  -H 'Authorization: Bearer $ELAICHI_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"connector_slug":"your_connector_slug","scope":"user","redirect_uri":"your_redirect_uri","name":"your_name"}'
```

### JavaScript

```javascript
const body = {
  "connector_slug": "your_connector_slug",
  "scope": "user",
  "redirect_uri": "your_redirect_uri",
  "name": "your_name"
};

const response = await fetch('https://api.elaichi.ai/connection', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer ' + process.env.ELAICHI_API_TOKEN,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(body),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import os
import requests

url = "https://api.elaichi.ai/connection"
headers = {
    "Authorization": f"Bearer {os.environ['ELAICHI_API_TOKEN']}",
    "Content-Type": "application/json",
}
payload = {
    "connector_slug": "your_connector_slug",
    "scope": "user",
    "redirect_uri": "your_redirect_uri",
    "name": "your_name"
}

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