cURL
curl --request POST \
--url https://api.tetrafi.io/api/v1/oauth/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'client_id=<string>' \
--data 'client_secret=<string>' \
--data 'grant_type=<string>'import requests
url = "https://api.tetrafi.io/api/v1/oauth/token"
payload = {
"client_id": "<string>",
"client_secret": "<string>",
"grant_type": "<string>"
}
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({client_id: '<string>', client_secret: '<string>', grant_type: '<string>'})
};
fetch('https://api.tetrafi.io/api/v1/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.tetrafi.io/api/v1/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 => "client_id=%3Cstring%3E&client_secret=%3Cstring%3E&grant_type=%3Cstring%3E",
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.tetrafi.io/api/v1/oauth/token"
payload := strings.NewReader("client_id=%3Cstring%3E&client_secret=%3Cstring%3E&grant_type=%3Cstring%3E")
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.tetrafi.io/api/v1/oauth/token")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("client_id=%3Cstring%3E&client_secret=%3Cstring%3E&grant_type=%3Cstring%3E")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tetrafi.io/api/v1/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 = "client_id=%3Cstring%3E&client_secret=%3Cstring%3E&grant_type=%3Cstring%3E"
response = http.request(request)
puts response.read_body{
"access_token": "<string>",
"expires_in": 1,
"scope": "<string>",
"token_type": "<string>"
}{
"error": "<string>",
"error_description": "<string>",
"error_uri": "<string>"
}{
"error": "<string>",
"error_description": "<string>",
"error_uri": "<string>"
}{
"error": "<string>",
"error_description": "<string>",
"error_uri": "<string>"
}auth
Post apiv1oauthtoken
RFC 6749 client-credentials grant for active service accounts. Supply grant_type=client_credentials, client_id=<service-account UUID>, and client_secret=<full tfk_live_... or tfk_test_... service-account API key>. Client credentials may instead be sent with HTTP Basic authentication. Tokens use the configured auth.jwtExpirySeconds capped at 900 seconds and carry the service account's current workspace role, effective permissions, and effective API scopes.
POST
/
api
/
v1
/
oauth
/
token
cURL
curl --request POST \
--url https://api.tetrafi.io/api/v1/oauth/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'client_id=<string>' \
--data 'client_secret=<string>' \
--data 'grant_type=<string>'import requests
url = "https://api.tetrafi.io/api/v1/oauth/token"
payload = {
"client_id": "<string>",
"client_secret": "<string>",
"grant_type": "<string>"
}
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({client_id: '<string>', client_secret: '<string>', grant_type: '<string>'})
};
fetch('https://api.tetrafi.io/api/v1/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.tetrafi.io/api/v1/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 => "client_id=%3Cstring%3E&client_secret=%3Cstring%3E&grant_type=%3Cstring%3E",
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.tetrafi.io/api/v1/oauth/token"
payload := strings.NewReader("client_id=%3Cstring%3E&client_secret=%3Cstring%3E&grant_type=%3Cstring%3E")
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.tetrafi.io/api/v1/oauth/token")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("client_id=%3Cstring%3E&client_secret=%3Cstring%3E&grant_type=%3Cstring%3E")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tetrafi.io/api/v1/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 = "client_id=%3Cstring%3E&client_secret=%3Cstring%3E&grant_type=%3Cstring%3E"
response = http.request(request)
puts response.read_body{
"access_token": "<string>",
"expires_in": 1,
"scope": "<string>",
"token_type": "<string>"
}{
"error": "<string>",
"error_description": "<string>",
"error_uri": "<string>"
}{
"error": "<string>",
"error_description": "<string>",
"error_uri": "<string>"
}{
"error": "<string>",
"error_description": "<string>",
"error_uri": "<string>"
}Body
application/x-www-form-urlencoded
An RFC 6749 client-credentials token request, form-encoded. Its field names are the standard's, so OAuth client libraries send it unchanged.
Response
Short-lived service-account bearer token
An RFC 6749 access token response.
The bearer token: send it as Authorization: Bearer <access_token>.
Seconds until the token expires (at most 900). Request a new one before then.
Required range:
x >= 0The token's API scopes, space-separated.
Always Bearer.