> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.meetstream.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.meetstream.ai/_mcp/server.

# Create Outlook Calendar

POST https://api.meetstream.ai/api/v1/calendar/create_outlook_calendar
Content-Type: application/json

Connect an Outlook / Microsoft 365 calendar using an Azure app registration's refresh-token flow. MeetStream validates the credentials against Microsoft's OAuth endpoint, resolves the account email via Microsoft Graph (that email becomes the account_id), fetches all calendars on the account, and registers Graph change-notification subscriptions for real-time sync. Reconnecting an already-connected account without `replace: true` returns 409 Conflict.

Reference: https://docs.meetstream.ai/api-reference/api-endpoints/calendar/create-outlook-calendar

## Authentication

- `Authorization` header (required) (prefixed with `Token `) — Format: Token \<your\_api\_key>

## Request

### Body (application/json)

- `microsoft_client_id` (string, required)
- `microsoft_client_secret` (string, required)
- `microsoft_refresh_token` (string, required)
- `replace` (boolean, optional, default: false) — Allow overwriting an existing connection for the same account (token rotation). Without it, reconnecting returns 409.

## Response

### 200

Connection record (no token material)

## Examples

**Request**

```json
{
  "microsoft_client_id": "string",
  "microsoft_client_secret": "string",
  "microsoft_refresh_token": "string"
}
```

**Response**

```json
{}
```

**SDK Code**

```python
import requests

url = "https://api.meetstream.ai/api/v1/calendar/create_outlook_calendar"

payload = {
    "microsoft_client_id": "string",
    "microsoft_client_secret": "string",
    "microsoft_refresh_token": "string"
}
headers = {
    "Authorization": "Token <apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.meetstream.ai/api/v1/calendar/create_outlook_calendar';
const options = {
  method: 'POST',
  headers: {Authorization: 'Token <apiKey>', 'Content-Type': 'application/json'},
  body: '{"microsoft_client_id":"string","microsoft_client_secret":"string","microsoft_refresh_token":"string"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.meetstream.ai/api/v1/calendar/create_outlook_calendar"

	payload := strings.NewReader("{\n  \"microsoft_client_id\": \"string\",\n  \"microsoft_client_secret\": \"string\",\n  \"microsoft_refresh_token\": \"string\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Token <apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.meetstream.ai/api/v1/calendar/create_outlook_calendar")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Token <apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"microsoft_client_id\": \"string\",\n  \"microsoft_client_secret\": \"string\",\n  \"microsoft_refresh_token\": \"string\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.meetstream.ai/api/v1/calendar/create_outlook_calendar")
  .header("Authorization", "Token <apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"microsoft_client_id\": \"string\",\n  \"microsoft_client_secret\": \"string\",\n  \"microsoft_refresh_token\": \"string\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.meetstream.ai/api/v1/calendar/create_outlook_calendar', [
  'body' => '{
  "microsoft_client_id": "string",
  "microsoft_client_secret": "string",
  "microsoft_refresh_token": "string"
}',
  'headers' => [
    'Authorization' => 'Token <apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.meetstream.ai/api/v1/calendar/create_outlook_calendar");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Token <apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"microsoft_client_id\": \"string\",\n  \"microsoft_client_secret\": \"string\",\n  \"microsoft_refresh_token\": \"string\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Token <apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "microsoft_client_id": "string",
  "microsoft_client_secret": "string",
  "microsoft_refresh_token": "string"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.meetstream.ai/api/v1/calendar/create_outlook_calendar")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```