🛂Authentication
For authenticating requests with Stampede, we utilise the OAuth 2.0 protocol, specifically using Bearer Tokens. Your integration must include these Bearer Tokens in the request headers to ensure secure and authorised access. This can look like this within your request headers:
authorization: Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXGenerating a client_id & client_secret
client_id & client_secretYou can generate a client_id & client_secret by heading to the Stampede dashboard > Marketplace > API Keys > Create New API Key.
From there, you'll be able to create a new client_id then in return will provide you with a client_secret. Keep it safe so it saves the hassle...
Generating a Bearer Token (also known as app-only)
Generate a Bearer Token
POST ~/oauth/token
Request Body
Name
Type
Description
client_id*
String
client_secret*
String
grant_type*
String
client_credentials
{
"access_token": string,
"expires_in": number,
"token_type": "Bearer",
"scope": "ALL:ALL"
}{
"error": string,
"error_description": string
}Examples
curl --location 'https://global.stampede.ai/oauth/token' \
--header 'Content-Type: application/json' \
--data '{
"client_id": "ai.stampede.marketplace.example",
"client_secret": "XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"grant_type": "client_credentials"
}'const axios = require('axios');
let data = JSON.stringify({
"client_id": "ai.stampede.marketplace.example",
"client_secret": "XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"grant_type": "client_credentials"
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://global.stampede.ai/oauth/token',
headers: {
'Content-Type': 'application/json'
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});<?php
$client = new Client();
$headers = [
'Content-Type' => 'application/json'
];
$body = '{
"client_id": "ai.stampede.marketplace.example",
"client_secret": "XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"grant_type": "client_credentials"
}';
$request = new Request('POST', 'https://global.stampede.ai/oauth/token', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
import http.client
import json
conn = http.client.HTTPSConnection("global.stampede.ai")
payload = json.dumps({
"client_id": "ai.stampede.marketplace.example",
"client_secret": "XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"grant_type": "client_credentials"
})
headers = {
'Content-Type': 'application/json'
}
conn.request("POST", "/oauth/token", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))Last updated
Was this helpful?

