● Badge API

    Trustvectr Badge API

    Embed Trustvectr badges in your app, product, or workflow

    Overview

    The Trustvectr Badge API allows you to integrate trust scores and badges directly into your applications, hiring platforms, or partner workflows. Request badge data via REST endpoints or embed pre-rendered SVG badges with a single line of code. Badges are private by default: a user must make their badge public from their dashboard before it can be fetched.

    Base URL: https://aeprjqipyazazsnrlyhc.supabase.co/functions/v1/badge
    Opt-in
    Private by default
    Secure
    Public data only
    Cached
    5 min cache
    REST API
    Simple JSON

    API Endpoints

    GET/badge/:id

    Returns public badge data for a Trustvectr ID. Returns 404 { "error": "not found" } if the badge does not exist or is private.

    Path Parameters
    id – Trustvectr user or organisation ID (e.g., tv_a1b2c3d4e5, shown in the user's dashboard)
    Response (JSON)
    {
      "id": "tv_a1b2c3d4e5",
      "score": 764,
      "band": "verified",
      "trend": "up",
      "vectors": {
        "personal": 780,
        "organisation": 650,
        "content": 540,
        "interaction": 820
      },
      "badgeVariant": "standard",
      "lastUpdated": "2025-11-18T10:23:00Z"
    }
    GET/badge/:id/svg

    Returns a pre-rendered SVG image of the Trustvectr badge.

    Response Type
    image/svg+xml
    Query Parameters (optional)
    variant – compact, standard, or premium (default: standard)
    size – sm, md, or lg (default: md)
    theme – light, dark, or mono (default: light)

    Usage Examples

    764Verified↗
    Trustvectr vector-check logoTrustvectr Score
    764Verified↗
    Trustvectr vector-check logoTrustvectr Score
    764Verified↗
    Trend Up
    personal780
    organisation650
    content540
    interaction820
    tv_a1b2c3d4e5Updated 2025-11-18

    Consuming JSON Data

    Fetch badge data and use it in your application logic

    // Fetch badge data
    fetch("https://aeprjqipyazazsnrlyhc.supabase.co/functions/v1/badge/tv_a1b2c3d4e5")
      .then(res => res.json())
      .then(data => {
        console.log(data.score);      // 764
        console.log(data.band);        // "verified"
        console.log(data.vectors);     // { personal: 780, ... }
      });

    Embedding SVG Badge

    Display the badge as an image in HTML

    <!-- Embed SVG badge -->
    <a href="https://trustvectr.com/u/tv_a1b2c3d4e5">
    <img 
      src="https://aeprjqipyazazsnrlyhc.supabase.co/functions/v1/badge/tv_a1b2c3d4e5/svg" 
      alt="Trustvectr trust badge for public profile tv_a1b2c3d4e5, view the public trust profile"
      width="200"
    />
    </a>

    React Component (Planned, not yet available)

    A planned React helper. This package has not been published yet.

    import { TrustvectrBadgeEmbed } from '@trustvectr/react';
    
    function UserProfile() {
      return (
        <div>
          <h1>Alex Morgan</h1>
          <TrustvectrBadgeEmbed 
            id="tv_a1b2c3d4e5" 
            variant="compact" 
          />
        </div>
      );
    }

    Security & Performance

    Public Data Only

    The Badge API only returns badges their owners have made public, and only the score, band, trend, vector values and last update time. No email, name, proofs or other personal data is included.

    Caching Recommendations

    Successful responses are cached for 5 minutes. We recommend implementing client-side caching with similar TTLs to reduce API calls and improve performance.

    Rate Limits (planned)

    Not yet enforced. Planned limits:
    Free tier: 1,000 requests/day
    Pro tier: 10,000 requests/day
    Enterprise: Custom limits

    CORS Support

    All API endpoints support CORS for browser-based requests. No additional configuration needed.

    Future Extensions

    Planned enhancements to the Badge API:

    • Signed embed tokens – Generate time-limited, signed URLs for badge embeds
    • Custom theming – Specify brand colors and styling via query parameters
    • Vector-specific badges – Request badges for individual trust vectors
    • Webhooks – Receive real-time updates when scores change
    • Batch endpoints – Fetch multiple badges in a single request