> 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 (basic auth, required) — This is the Polytomic deployment key (on-premises only)
- `Authorization` header (bearer token, required) — This is the Polytomic API key

## Request

### Body (application/json)

This endpoint expects a V3ConnectCardRequest.

- `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` (V3ConnectCardResponse, optional)

## Errors

### 401 Unauthorized Error

Unauthorized

- `code` (integer, optional) — Application-specific error code.
- `context` (map from string to any, optional) — Application context.
- `error` (string, optional) — Error message.
- `status` (string, optional) — Status text.

### 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

### V3ConnectCardResponse

- `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 = {
    "X-Polytomic-Version": "X-Polytomic-Version"
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers, auth=("<username>", "<password>"))

print(response.json())
```

```javascript
const url = 'https://app.polytomic.com/api/connections/connect';
const credentials = btoa("<username>:<password>");

const options = {
  method: 'POST',
  headers: {
    'X-Polytomic-Version': 'X-Polytomic-Version',
    Authorization: `Basic ${credentials}`,
    '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("X-Polytomic-Version", "X-Polytomic-Version")
	req.SetBasicAuth("<username>", "<password>")
	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["X-Polytomic-Version"] = 'X-Polytomic-Version'
request.basic_auth("<username>", "<password>")
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("X-Polytomic-Version", "X-Polytomic-Version")
  .basicAuth("<username>", "<password>")
  .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' => [
    'Content-Type' => 'application/json',
    'X-Polytomic-Version' => 'X-Polytomic-Version',
  ],
    'auth' => ['<username>', '<password>'],
]);

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

```csharp
using RestSharp;
using RestSharp.Authenticators;

var client = new RestClient("https://app.polytomic.com/api/connections/connect");
client.Authenticator = new HttpBasicAuthenticator("<username>", "<password>");
var request = new RestRequest(Method.POST);
request.AddHeader("X-Polytomic-Version", "X-Polytomic-Version");

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 credentials = Data("<username>:<password>".utf8).base64EncodedString()

let headers = [
  "X-Polytomic-Version": "X-Polytomic-Version",
  "Authorization": "Basic \(credentials)",
  "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()
```