> This page is for version 2025-09-18 (default).
> For other versions, use one of these documentation indexes:
> - 2025-09-18 (default): https://apidocs.polytomic.com/2025-09-18/llms.txt
> - 2024-02-08: https://apidocs.polytomic.com/2024-02-08/llms.txt
> - 2023-04-25: https://apidocs.polytomic.com/2023-04-25/llms.txt
> - 2022-12-12: https://apidocs.polytomic.com/2022-12-12/llms.txt
> - 2021-05-23: https://apidocs.polytomic.com/2021-05-23/llms.txt

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

# Connect

POST https://app.polytomic.com/api/connections/connect/
Content-Type: application/json

Creates a Polytomic Connect session and returns a URL for creating or reconnecting a Connection.

Open the returned URL, or send it to the person who will set up the Connection.
Polytomic Connect guides them through authentication and configuration, then
redirects them to `redirect_url`.

Each session can create or reconnect one Connection.

See also:

- [Embedding authentication](../../../guides/embedding-authentication), a guide to using Polytomic Connect.

Reference: https://apidocs.polytomic.com/api-reference/connections/connect

## Authentication

- `Authorization` header (bearer token, required) — Bearer user API key
- `Authorization` header (basic auth, required) — Basic organization-scoped API key

## Request

### Body (application/json)

This endpoint expects a ConnectCardRequest.

- `name` (string, required) — Name of the new connection. Must be unique per organization.
- `redirect_url` (string, required) — URL to redirect to after connection is created.
- `connection` (string, optional) — The id of an existing connection to update.
- `dark` (boolean, optional) — Whether to use the dark theme for the Connect modal.
- `organization_id` (string, optional, nullable)
- `ttl` (integer, optional, nullable) — Connect session lifetime in seconds. Defaults to 300 and cannot exceed 604800.
- `use_organization_name` (boolean, optional) — Whether to display the target organization name instead of the partner name in the Connect modal. Defaults to false; organizations without a partner always display their organization name.
- `whitelist` (list of string, optional, nullable) — List of connection types which are allowed to be created. Ignored if type is set.
- `type` (string, optional, deprecated) — Connection type to create.

## Response

### 200

OK

- `data` (ConnectCardResponse, optional)

## Errors

### 401 Unauthorized Error

Unauthorized

- `key` (string, optional)
- `message` (string, optional)
- `metadata` (map from string to any, optional)
- `status` (integer, optional)

### 403 Forbidden Error

Forbidden

- `key` (string, optional)
- `message` (string, optional)
- `metadata` (map from string to any, optional)
- `status` (integer, optional)

### 404 Not Found Error

Not Found

- `key` (string, optional)
- `message` (string, optional)
- `metadata` (map from string to any, optional)
- `status` (integer, optional)

### 409 Conflict Error

Conflict

- `key` (string, optional)
- `message` (string, optional)
- `metadata` (map from string to any, optional)
- `status` (integer, optional)

### 422 Unprocessable Entity Error

Unprocessable Entity

- `key` (string, optional)
- `message` (string, optional)
- `metadata` (map from string to any, optional)
- `status` (integer, optional)

### 500 Internal Server Error

Internal Server Error

- `key` (string, optional)
- `message` (string, optional)
- `metadata` (map from string to any, optional)
- `status` (integer, optional)

## Types

### ConnectCardResponse

- `redirect_url` (string, optional) — URL that opens the Polytomic Connect flow for creating or reconnecting a Connection.
- `token` (string, optional) — Token for the Polytomic Connect session.

## Examples

**Request**

```json
{
  "name": "Salesforce Connection",
  "redirect_url": "string"
}
```

**Response**

```json
{
  "data": {
    "redirect_url": "https://app.polytomic.com/polytomic-connect?token=token",
    "token": "token"
  }
}
```

**SDK Code**

```python
import requests

url = "https://app.polytomic.com/api/connections/connect/"

payload = {
    "name": "Salesforce Connection",
    "redirect_url": "string"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://app.polytomic.com/api/connections/connect/';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"name":"Salesforce Connection","redirect_url":"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://app.polytomic.com/api/connections/connect/"

	payload := strings.NewReader("{\n  \"name\": \"Salesforce Connection\",\n  \"redirect_url\": \"string\"\n}")

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

	req.Header.Add("Authorization", "Bearer <token>")
	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://app.polytomic.com/api/connections/connect/")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"Salesforce Connection\",\n  \"redirect_url\": \"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://app.polytomic.com/api/connections/connect/")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Salesforce Connection\",\n  \"redirect_url\": \"string\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://app.polytomic.com/api/connections/connect/', [
  'body' => '{
  "name": "Salesforce Connection",
  "redirect_url": "string"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://app.polytomic.com/api/connections/connect/");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Salesforce Connection\",\n  \"redirect_url\": \"string\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Salesforce Connection",
  "redirect_url": "string"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://app.polytomic.com/api/connections/connect/")! 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()
```