---
title: "Finish a connect with the provider's code and the window's verifier, or its error"
method: POST
path: "/v1/calendar/connect/finish"
tags: ["calendar"]
---

# Finish a connect with the provider's code and the window's verifier, or its error

`POST /v1/calendar/connect/finish`

## Request

- Base URL: `https://api.sixminute.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.sixminute.ai/v1/calendar/connect/finish`
- Auth: HTTP bearer

`state_token` must be the one the connect answered, unaltered, the caller's, for this state and unexpired; a finish without one is a connect an older release started, whose stored state must be the caller's, unexpired and unused, and is used by this call whatever follows. The code is exchanged with this service's client secret, the verifier and the same redirect uri. An `error` that says an administrator must approve the app first writes `awaiting_admin` with the approval link; any other `error` ends the connect (422). 409 when the caller's calendar is connected meanwhile (one account per person).

## Request body

- union
  - object
    - `state` string, required
    - `state_token` string
    - `code` string, required
    - `code_verifier` string, required
  - object
    - `state` string, required
    - `state_token` string
    - `error` string, required
    - `error_description` string
    - `error_subcode` string

## Response `200`

The account.

- object
  - `provider` 'microsoft' | 'google', required
  - `account_kind` 'work' | 'personal', required
  - `account_email` string, required
  - `status` 'connected' | 'awaiting_admin' | 'needs_reconnect', required
  - `admin_consent_url` string, nullable, required
  - `last_synced_at` string, date-time, nullable, required

## Other responses

- `400`: The body, query or path did not validate; `errors` lists the fields.
- `401`: No bearer token, or one that does not verify or has expired.
- `403`: The token verified but may not do this: no organisation, not provisioned, wrong role, or a device problem.
- `409`: The id or the email already belongs to something else.
- `422`: The request is well-formed but cannot be carried out as it stands.
- `503`: A capability this service was not configured with, or a practice system that could not be reached; the `type` says which.

---

[API](https://skmtc.dev/sixminute/apis/sixminute-api.md) - [All operations](https://skmtc.dev/sixminute/apis/sixminute-api/llms.txt) - [OpenAPI document](https://skmtc.dev/sixminute/apis/sixminute-api/revisions/605577eadc10?raw)
