---
title: "Start OAuth connect"
method: POST
path: "/v1/accounts/oauth/{provider}/init"
tags: ["Email Accounts"]
---

# Start OAuth connect

`POST /v1/accounts/oauth/{provider}/init`

## Request

- Base URL: `https://api.mailbeast.ai`
- URL: `https://api.mailbeast.ai/v1/accounts/oauth/{provider}/init`
- Auth: HTTP bearer

Start connecting a Google Workspace or Microsoft mailbox over OAuth. Returns a consent URL to open in a browser, plus a `state` handle. Once the owner grants access, poll `GET /v1/accounts/oauth/{provider}/status?state=…`.

Requires one of the following scopes: `accounts:write`, `accounts:all`, `all:all`.

## Path parameters

- `provider` 'google' | 'microsoft', required

## Response `200`

- OAuthInitApiResponseDto
  - `authorizationUrl` string, required: Open this consent URL in a browser so the mailbox owner can grant access.
  - `state` string, required: Opaque handle. Pass it to the status endpoint to poll the result.
  - `expiresInSeconds` number, required: How long the consent link / state stays valid.

## Other responses

- `400`: The request body or parameters failed validation.
- `401`: Missing or invalid API key.
- `403`: The key lacks a required scope, or the plan does not include API access.
- `429`: Rate limit exceeded - retry after the interval in the Retry-After header.

---

[API](https://skmtc.dev/mailbeast/apis/mailbeast-public-api.md) · [All operations](https://skmtc.dev/mailbeast/apis/mailbeast-public-api/llms.txt) · [OpenAPI document](https://skmtc.dev/mailbeast/apis/mailbeast-public-api/revisions/6440ce0738a4?raw)
