Every request to the Wallet API acts on your own SwapWallet account and is authenticated with your personal API key. Create the key in the app under Profile → API key → Create a new key. It starts with apikey-.
Send the key in the Authorization header of every request, as a bearer token:
Authorization: Bearer apikey-…
The key is built for programs: requests made with it skip the interactive checks the app asks for, such as SMS, email or Google Authenticator codes. Replacing the key in the app (Profile → API key → Replace with a new key) stops the old one at once.
If you need a key limited to certain IP addresses or with narrower permissions, contact SwapWallet support.
The key can trade and withdraw from your account without any further confirmation. Keep it on your server, in an environment variable or a secrets store, never in client code or a repository. If it leaks, replace it in the app right away.
Endpoints
/v1/utils/authentication/checkConfirms that the key in the Authorization header is valid and active. Call it once after setting up your integration, or as a light health check before a batch of requests. It has no other effect.
No parameters.
Returns {"status": "OK"} when the key is valid.
API_KEY_AUTHENTICATION_FAILEDThe key doesn’t exist or was replaced.
INVALID_AUTH_TOKENThe header isn’t in the form Bearer apikey-….
The Authorization header is missing.
USER_ACCOUNT_SUSPENDEDThe account is suspended.
PIN_CODE_REQUIREDThe account has an app PIN code, and the request carries no valid PIN token (X-Pincode-Token).
curl https://swapwallet.app/api/v1/utils/authentication/check \
-H "Authorization: Bearer $SWAPWALLET_API_KEY"const response = await fetch('https://swapwallet.app/api/v1/utils/authentication/check', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.SWAPWALLET_API_KEY}`,
},
});
const data = await response.json();
console.log(data.result);import os
import requests
response = requests.get(
"https://swapwallet.app/api/v1/utils/authentication/check",
headers={"Authorization": f"Bearer {os.environ['SWAPWALLET_API_KEY']}"},
)
print(response.json()["result"])<?php
$ch = curl_init('https://swapwallet.app/api/v1/utils/authentication/check');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SWAPWALLET_API_KEY'),
],
]);
$data = json_decode(curl_exec($ch), true);
print_r($data['result']);package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
req, _ := http.NewRequest("GET", "https://swapwallet.app/api/v1/utils/authentication/check", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("SWAPWALLET_API_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
fmt.Println(string(data))
}{
"status": "OK"
}{
"status": "ERROR",
"error": {
"codeString": "API_KEY_AUTHENTICATION_FAILED",
"message": "API key authentication failed",
"localizedMessage": "API key authentication failed"
}
}