curl --request POST \
--url https://api.getkroo.com/api/v3/oauth/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data grant_type=client_credentials \
--data 'client_id=<string>' \
--data 'client_secret=<string>' \
--data 'scope=read:schedule_files write:schedule_files'import requests
url = "https://api.getkroo.com/api/v3/oauth/token"
payload = {
"grant_type": "client_credentials",
"client_id": "<string>",
"client_secret": "<string>",
"scope": "read:schedule_files write:schedule_files"
}
headers = {"Content-Type": "application/x-www-form-urlencoded"}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({
grant_type: 'client_credentials',
client_id: '<string>',
client_secret: '<string>',
scope: 'read:schedule_files write:schedule_files'
})
};
fetch('https://api.getkroo.com/api/v3/oauth/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.getkroo.com/api/v3/oauth/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 => "grant_type=client_credentials&client_id=%3Cstring%3E&client_secret=%3Cstring%3E&scope=read%3Aschedule_files%20write%3Aschedule_files",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-www-form-urlencoded"
],
]);
$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.getkroo.com/api/v3/oauth/token"
payload := strings.NewReader("grant_type=client_credentials&client_id=%3Cstring%3E&client_secret=%3Cstring%3E&scope=read%3Aschedule_files%20write%3Aschedule_files")
req, _ := http.NewRequest("POST", url, payload)
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(string(body))
}HttpResponse<String> response = Unirest.post("https://api.getkroo.com/api/v3/oauth/token")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("grant_type=client_credentials&client_id=%3Cstring%3E&client_secret=%3Cstring%3E&scope=read%3Aschedule_files%20write%3Aschedule_files")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getkroo.com/api/v3/oauth/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'
request.body = "grant_type=client_credentials&client_id=%3Cstring%3E&client_secret=%3Cstring%3E&scope=read%3Aschedule_files%20write%3Aschedule_files"
response = http.request(request)
puts response.read_body{
"access_token": "f4a91d2bce7c4f0a9b8e3d6c5a2f1e8b9d7c6a5b4e3f2d1c0b9a8e7d6c5b4a3f",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "read:schedule_files write:schedule_files"
}{
"error": "<string>",
"error_description": "<string>"
}{
"error": "<string>",
"error_description": "<string>"
}Issue an access token
Exchanges client credentials for a short-lived Bearer token used to authenticate subsequent v3 API requests.
Submit grant_type=client_credentials together with your
client_id and client_secret. The response includes the
access_token to send as Authorization: Bearer <token>, the
token_type (always Bearer), the lifetime in seconds, and the
space-delimited scope actually granted.
Scopes: omit the scope parameter to receive every scope your
client is registered for, or pass a subset (space-delimited). A
request for a scope outside your client’s registered set returns
invalid_scope.
Auth: the token endpoint itself is unauthenticated (no Bearer
header). Authentication is performed by the client_id /
client_secret pair you send in the body.
400 error codes (RFC 6749 §5.2):
invalid_client— missing or wrongclient_id/client_secret.unsupported_grant_type—grant_typeis notclient_credentials.unauthorized_client— the client is not registered for theclient_credentialsgrant.invalid_scope— the requestedscopeexceeds the client’s registered scope set.
curl --request POST \
--url https://api.getkroo.com/api/v3/oauth/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data grant_type=client_credentials \
--data 'client_id=<string>' \
--data 'client_secret=<string>' \
--data 'scope=read:schedule_files write:schedule_files'import requests
url = "https://api.getkroo.com/api/v3/oauth/token"
payload = {
"grant_type": "client_credentials",
"client_id": "<string>",
"client_secret": "<string>",
"scope": "read:schedule_files write:schedule_files"
}
headers = {"Content-Type": "application/x-www-form-urlencoded"}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({
grant_type: 'client_credentials',
client_id: '<string>',
client_secret: '<string>',
scope: 'read:schedule_files write:schedule_files'
})
};
fetch('https://api.getkroo.com/api/v3/oauth/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.getkroo.com/api/v3/oauth/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 => "grant_type=client_credentials&client_id=%3Cstring%3E&client_secret=%3Cstring%3E&scope=read%3Aschedule_files%20write%3Aschedule_files",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-www-form-urlencoded"
],
]);
$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.getkroo.com/api/v3/oauth/token"
payload := strings.NewReader("grant_type=client_credentials&client_id=%3Cstring%3E&client_secret=%3Cstring%3E&scope=read%3Aschedule_files%20write%3Aschedule_files")
req, _ := http.NewRequest("POST", url, payload)
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(string(body))
}HttpResponse<String> response = Unirest.post("https://api.getkroo.com/api/v3/oauth/token")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("grant_type=client_credentials&client_id=%3Cstring%3E&client_secret=%3Cstring%3E&scope=read%3Aschedule_files%20write%3Aschedule_files")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getkroo.com/api/v3/oauth/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'
request.body = "grant_type=client_credentials&client_id=%3Cstring%3E&client_secret=%3Cstring%3E&scope=read%3Aschedule_files%20write%3Aschedule_files"
response = http.request(request)
puts response.read_body{
"access_token": "f4a91d2bce7c4f0a9b8e3d6c5a2f1e8b9d7c6a5b4e3f2d1c0b9a8e7d6c5b4a3f",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "read:schedule_files write:schedule_files"
}{
"error": "<string>",
"error_description": "<string>"
}{
"error": "<string>",
"error_description": "<string>"
}Body
OAuth 2.0 grant type. Only client_credentials is supported on this endpoint for confidential clients.
client_credentials Issued when the API client was created.
Issued when the API client was created.
Optional space-delimited list of scopes to request. Defaults to the client's full registered scope set.
"read:schedule_files write:schedule_files"
Response
Access token issued
Bearer token to send in Authorization: Bearer <token>. Treat it as a secret; tokens are bearer credentials.
"f4a91d2bce7c4f0a9b8e3d6c5a2f1e8b9d7c6a5b4e3f2d1c0b9a8e7d6c5b4a3f"
Always Bearer. Use as the auth scheme in the Authorization header.
Bearer "Bearer"
Seconds until the token expires (3600 = 1 hour).
3600
Space-delimited list of scopes actually granted on this token. May be narrower than what you requested if some scopes are not registered on the client.
"read:schedule_files write:schedule_files"
Was this page helpful?