# Network

> List connections, send connection invitations, and see and accept received invitations.

Manage an account's network: its existing connections, the invitations it has received, and sending new connection requests.

## List connections

```http
GET /v1/relations?account_id={account_id}&limit={limit}&cursor={cursor}
```

```bash
curl "https://api.correctinbox.com/v1/relations?account_id=acc_8f21c0&limit=40" \
  -H "X-API-KEY: $CORRECTINBOX_API_KEY"
```

```js
const { relations, cursor } = await (
  await fetch("https://api.correctinbox.com/v1/relations?account_id=acc_8f21c0&limit=40", {
    headers: { "X-API-KEY": process.env.CORRECTINBOX_API_KEY },
  })
).json();
```

```python
data = requests.get(
    "https://api.correctinbox.com/v1/relations",
    headers={"X-API-KEY": os.environ["CORRECTINBOX_API_KEY"]},
    params={"account_id": "acc_8f21c0", "limit": 40},
).json()
```

**Response**

```json
{
  "relations": [
    { "id": "ACoAAB1x...", "name": "Priya Menon", "headline": "Head of Sales at Northwind" }
  ],
  "cursor": "eyJvZmZzZXQiOjQwfQ"
}
```

## Send an invitation

Send a connection request to a person (by profile id, from [search](/search) or [users](/users)).

```http
POST /v1/users/{identifier}/invite
```

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `account_id` | string | yes | The account that sends the request. |
| `message` | string | no | A note to include (keep it short). |

```bash
curl -X POST https://api.correctinbox.com/v1/users/ACoAAB1x.../invite \
  -H "X-API-KEY: $CORRECTINBOX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "account_id": "acc_8f21c0", "message": "Hi Priya — following your work at Northwind." }'
```

```python
requests.post(
    "https://api.correctinbox.com/v1/users/ACoAAB1x.../invite",
    headers={"X-API-KEY": os.environ["CORRECTINBOX_API_KEY"]},
    json={"account_id": "acc_8f21c0", "message": "Hi Priya — following your work at Northwind."},
)
```

## List received invitations

```http
GET /v1/invitations?account_id={account_id}
```

```json
{
  "invitations": [
    { "id": "inv_22a", "inviter": { "id": "ACoAAC9...", "name": "Rahul Nair" }, "message": "Let's connect!" }
  ]
}
```

## Accept an invitation

```http
POST /v1/invitations/{invitation_id}/accept
```

```bash
curl -X POST https://api.correctinbox.com/v1/invitations/inv_22a/accept \
  -H "X-API-KEY: $CORRECTINBOX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "account_id": "acc_8f21c0" }'
```

```js
await fetch("https://api.correctinbox.com/v1/invitations/inv_22a/accept", {
  method: "POST",
  headers: {
    "X-API-KEY": process.env.CORRECTINBOX_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ account_id: "acc_8f21c0" }),
});
```

```python
requests.post(
    "https://api.correctinbox.com/v1/invitations/inv_22a/accept",
    headers={"X-API-KEY": os.environ["CORRECTINBOX_API_KEY"]},
    json={"account_id": "acc_8f21c0"},
)
```
