Initialize microsoft oauth
curl --request POST \
--url https://api.instantly.ai/api/v2/oauth/microsoft/init \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.instantly.ai/api/v2/oauth/microsoft/init"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.instantly.ai/api/v2/oauth/microsoft/init', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://api.instantly.ai/api/v2/oauth/microsoft/init")
.header("Authorization", "Bearer <token>")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.instantly.ai/api/v2/oauth/microsoft/init",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.instantly.ai/api/v2/oauth/microsoft/init"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"session_id": "abc123def456",
"auth_url": "https://login.microsoftonline.com/common/oauth2/v2.0/authorize?...",
"expires_at": "2026-01-14T12:30:00.000Z"
}{
"statusCode": 429,
"error": "Too Many Requests",
"message": "Rate limit exceeded for OAuth session creation"
}{
"statusCode": 503,
"error": "Service Unavailable",
"message": "OAuth is temporarily unavailable, please retry shortly"
}OAuth
Initialize microsoft oauth
Creates an OAuth session and returns the Microsoft authorization URL. The user should be redirected to auth_url to complete the OAuth flow. Poll the status endpoint to check for completion.
Special rate limits (stricter than the standard API rate limit) to comply with upstream Microsoft rate limits:
- 75 requests per minute per workspace
- 150 requests per minute per IP
If Microsoft’s upstream OAuth service is temporarily unavailable, requests may return 503.
POST
/
api
/
v2
/
oauth
/
microsoft
/
init
Initialize microsoft oauth
curl --request POST \
--url https://api.instantly.ai/api/v2/oauth/microsoft/init \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.instantly.ai/api/v2/oauth/microsoft/init"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.instantly.ai/api/v2/oauth/microsoft/init', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://api.instantly.ai/api/v2/oauth/microsoft/init")
.header("Authorization", "Bearer <token>")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.instantly.ai/api/v2/oauth/microsoft/init",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.instantly.ai/api/v2/oauth/microsoft/init"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"session_id": "abc123def456",
"auth_url": "https://login.microsoftonline.com/common/oauth2/v2.0/authorize?...",
"expires_at": "2026-01-14T12:30:00.000Z"
}{
"statusCode": 429,
"error": "Too Many Requests",
"message": "Rate limit exceeded for OAuth session creation"
}{
"statusCode": 503,
"error": "Service Unavailable",
"message": "OAuth is temporarily unavailable, please retry shortly"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Response
Default Response
Session ID for polling status
Example:
"abc123def456"
Microsoft authorization URL to redirect user to
Example:
"https://login.microsoftonline.com/common/oauth2/v2.0/authorize?..."
Session expiry time (10 minutes from creation)
Example:
"2026-01-14T12:30:00.000Z"