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

GET https://app.polytomic.com/api/connections/connect/session

Returns trusted metadata for the authenticated Polytomic Connect session.

Returns the trusted metadata stored for a Polytomic Connect session. Authenticate with the opaque Connect token in the `token` query parameter.

The response includes the server-enforced connection name, fixed type or whitelist, bound connection ID, completion redirect, branding, and absolute expiration time.

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

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

## Response

### 200

OK

- `data` (V3ConnectSessionResponse, 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.

## Types

### V3ConnectSessionResponse

- `connection_id` (string, optional, nullable) — Existing or newly-created connection bound to this session.
- `dark` (boolean, optional) — Whether the Connect modal uses the dark theme.
- `expires_at` (string, optional) — Absolute time when the Connect session expires.
- `id` (string, optional) — Stable identifier for this Connect session.
- `logo` (string, optional) — Trusted logo URL displayed by the Connect modal.
- `name` (string, optional) — Trusted connection name for this session.
- `organization_name` (string, optional) — Trusted organization or partner name displayed by the Connect modal.
- `redirect_url` (string, optional) — URL to redirect to after the Connect flow finishes.
- `type` (string, optional) — Fixed connection type for this session, if any.
- `whitelist` (list of string, optional, nullable) — Connection types allowed for this session when type is empty.

## Examples

**Response**

```json
{
  "data": {
    "connection_id": "248df4b7-aa70-47b8-a036-33ac447e668d",
    "dark": true,
    "expires_at": "2024-01-15T09:30:00Z",
    "id": "248df4b7-aa70-47b8-a036-33ac447e668d",
    "logo": "string",
    "name": "string",
    "organization_name": "string",
    "redirect_url": "string",
    "type": "string",
    "whitelist": [
      "string"
    ]
  }
}
```

**SDK Code**

```python
import requests

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

headers = {
    "X-Polytomic-Version": "X-Polytomic-Version"
}

response = requests.get(url, headers=headers, auth=("<username>", "<password>"))

print(response.json())
```

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

const options = {
  method: 'GET',
  headers: {
    'X-Polytomic-Version': 'X-Polytomic-Version',
    Authorization: `Basic ${credentials}`
  }
};

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"
	"net/http"
	"io"
)

func main() {

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

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("X-Polytomic-Version", "X-Polytomic-Version")
	req.SetBasicAuth("<username>", "<password>")

	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/session")

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

request = Net::HTTP::Get.new(url)
request["X-Polytomic-Version"] = 'X-Polytomic-Version'
request.basic_auth("<username>", "<password>")

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.get("https://app.polytomic.com/api/connections/connect/session")
  .header("X-Polytomic-Version", "X-Polytomic-Version")
  .basicAuth("<username>", "<password>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://app.polytomic.com/api/connections/connect/session', [
  'headers' => [
    '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/session");
client.Authenticator = new HttpBasicAuthenticator("<username>", "<password>");
var request = new RestRequest(Method.GET);
request.AddHeader("X-Polytomic-Version", "X-Polytomic-Version");

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)"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://app.polytomic.com/api/connections/connect/session")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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()
```