Authentication
Get an Access Token
POST
/
v0
/
auth
/
token
Get an Access Token
curl --request POST \
--url https://api.sandbox.getasset.com/v0/auth/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'client_id=<string>' \
--data 'client_secret=The oauth client secret' \
--data grant_type=client_credentials \
--data business_id=biz_GA6EG2qFxA97NZHtxeLPUy \
--data expires_in=3600 \
--data 'scope=<string>' \
--data resource=https://api.example.comimport requests
url = "https://api.sandbox.getasset.com/v0/auth/token"
payload = {
"client_id": "<string>",
"client_secret": "The oauth client secret",
"grant_type": "client_credentials",
"business_id": "biz_GA6EG2qFxA97NZHtxeLPUy",
"expires_in": "3600",
"scope": "<string>",
"resource": "https://api.example.com"
}
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: 'The oauth client secret',
grant_type: 'client_credentials',
business_id: 'biz_GA6EG2qFxA97NZHtxeLPUy',
expires_in: '3600',
scope: '<string>',
resource: 'https://api.example.com'
})
};
fetch('https://api.sandbox.getasset.com/v0/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.sandbox.getasset.com/v0/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 => "client_id=%3Cstring%3E&client_secret=The%20oauth%20client%20secret&grant_type=client_credentials&business_id=biz_GA6EG2qFxA97NZHtxeLPUy&expires_in=3600&scope=%3Cstring%3E&resource=https%3A%2F%2Fapi.example.com",
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.sandbox.getasset.com/v0/auth/token"
payload := strings.NewReader("client_id=%3Cstring%3E&client_secret=The%20oauth%20client%20secret&grant_type=client_credentials&business_id=biz_GA6EG2qFxA97NZHtxeLPUy&expires_in=3600&scope=%3Cstring%3E&resource=https%3A%2F%2Fapi.example.com")
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.sandbox.getasset.com/v0/auth/token")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("client_id=%3Cstring%3E&client_secret=The%20oauth%20client%20secret&grant_type=client_credentials&business_id=biz_GA6EG2qFxA97NZHtxeLPUy&expires_in=3600&scope=%3Cstring%3E&resource=https%3A%2F%2Fapi.example.com")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.getasset.com/v0/auth/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=The%20oauth%20client%20secret&grant_type=client_credentials&business_id=biz_GA6EG2qFxA97NZHtxeLPUy&expires_in=3600&scope=%3Cstring%3E&resource=https%3A%2F%2Fapi.example.com"
response = http.request(request)
puts response.read_body{
"access_token": "<string>",
"expires_in": 123,
"token_type": "Bearer"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}Body
application/x-www-form-urlencoded
The oauth client id
The grant type. Defaults to client_credentials
Available options:
client_credentials Scope the access token to a specific business
Example:
"biz_GA6EG2qFxA97NZHtxeLPUy"
Access token expiration time in seconds
Space-separated list of requested scopes, e.g. 'ledger:read invoice:create'
RFC 8707 resource indicator(s) identifying the protected resource(s) where the token is intended to be used. Sets the JWT aud claim. Each value must be an absolute URI with no fragment. May be repeated. Defaults to the current host.
Example:
["https://api.example.com"]
⌘I
Get an Access Token
curl --request POST \
--url https://api.sandbox.getasset.com/v0/auth/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'client_id=<string>' \
--data 'client_secret=The oauth client secret' \
--data grant_type=client_credentials \
--data business_id=biz_GA6EG2qFxA97NZHtxeLPUy \
--data expires_in=3600 \
--data 'scope=<string>' \
--data resource=https://api.example.comimport requests
url = "https://api.sandbox.getasset.com/v0/auth/token"
payload = {
"client_id": "<string>",
"client_secret": "The oauth client secret",
"grant_type": "client_credentials",
"business_id": "biz_GA6EG2qFxA97NZHtxeLPUy",
"expires_in": "3600",
"scope": "<string>",
"resource": "https://api.example.com"
}
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: 'The oauth client secret',
grant_type: 'client_credentials',
business_id: 'biz_GA6EG2qFxA97NZHtxeLPUy',
expires_in: '3600',
scope: '<string>',
resource: 'https://api.example.com'
})
};
fetch('https://api.sandbox.getasset.com/v0/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.sandbox.getasset.com/v0/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 => "client_id=%3Cstring%3E&client_secret=The%20oauth%20client%20secret&grant_type=client_credentials&business_id=biz_GA6EG2qFxA97NZHtxeLPUy&expires_in=3600&scope=%3Cstring%3E&resource=https%3A%2F%2Fapi.example.com",
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.sandbox.getasset.com/v0/auth/token"
payload := strings.NewReader("client_id=%3Cstring%3E&client_secret=The%20oauth%20client%20secret&grant_type=client_credentials&business_id=biz_GA6EG2qFxA97NZHtxeLPUy&expires_in=3600&scope=%3Cstring%3E&resource=https%3A%2F%2Fapi.example.com")
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.sandbox.getasset.com/v0/auth/token")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("client_id=%3Cstring%3E&client_secret=The%20oauth%20client%20secret&grant_type=client_credentials&business_id=biz_GA6EG2qFxA97NZHtxeLPUy&expires_in=3600&scope=%3Cstring%3E&resource=https%3A%2F%2Fapi.example.com")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.getasset.com/v0/auth/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=The%20oauth%20client%20secret&grant_type=client_credentials&business_id=biz_GA6EG2qFxA97NZHtxeLPUy&expires_in=3600&scope=%3Cstring%3E&resource=https%3A%2F%2Fapi.example.com"
response = http.request(request)
puts response.read_body{
"access_token": "<string>",
"expires_in": 123,
"token_type": "Bearer"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}