Exchange Token
curl --request POST \
--url https://api.korve.dev/v1/agent-auth/token \
--header 'Content-Type: application/json' \
--data '
{
"redirectUri": "<string>",
"code": "<string>",
"codeVerifier": "<string>",
"deviceCode": "<string>",
"refreshToken": "<string>"
}
'import requests
url = "https://api.korve.dev/v1/agent-auth/token"
payload = {
"redirectUri": "<string>",
"code": "<string>",
"codeVerifier": "<string>",
"deviceCode": "<string>",
"refreshToken": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
redirectUri: '<string>',
code: '<string>',
codeVerifier: '<string>',
deviceCode: '<string>',
refreshToken: '<string>'
})
};
fetch('https://api.korve.dev/v1/agent-auth/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.korve.dev/v1/agent-auth/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'redirectUri' => '<string>',
'code' => '<string>',
'codeVerifier' => '<string>',
'deviceCode' => '<string>',
'refreshToken' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.korve.dev/v1/agent-auth/token"
payload := strings.NewReader("{\n \"redirectUri\": \"<string>\",\n \"code\": \"<string>\",\n \"codeVerifier\": \"<string>\",\n \"deviceCode\": \"<string>\",\n \"refreshToken\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.korve.dev/v1/agent-auth/token")
.header("Content-Type", "application/json")
.body("{\n \"redirectUri\": \"<string>\",\n \"code\": \"<string>\",\n \"codeVerifier\": \"<string>\",\n \"deviceCode\": \"<string>\",\n \"refreshToken\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.korve.dev/v1/agent-auth/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"redirectUri\": \"<string>\",\n \"code\": \"<string>\",\n \"codeVerifier\": \"<string>\",\n \"deviceCode\": \"<string>\",\n \"refreshToken\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"tokenType": "Bearer",
"accessToken": "<string>",
"expiresIn": 2,
"refreshToken": "<string>",
"refreshExpiresAt": "2023-11-07T05:31:56Z",
"audience": "cli",
"role": "member",
"scopes": [
"<string>"
],
"organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"grantId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}agentAuth
Exchange Token
Exchange an authorization code with its PKCE verifier, poll an approved device authorization, or rotate a refresh token. Refresh-token reuse revokes the entire grant.
POST
/
v1
/
agent-auth
/
token
Exchange Token
curl --request POST \
--url https://api.korve.dev/v1/agent-auth/token \
--header 'Content-Type: application/json' \
--data '
{
"redirectUri": "<string>",
"code": "<string>",
"codeVerifier": "<string>",
"deviceCode": "<string>",
"refreshToken": "<string>"
}
'import requests
url = "https://api.korve.dev/v1/agent-auth/token"
payload = {
"redirectUri": "<string>",
"code": "<string>",
"codeVerifier": "<string>",
"deviceCode": "<string>",
"refreshToken": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
redirectUri: '<string>',
code: '<string>',
codeVerifier: '<string>',
deviceCode: '<string>',
refreshToken: '<string>'
})
};
fetch('https://api.korve.dev/v1/agent-auth/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.korve.dev/v1/agent-auth/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'redirectUri' => '<string>',
'code' => '<string>',
'codeVerifier' => '<string>',
'deviceCode' => '<string>',
'refreshToken' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.korve.dev/v1/agent-auth/token"
payload := strings.NewReader("{\n \"redirectUri\": \"<string>\",\n \"code\": \"<string>\",\n \"codeVerifier\": \"<string>\",\n \"deviceCode\": \"<string>\",\n \"refreshToken\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.korve.dev/v1/agent-auth/token")
.header("Content-Type", "application/json")
.body("{\n \"redirectUri\": \"<string>\",\n \"code\": \"<string>\",\n \"codeVerifier\": \"<string>\",\n \"deviceCode\": \"<string>\",\n \"refreshToken\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.korve.dev/v1/agent-auth/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"redirectUri\": \"<string>\",\n \"code\": \"<string>\",\n \"codeVerifier\": \"<string>\",\n \"deviceCode\": \"<string>\",\n \"refreshToken\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"tokenType": "Bearer",
"accessToken": "<string>",
"expiresIn": 2,
"refreshToken": "<string>",
"refreshExpiresAt": "2023-11-07T05:31:56Z",
"audience": "cli",
"role": "member",
"scopes": [
"<string>"
],
"organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"grantId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}Body
application/json
Available options:
authorization_code, device_code, refresh_token Available options:
korve-cli, korve-mcp Maximum string length:
2048Required string length:
43 - 128The device authorization's client-held polling secret.
Response
A short-lived access token and a single-use rotating refresh token.
Available options:
Bearer Required range:
x >= 1The first-party client surface that may present the resulting token.
Available options:
cli, mcp Maximum organization role the grant may exercise. Owner grants do not exist.
Available options:
member, admin Exact public API operation ids the grant may call.
Required array length:
1 - 256 elementsMaximum string length:
128Pattern:
^[A-Za-z][A-Za-z0-9]*\.[A-Za-z][A-Za-z0-9]*$