Request OAuth2 token
curl --request POST \
--url https://api.enterprise.sandbox.uphold.com/core/oauth2/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data grant_type=client_credentials \
--data 'scope=users:* users.kyc:read'import requests
url = "https://api.enterprise.sandbox.uphold.com/core/oauth2/token"
payload = {
"grant_type": "client_credentials",
"scope": "users:* users.kyc:read"
}
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', scope: 'users:* users.kyc:read'})
};
fetch('https://api.enterprise.sandbox.uphold.com/core/oauth2/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.enterprise.sandbox.uphold.com/core/oauth2/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&scope=users%3A%2A%20users.kyc%3Aread",
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.enterprise.sandbox.uphold.com/core/oauth2/token"
payload := strings.NewReader("grant_type=client_credentials&scope=users%3A%2A%20users.kyc%3Aread")
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.enterprise.sandbox.uphold.com/core/oauth2/token")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("grant_type=client_credentials&scope=users%3A%2A%20users.kyc%3Aread")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.enterprise.sandbox.uphold.com/core/oauth2/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&scope=users%3A%2A%20users.kyc%3Aread"
response = http.request(request)
puts response.read_body{
"access_token": "eyJhbGciOiJIUzI1NiIsI...",
"expires_in": 600,
"scope": "users:* users.kyc:read",
"token_type": "Bearer"
}Authentication
Request OAuth2 token
Request an access token using OAuth2 protocol.
POST
/
core
/
oauth2
/
token
Request OAuth2 token
curl --request POST \
--url https://api.enterprise.sandbox.uphold.com/core/oauth2/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data grant_type=client_credentials \
--data 'scope=users:* users.kyc:read'import requests
url = "https://api.enterprise.sandbox.uphold.com/core/oauth2/token"
payload = {
"grant_type": "client_credentials",
"scope": "users:* users.kyc:read"
}
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', scope: 'users:* users.kyc:read'})
};
fetch('https://api.enterprise.sandbox.uphold.com/core/oauth2/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.enterprise.sandbox.uphold.com/core/oauth2/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&scope=users%3A%2A%20users.kyc%3Aread",
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.enterprise.sandbox.uphold.com/core/oauth2/token"
payload := strings.NewReader("grant_type=client_credentials&scope=users%3A%2A%20users.kyc%3Aread")
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.enterprise.sandbox.uphold.com/core/oauth2/token")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("grant_type=client_credentials&scope=users%3A%2A%20users.kyc%3Aread")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.enterprise.sandbox.uphold.com/core/oauth2/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&scope=users%3A%2A%20users.kyc%3Aread"
response = http.request(request)
puts response.read_body{
"access_token": "eyJhbGciOiJIUzI1NiIsI...",
"expires_in": 600,
"scope": "users:* users.kyc:read",
"token_type": "Bearer"
}Headers
Basic authentication credentials, in the format Basic <base64(client_id:client_secret)>.
Body
application/x-www-form-urlencoded
Response
Token created successfully.
The access token string issued.
The number of seconds until the token expires.
Available options:
Bearer The refresh token string issued (only applicable to certain grant types).
The list of scopes, delimited with spaces.
Was this page helpful?
⌘I