API Reference

Fetch All Wallets - /token/wallets

This is your first endpoint! Edit this page to start documenting your API.

Fetch All Wallets

This endpoint allows users to retrieve all wallets using an API KEY.

Authentication

ATTENTION: You Need an API Key Token to Access This Endpoint!

Click here to learn how to create an API Key Token → (API Key Token Guide

This endpoint requires an API KEY token. The token must be sent in the api-token header.

Example:

api-token: <your_api_key_here>

If the token is invalid or missing, the API will return:

{
  "statusCode": 401,
  "message": "Unauthorized"
}

Endpoints

Retrieve all user wallets

Method: GET
URL: /token/wallets Authentication: Required (API Key) Description: Returns all wallets associated with the authenticated user.

Request Example

GET /token/wallets
api-token: <your_api_key_here>

Success Response (200)

[
  {
    "id": "12345",
    "userId": "67890",
    "balance": 1000.50,
    "currency": "USD",
    "createdAt": "2024-03-04T10:15:30Z"
  },
  {
    "id": "54321",
    "userId": "67890",
    "balance": 500.75,
    "currency": "EUR",
    "createdAt": "2024-03-02T09:30:45Z"
  }
]

Possible Errors

Status CodeMessageDescription
401UnauthorizedToken is missing or invalid
500Internal Server ErrorUnexpected server error

Usage Example

To retrieve wallets using curl:

curl -X GET "https://api.zaffex.com/token/wallets" \
  -H "api-token: <your_api_key_here>"

Using JavaScript fetch:

fetch("https://api.zaffex.com/token/wallets", {
  method: "GET",
  headers: {
    "api-token": "<your_api_key_here>"
  }
})
.then(response => response.json())
.then(data => console.log(data));

Using TypeScript with fetch:

async function fetchWallets(apiKey: string): Promise<void> {
  try {
    const response = await fetch("https://api.zaffex.com/token/wallets", {
      method: "GET",
      headers: {
        "api-token": apiKey
      }
    });
    
    if (!response.ok) {
      throw new Error(`HTTP error! Status: ${response.status}`);
    }
    
    const data = await response.json();
    console.log("Wallets:", data);
  } catch (error) {
    console.error("Error fetching wallets:", error);
  }
}

// Usage example:
fetchWallets("<your_api_key_here>");
Language
Click Try It! to start a request and see the response here!