title: Initiate Oauth keywords: - initiate oauth - post - initiate - oauth # Initiate Oauth Initiate OAuth flow for a connector (routes to the appropriate auth provider). #### Query Parameters **`organization_id`** string required Organization ID #### Request Body **`connector_type`** string required Connector type to authorize **`integration_params`** object optional Optional integration-specific parameters (e.g., SharePoint site name) ## Returns **`authorization_url`** string URL to redirect user to **`state`** string OAuth state token Example ```bash cURL curl -X POST "https://api.aitronos.com/v1/personal-connectors/authorize" \ -H "X-API-Key: $FREDDY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "connector_type": "your_connector_type" }' ``` ```python Python import os import requests api_key = os.environ["FREDDY_API_KEY"] response = requests.post( "https://api.aitronos.com/v1/personal-connectors/authorize", headers={"X-API-Key": api_key}, json={'connector_type': 'your_connector_type'} ) print(response.json()) ``` ```javascript JavaScript const apiKey = process.env.FREDDY_API_KEY; const response = await fetch('https://api.aitronos.com/v1/personal-connectors/authorize', { method: 'POST', headers: { 'X-API-Key': apiKey, 'Content-Type': 'application/json' }, body: JSON.stringify({"connector_type": "your_connector_type"}) }); const data = await response.json(); console.log(data); ``` **Response:** ```json 200 OK { "authorization_url": "https://example.com/resource", "state": "example_state" } ``` Errors ```json 401 Unauthorized { "success": false, "error": { "code": "AUTHENTICATION_REQUIRED", "message": "Authentication required. Please provide a valid API key.", "system_message": "Missing or invalid authorization header", "type": "authentication_error", "status": 401, "trace_id": "req_abc123xyz", "timestamp": "2025-11-11T10:30:00Z", "details": {} } } ``` ```json 403 Forbidden { "success": false, "error": { "code": "INSUFFICIENT_PERMISSIONS", "message": "You do not have permission to access this resource.", "system_message": "Insufficient permissions for this operation", "type": "authorization_error", "status": 403, "trace_id": "req_def456uvw", "timestamp": "2025-11-11T10:30:00Z", "details": {} } } ``` ## Related Resources - [List Connectors](/docs/api-reference/connectors/introduction)