Exchange credentials for a token
curl --request POST \
--url https://api.spenza.com/api/v1.1/auth/token \
--header 'Content-Type: application/json' \
--data '
{
"key": "your-api-key",
"secret": "your-api-secret"
}
'import requests
url = "https://api.spenza.com/api/v1.1/auth/token"
payload = {
"key": "your-api-key",
"secret": "your-api-secret"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({key: 'your-api-key', secret: 'your-api-secret'})
};
fetch('https://api.spenza.com/api/v1.1/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.spenza.com/api/v1.1/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 => json_encode([
'key' => 'your-api-key',
'secret' => 'your-api-secret'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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.spenza.com/api/v1.1/auth/token"
payload := strings.NewReader("{\n \"key\": \"your-api-key\",\n \"secret\": \"your-api-secret\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
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.spenza.com/api/v1.1/auth/token")
.header("Content-Type", "application/json")
.body("{\n \"key\": \"your-api-key\",\n \"secret\": \"your-api-secret\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spenza.com/api/v1.1/auth/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"key\": \"your-api-key\",\n \"secret\": \"your-api-secret\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"access_token": "eyJhbGciOiJI…",
"token_type": "Bearer",
"expires_in": 3600,
"expires_at": "2026-07-31T12:00:00.000Z"
},
"meta": {
"timezone": "UTC"
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "One or more fields failed validation.",
"details": {
"validationErrors": [
"key should not be empty",
"secret should not be empty"
]
}
}
}{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid API credentials."
}
}{
"success": false,
"error": {
"code": "FORBIDDEN",
"message": "This feature is not included in your current plan. Please upgrade your plan to access this feature."
}
}{
"success": false,
"error": {
"code": "INTERNAL_ERROR",
"message": "Something is wrong at our end. Our engineers are being notified."
}
}Authentication
Exchange credentials for a token
Exchange your API key and secret for a 1-hour bearer token. This endpoint itself requires no authentication — your key and secret are the credentials being verified.
Note the response fields are snake_case (access_token, not
accessToken) — this endpoint is deliberately OAuth2/RFC 6749-shaped so
existing OAuth2 client libraries work against it. Every other endpoint in
this API uses camelCase.
POST
/
api
/
v1.1
/
auth
/
token
Exchange credentials for a token
curl --request POST \
--url https://api.spenza.com/api/v1.1/auth/token \
--header 'Content-Type: application/json' \
--data '
{
"key": "your-api-key",
"secret": "your-api-secret"
}
'import requests
url = "https://api.spenza.com/api/v1.1/auth/token"
payload = {
"key": "your-api-key",
"secret": "your-api-secret"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({key: 'your-api-key', secret: 'your-api-secret'})
};
fetch('https://api.spenza.com/api/v1.1/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.spenza.com/api/v1.1/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 => json_encode([
'key' => 'your-api-key',
'secret' => 'your-api-secret'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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.spenza.com/api/v1.1/auth/token"
payload := strings.NewReader("{\n \"key\": \"your-api-key\",\n \"secret\": \"your-api-secret\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
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.spenza.com/api/v1.1/auth/token")
.header("Content-Type", "application/json")
.body("{\n \"key\": \"your-api-key\",\n \"secret\": \"your-api-secret\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spenza.com/api/v1.1/auth/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"key\": \"your-api-key\",\n \"secret\": \"your-api-secret\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"access_token": "eyJhbGciOiJI…",
"token_type": "Bearer",
"expires_in": 3600,
"expires_at": "2026-07-31T12:00:00.000Z"
},
"meta": {
"timezone": "UTC"
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "One or more fields failed validation.",
"details": {
"validationErrors": [
"key should not be empty",
"secret should not be empty"
]
}
}
}{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid API credentials."
}
}{
"success": false,
"error": {
"code": "FORBIDDEN",
"message": "This feature is not included in your current plan. Please upgrade your plan to access this feature."
}
}{
"success": false,
"error": {
"code": "INTERNAL_ERROR",
"message": "Something is wrong at our end. Our engineers are being notified."
}
}⌘I

