Skip to content

🔍 Check If a User is a MatchID User

You can verify whether a user already exists in the MatchID system by submitting the platform name and the unique user ID on that platform. This is info is available after your users login with MatchID. Remember to manage them properly within your facilities if needed.

🧭 Supported Platforms

TypePlatform NamePlatform UID Example
SocialTelegram, Twitter, Discord, GitHub, YouTube, Facebook, LinkedIn1234567890 (user ID on that platform)
WalletEVM, BTC, TRON, TON, SOL0x1234abcd... (wallet addr)
EmailEmail1234567890 (user ID on that platform)

✅ Endpoint

http
POST https://api.matchid.ai/api/v1/partner/user/exists

📥 Request Structure

You must send a signed request using your APP_ID and SECRET_KEY.

📌 Request Body (JSON)

json
{
  "requestBody": "{\"platform\":\"Telegram\",\"platform_uid\":\"1234567890\"}"
}

The value of requestBody must be a JSON stringified object.

🔐 Headers

HeaderDescription
Content-Typeapplication/json
appidYour MatchID App ID
timestampCurrent Unix timestamp (milliseconds)
signBase64-encoded HMAC-SHA256 of timestamp + method + path + body

🔏 Signature Example

js
const signatureBase = timestamp + method + endpoint + body;
const signature = CryptoJS.HmacSHA256(signatureBase, SECRET_KEY);
const sign = CryptoJS.enc.Base64.stringify(signature);

📄 Response

✅ If the User Exists

json
{
  "code": 0,
  "data": {
    "did": "did:matchid:ff5g67ghtyjkklopor8sieppy",
    "mid": "0xt123gh90g9860t5623gg00x451298225t7898ftt"
  },
  "message": "successfully"
}

🔁 Full Example (Node.js + Axios)

js
const axios = require("axios");
const CryptoJS = require("crypto-js");

// === CONFIG ===
const APP_ID = "your app id";
const SECRET_KEY = "your app secret";

const BASE_URL = "https://api.matchid.ai";
const ENDPOINT = "/api/v1/partner/user/exists";

const platform = "Telegram";       // or "EVM", "Email", etc.
const platform_uid = "1234567890"; // user ID or wallet address retrieved in your dapp after users logged in with MatchID

// === Step 1: Prepare body ===
const body = JSON.stringify({ platform, platform_uid });
const requestBody = { requestBody: body };

// === Step 2: Generate signature ===
const timestamp = Date.now().toString();
const method = "POST";
const signatureBase = timestamp + method + ENDPOINT + body;

const signature = CryptoJS.HmacSHA256(signatureBase, SECRET_KEY);
const sign = CryptoJS.enc.Base64.stringify(signature);

// === Step 3: Send request ===
axios.post(`${BASE_URL}${ENDPOINT}`, requestBody, {
  headers: {
    "Content-Type": "application/json",
    "appid": APP_ID,
    "timestamp": timestamp,
    "sign": sign
  }
})
.then(res => {
  console.log("✅ Success:\n", JSON.stringify(res.data, null, 2));
})
.catch(err => {
  console.error("❌ Error:\n", err.response?.data || err.message);
});