# Start connecting with OAuth

`POST /v1/workspaces/{workspaceId}/connections/authorize`

Returns the provider's sign-in URL. After the person approves, the provider returns to the API, which creates the connection (or re-authorises `connectionId`) and redirects to the web app's connection settings with `?connection=<id>` or `?error=`. Owners and admins only.

Scope: `docs:write`.

## Request

```bash
curl -X POST "https://api.lydie.co/v1/workspaces/01JCQ3TZ0WJ8K4M2X7T9R6N1PA/connections/authorize" \
  -H "Authorization: Bearer $LYDIE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "connector": "string",
    "name": "Notes"
  }'
```

## Path parameters

- `workspaceId` (string, required): (1–64 chars)

## Body

- `connector` (string, required): (≥ 1 chars)
- `name` (string, required): (1–120 chars)
- `settings` (object, optional): Default: `{}`.
- `connectionId` (ULID, optional, nullable): Default: `null`.

## Response

- `authorizeUrl` (string, required)
- `expiresAt` (timestamp, required)

```json
{
  "authorizeUrl": "string",
  "expiresAt": "2026-11-12T09:30:00.000Z"
}
```

Errors use the envelope described at https://developers.lydie.co/errors.md.
