Documentation Index
Fetch the complete documentation index at: https://developer.instantly.ai/llms.txt
Use this file to discover all available pages before exploring further.
OAuth account API integration guide
This API allows third-party developers to programmatically connect Google and Microsoft OAuth accounts to Instantly workspaces without requiring browser automation through the frontend.Flow summary
- Send an API request to get the OAuth URL.
- Send this request with the API key of the workspace to which you want to connect the account.
- Open that URL in a new browser tab and connect the account.
- The account will automatically connect behind the scenes.
- There is no need for any Instantly login cookie, or to open the Instantly dashboard at all.
- Optionally, you can check status using the session ID you receive from step 1.
Authentication
All API requests require authentication using your Instantly API key:accounts:create scope for initializing OAuth and the accounts:read scope for checking status.
Provider-specific notes
The API endpoints and flow are identical — simply replace the provider name in the init endpoint:| Provider | Init endpoint | Status endpoint (same for both) |
|---|---|---|
POST /api/v2/oauth/google/init | GET /api/v2/oauth/session/status/:sessionId | |
| Microsoft | POST /api/v2/oauth/microsoft/init | GET /api/v2/oauth/session/status/:sessionId |
- Only Google Workspace (GSuite) accounts are supported.
- Personal Gmail accounts (
@gmail.com) will be rejected.
- Supports both Microsoft 365 (business) and personal Microsoft accounts.
- Uses Outlook / Office 365 for email access.
All code examples below use Google endpoints. To use Microsoft instead, replace
google with microsoft in all URLs.API endpoints
1. Initialize OAuth session
Creates a new OAuth session and returns the Google authorization URL. Endpoint:POST /api/v2/oauth/google/init
This endpoint has special rate limits to comply with upstream provider limits. See Rate limits for details.
| Field | Type | Description |
|---|---|---|
session_id | string | Unique session ID for polling status |
auth_url | string | Google authorization URL to open in the browser |
expires_at | string (ISO 8601) | Session expiry time (10 minutes from creation) |
2. Check OAuth status
Poll this endpoint to check the result of the OAuth flow. Endpoint:GET /api/v2/oauth/session/status/:sessionId
Request:
| Status | Description |
|---|---|
pending | User has not completed OAuth yet |
success | Account successfully connected |
error | OAuth failed (see error fields) |
expired | Session expired (10-minute timeout) |
Integration guide
Step 1: Initialize the OAuth session
Call the init endpoint to get a session ID and authorization URL.Step 2: Open the authorization URL
Direct the user to theauth_url to complete Google authentication. You can do this by:
- Option A: Opening in a new browser tab/window
- Option B: Opening in a popup window
- Option C: Redirecting the current page (requires handling the return)
Step 3: Poll for completion
Poll the status endpoint until the session completes or expires.Complete examples
Node.js
Python
Error handling
Common errors
| Error code | Description | Resolution |
|---|---|---|
account_exists | Account already connected to another workspace | The Google account is already connected to a different Instantly workspace |
server_error | Internal server error | Retry the OAuth flow |
expired | Session expired | Start a new OAuth flow (sessions expire after 10 minutes) |
HTTP status codes
| Code | Endpoint | Description |
|---|---|---|
200 | All | Success |
401 | All | Unauthorized — invalid or missing API key |
404 | Status | Session not found or belongs to a different workspace |
429 | All | Rate limit exceeded — init endpoints have additional stricter limits; all endpoints share the standard API rate limit |
503 | Init only | Upstream provider temporarily unavailable — retry after a short delay |
Security considerations
- Session binding: Sessions are tied to the workspace that created them. Only the same API key/workspace can poll for status.
- One-time use: Successful or error sessions are deleted after the first status retrieval.
- Short TTL: Sessions expire after 10 minutes if not completed.
- No token exposure: OAuth refresh tokens are never returned via the API — they are stored directly in the database.
- GSuite only: Only Google Workspace (GSuite) accounts are supported. Personal Gmail accounts will be rejected.
Rate limits
- Init endpoint (per workspace): 75 requests per minute. Exceeding returns
429. - Init endpoint (per IP): 150 requests per minute. Exceeding returns
429. - Escalating IP blocks: Persistent abuse from the same IP triggers progressively longer blocks (30 minutes → 2 hours → 24 hours).
When an IP is blocked, the
429 response includes a Retry-After header with the remaining block duration in seconds. Use this value to schedule your next retry.- Circuit breaker: If the upstream provider (Google/Microsoft) is temporarily rate-limiting Instantly, init requests return
503 Service Unavailable. This resolves automatically — retry after a short delay. - Provider isolation: Rate limits, IP blocks, and circuit breakers are tracked per provider. A Microsoft outage does not affect Google init requests, and vice versa.
- Status endpoint: Standard API rate limits apply.
- Recommended polling interval: 5 seconds.
Troubleshooting
User sees “Non GSuite accounts are not allowed”
The OAuth flow only supports Google Workspace (GSuite) accounts. Personal Gmail accounts (@gmail.com) are not supported.
Session expires before the user completes OAuth
Sessions have a 10-minute TTL. Ensure users complete the OAuth flow promptly. If needed, initialize a new session.Status returns 404 “Session not found”
This can happen if:- The session ID is incorrect.
- The session was created by a different workspace/API key.
- The session has already been consumed (success/error status already retrieved).
Account shows as connected but status returns “error”
Check theerror and error_description fields. Common issues:
- Account already exists in another workspace.
- Account was blocked by admin.
- Account contains prohibited content.