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

# Create Connection Pre Auth

POST https://api.catenatelematics.com/v2/integrations/connection-pre-auths
Content-Type: application/json

Create a new connection pre-auth record.

This endpoint stores pre-authentication credentials (e.g., username/password)
before initiating an OAuth flow. The returned ID should be provided when
creating the connection after the OAuth redirect completes.

Pre-auth records are single-use and can only be used by the same fleet and TSP.

Reference: https://catena.ferndocs.com/api-reference/integrations/connections/create-connection-pre-auth

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Body (application/json)

This endpoint expects a ConnectionPreAuthCreate.

- `tsp_id` (string, required) — The ID of the Telematics Service Provider (TSP) that the fleet uses.
- `pre_auth_credentials` (ApiBasicCreds-Input, required) — The pre-authentication credentials required to authenticate with the TSP on behalf of the fleet.

## Response

### 201

Successful Response

- `string`

## Errors

### 400 Bad Request Error

Bad Request

- `code` (integer, optional, default: 400)
- `message` (string, optional, default: Bad Request)
- `detail` (string, optional, nullable)

### 401 Unauthorized Error

Unauthorized

- `code` (integer, optional, default: 401)
- `message` (string, optional, default: Unauthorized)
- `detail` (string, optional, nullable)

### 403 Forbidden Error

Forbidden

- `code` (integer, optional, default: 403)
- `message` (string, optional, default: Forbidden)
- `detail` (string, optional, nullable)

### 404 Not Found Error

Not Found

- `code` (integer, optional, default: 404)
- `message` (string, optional, default: Not Found)
- `detail` (string, optional, nullable)

### 405 Method Not Allowed Error

Method Not Allowed

- `code` (integer, optional, default: 405)
- `message` (string, optional, default: Method Not Allowed)
- `detail` (string, optional, nullable)

### 409 Conflict Error

Conflict

- `code` (integer, optional, default: 409)
- `message` (string, optional, default: Conflict)
- `detail` (string, optional, nullable)

### 422 Unprocessable Entity Error

Unprocessable Entity

- `code` (integer, optional, default: 422)
- `message` (string, optional, default: Invalid Request Body)
- `detail` (list of ValidationErrorDetail, optional, nullable)

### 429 Too Many Requests Error

Too Many Requests

- `code` (integer, optional, default: 429)
- `message` (string, optional, default: Too Many Requests)
- `detail` (RetryAfterDetail, optional, nullable)

### 500 Internal Server Error

Internal Server Error

- `message` (string, optional, default: Internal Server Error)

### 504 Gateway Timeout Error

Gateway Timeout

- `code` (integer, optional, default: 504)
- `message` (string, optional, default: Gateway Timeout)
- `detail` (string, optional, nullable)

## Types

### ApiBasicCreds-Input

API Basic Connection model

- `username` (string, required)
- `password` (string, required)
- `url` (string, optional, nullable)
- `auth_code` (string, optional, nullable)
- `host` (string, optional, nullable)

### ValidationErrorDetail

- `path` (string, required)
- `input` (string, required)
- `message` (string, required)
- `error_type` (string, required)

### RetryAfterDetail

- `retry_after_seconds` (integer, required)
- `message` (string, required)

## Examples

**Request**

```json
{
  "tsp_id": "string",
  "pre_auth_credentials": {
    "username": "string",
    "password": "string"
  }
}
```

**Response**

```json
"string"
```

**SDK Code**

```python
import requests

url = "https://api.catenatelematics.com/v2/integrations/connection-pre-auths"

payload = {
    "tsp_id": "string",
    "pre_auth_credentials": {
        "username": "string",
        "password": "string"
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.catenatelematics.com/v2/integrations/connection-pre-auths';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"tsp_id":"string","pre_auth_credentials":{"username":"string","password":"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.catenatelematics.com/v2/integrations/connection-pre-auths"

	payload := strings.NewReader("{\n  \"tsp_id\": \"string\",\n  \"pre_auth_credentials\": {\n    \"username\": \"string\",\n    \"password\": \"string\"\n  }\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://api.catenatelematics.com/v2/integrations/connection-pre-auths")

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  \"tsp_id\": \"string\",\n  \"pre_auth_credentials\": {\n    \"username\": \"string\",\n    \"password\": \"string\"\n  }\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.catenatelematics.com/v2/integrations/connection-pre-auths")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"tsp_id\": \"string\",\n  \"pre_auth_credentials\": {\n    \"username\": \"string\",\n    \"password\": \"string\"\n  }\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.catenatelematics.com/v2/integrations/connection-pre-auths', [
  'body' => '{
  "tsp_id": "string",
  "pre_auth_credentials": {
    "username": "string",
    "password": "string"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.catenatelematics.com/v2/integrations/connection-pre-auths");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"tsp_id\": \"string\",\n  \"pre_auth_credentials\": {\n    \"username\": \"string\",\n    \"password\": \"string\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "tsp_id": "string",
  "pre_auth_credentials": [
    "username": "string",
    "password": "string"
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.catenatelematics.com/v2/integrations/connection-pre-auths")! 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()
```