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

# Get Token

POST https://auth.catenatelematics.com/realms/catena/protocol/openid-connect/token
Content-Type: application/x-www-form-urlencoded

Exchange your credentials for an OAuth2 token to access the Catena Telematics API endpoints.


Reference: https://catena.ferndocs.com/api-reference/oauth-20/get-token

## Request

### Body (application/x-www-form-urlencoded)

This endpoint expects an object.

- `grant_type` ("client_credentials", required) — Grant type for token request. Must be "client_credentials"
- `client_id` (string, required) — Your client identifier
- `client_secret` (string, required) — Your client secret
- `scope` ("organization", required) — Required scope for API access. Must be "organization"

## Response

### 200

Token response

- `access_token` (string, required)
- `expires_in` (integer, required)
- `token_type` (string, required)
- `refresh_expires_in` (integer, optional)
- `session_state` (string, optional)
- `not-before-policy` (integer, optional)
- `scope` (string, optional)

## Errors

### 401 Unauthorized Error

Invalid authentication

- `error` (string, required) — Error code.
- `error_description` (string, optional) — Human-readable error description.

## Examples

**Request**

```json
{
  "grant_type": "client_credentials",
  "client_id": "",
  "client_secret": "",
  "scope": "organization"
}
```

**Response**

```json
{
  "access_token": "eyJhbGciOiJIUzUxMiIsInR5cCIgOiAiS...",
  "expires_in": 1,
  "token_type": "Bearer",
  "refresh_expires_in": 1,
  "session_state": "123e4567-e89b-12d3-a456-426614174000",
  "not-before-policy": 0,
  "scope": "fleet:read share-agreement:read telematics:read"
}
```

**SDK Code**

```python
import requests

url = "https://auth.catenatelematics.com/realms/catena/protocol/openid-connect/token"

payload = ""
headers = {"Content-Type": "application/x-www-form-urlencoded"}

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

print(response.json())
```

```javascript
const url = 'https://auth.catenatelematics.com/realms/catena/protocol/openid-connect/token';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/x-www-form-urlencoded'},
  body: new URLSearchParams('')
};

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://auth.catenatelematics.com/realms/catena/protocol/openid-connect/token"

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

	req.Header.Add("Content-Type", "application/x-www-form-urlencoded")

	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://auth.catenatelematics.com/realms/catena/protocol/openid-connect/token")

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/x-www-form-urlencoded'

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://auth.catenatelematics.com/realms/catena/protocol/openid-connect/token")
  .header("Content-Type", "application/x-www-form-urlencoded")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://auth.catenatelematics.com/realms/catena/protocol/openid-connect/token', [
  'form_params' => null,
  'headers' => [
    'Content-Type' => 'application/x-www-form-urlencoded',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://auth.catenatelematics.com/realms/catena/protocol/openid-connect/token");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "application/x-www-form-urlencoded"]

let request = NSMutableURLRequest(url: NSURL(string: "https://auth.catenatelematics.com/realms/catena/protocol/openid-connect/token")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
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()
```