Client API

Version 1.5 – Documentation

Swagger Icon Open Swagger UI

🔐 API Overview

The Treova Client API allows you to securely access your KYC submissions. You can filter and retrieve your data directly in your browser (via Swagger) or through commands.

Base URL

https://api.treova.ai/api/client-api

Authentication

Every request requires an x-api-key header. Treova will provide your unique API key.

x-api-key: YOUR_API_KEY

Keep this key safe. Do not share it publicly, as it grants access to your client data.

Option 1 – Use Swagger (Easiest)

  1. Open Swagger UI.
  2. Click the green "Authorize" button.
  3. Paste your API key and click Authorize.
  4. Find the /submissions section.
  5. Click "Try it out", enter filters (optional), then click "Execute".
  6. Your data will appear directly in the browser.

Option 2 – Use Commands (For Full Control)

You can also access the data using curl, which is a command-line tool.

How to run curl commands:

Examples:

1. Get all submissions

curl "https://api.treova.ai/api/client-api/submissions" --header "x-api-key: YOUR_API_KEY"

2. Get only verified submissions

curl "https://api.treova.ai/api/client-api/submissions?status=verified" --header "x-api-key: YOUR_API_KEY"

3. Filter by applicant name

curl "https://api.treova.ai/api/client-api/submissions?name=John" --header "x-api-key: YOUR_API_KEY"

4. Filter by wallet address

curl "https://api.treova.ai/api/client-api/submissions?wallet_address=0xABC123..." --header "x-api-key: YOUR_API_KEY"

5. Filter by date range

curl "https://api.treova.ai/api/client-api/submissions?from=2025-01-01&to=2025-02-01" --header "x-api-key: YOUR_API_KEY"

6. Get only the most recent submission

curl "https://api.treova.ai/api/client-api/submissions?latest=true" --header "x-api-key: YOUR_API_KEY"

After pressing Enter, the results will appear as JSON in your terminal.

Example: Pulling Data into Google Sheets

This example shows how you can pull API data directly into a Google Sheet, no coding experience needed.

Prerequisites

Steps:

  1. Open a new Google Sheet.
  2. Click Extensions > Apps Script.
  3. Remove existing code and paste the following script:

function fetchTreovaSubmissions() {
  const API_KEY = "YOUR_API_KEY"; // Replace with your key
  const API_URL = "https://api.treova.ai/api/client-api/submissions";

  const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  const response = UrlFetchApp.fetch(API_URL, {
    method: "get",
    headers: { "x-api-key": API_KEY }
  });

  const data = JSON.parse(response.getContentText());

  // Column headers
  const headers = [
    "user_id", "campaign_id", "applicant_id", "name", "dob", "address",
    "email", "nationality", "status", "wallet_address", "screening", "comment",
    "createdat", "updatedat"
  ];

  // Write headers if sheet is empty
  if (sheet.getLastRow() === 0) sheet.appendRow(headers);

  // Build a lookup of existing applicant_ids
  const existing = {};
  const existingData = sheet.getDataRange().getValues();
  for (let i = 1; i < existingData.length; i++) {
    existing[existingData[i][2]] = i + 1; // applicant_id column index
  }

  // Update or append rows
  data.data.forEach(item => {
    const row = headers.map(h => item[h] || "");
    if (existing[item.applicant_id]) {
      sheet.getRange(existing[item.applicant_id], 1, 1, headers.length).setValues([row]);
    } else {
      sheet.appendRow(row);
    }
  });
}
        
  1. Replace YOUR_API_KEY with your actual API key.
  2. Click the disk icon to save, name the project “Treova API”.
  3. Click Run ▶ the first time; allow Google permissions.
  4. Back in the sheet, you can now run the script by going to Extensions > Apps Script and clicking the Run ▶ button next to fetchTreovaSubmissions to refresh records.

    Alternatively, you can insert a drawing (a button) in the sheet, right-click on it, choose Assign script, and type fetchTreovaSubmissions. After that, clicking the button will fetch and refresh your data.

The script will fetch all submissions and keep the sheet updated with new or changed data whenever you run it.

📧 Support

For help or additional filters, email info@treova.ai.