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

# Exchange a client credential for an access token

POST https://api.revero.no/oauth/partner/token
Content-Type: application/x-www-form-urlencoded

Authenticate with HTTP Basic using the integration client ID and secret. The form must request the exact advertised resource and an explicit space-separated scope set. Client secrets must only be used by a backend.

Reference: https://docs.revero.no/api-reference/revero-public-api/oauth/exchange-client-credentials

## Authentication

- `Authorization` header (basic auth, required) — Authenticate the token exchange with the integration client ID and secret. Never expose the secret in browser code.

## Servers

- `https://api.revero.no` (Production, default)
- `https://api.staging.revero.no` (Staging)

## Request

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

This endpoint expects an object.

- `grant_type` ("client_credentials", required)
- `resource` (string, required)
- `scope` (string, required) — Space-separated OAuth scopes

## Response

### 200

A short-lived bearer token for the requested scopes.

- `access_token` (string, required) — Opaque bearer token. Keep it on the integrating backend.
- `token_type` ("Bearer", required) — Authorization scheme used when calling the Public API.
- `expires_in` (integer, required) — Lifetime of the access token in seconds.
- `scope` (string, required) — Granted OAuth scopes, separated by spaces.

## Errors

### 400 Bad Request Error

The grant, resource, or scope is invalid.

- `error` (string, required) — Machine-readable OAuth error code.
- `error_description` (string, required) — Safe description of why the token request failed.

### 401 Unauthorized Error

Client authentication failed.

- `error` (string, required) — Machine-readable OAuth error code.
- `error_description` (string, required) — Safe description of why the token request failed.

### 503 Service Unavailable Error

The authorization server cannot issue a token.

- `error` (string, required) — Machine-readable OAuth error code.
- `error_description` (string, required) — Safe description of why the token request failed.

## Examples

**Request**

```json
{
  "grant_type": "string",
  "resource": "https://referat-api.flyt.test/public/v1",
  "scope": "meetings:read meetings:write recordings:write"
}
```

**Response**

```json
{
  "access_token": "string",
  "token_type": "string",
  "expires_in": 1,
  "scope": "string"
}
```

**SDK Code**

```python
import requests

url = "https://api.revero.no/oauth/partner/token"

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

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

print(response.json())
```

```javascript
const url = 'https://api.revero.no/oauth/partner/token';
const credentials = btoa("<username>:<password>");

const options = {
  method: 'POST',
  headers: {
    Authorization: `Basic ${credentials}`,
    '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://api.revero.no/oauth/partner/token"

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

	req.SetBasicAuth("<username>", "<password>")
	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://api.revero.no/oauth/partner/token")

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

request = Net::HTTP::Post.new(url)
request.basic_auth("<username>", "<password>")
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://api.revero.no/oauth/partner/token")
  .basicAuth("<username>", "<password>")
  .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://api.revero.no/oauth/partner/token', [
  'form_params' => null,
  'headers' => [
    'Content-Type' => 'application/x-www-form-urlencoded',
  ],
    'auth' => ['<username>', '<password>'],
]);

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

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

var client = new RestClient("https://api.revero.no/oauth/partner/token");
client.Authenticator = new HttpBasicAuthenticator("<username>", "<password>");
var request = new RestRequest(Method.POST);

request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let credentials = Data("<username>:<password>".utf8).base64EncodedString()

let headers = [
  "Authorization": "Basic \(credentials)",
  "Content-Type": "application/x-www-form-urlencoded"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.revero.no/oauth/partner/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()
```