How to read a wallet reputation score from an API
You want a portable reputation number you can store, sort and threshold inside your own product.
The problem
Every app rebuilds reputation from scratch and starts each user at zero. A portable score lets a user arrive already trusted, which raises conversion on the first session instead of the tenth.
Step by step
1. Install the SDK
The TypeScript SDK wraps the REST endpoints, retries and rate-limit headers.
npm i @trustlayer/sdk2. Read a score
Pass an address or a @handle. Both resolve to the same identity record.
import { TrustLayer } from "@trustlayer/sdk"; const tl = new TrustLayer({ apiKey: process.env.TRUSTLAYER_KEY! }); const profile = await tl.verify({ handle: "@tawhid" }); console.log(profile.trust_score, profile.tier);3. Cache it correctly
Scores move slowly. Cache for 5 minutes per address; the API sends Cache-Control headers you can respect directly.
const cached = await kv.get(`tl:${address}`); if (cached) return JSON.parse(cached); const fresh = await tl.verify({ address }); await kv.set(`tl:${address}`, JSON.stringify(fresh), { ex: 300 });4. Show it back to the user
Embedding the live badge is the fastest way to make the score feel real — and it links back so your users can grow their own score.
<iframe src="https://trstlyr.com/embed/tawhid" width="360" height="120" style="border:0" title="TrustLayer score"></iframe>
Share the proof
Once you are live, show it. This badge stays up to date on its own and links visitors back to the verifiable profile behind the score.
<a href="https://trstlyr.com/u/your-handle">
<img src="https://trstlyr.com/badge/your-handle.svg" alt="Verified on TrustLayer" height="28" />
</a>Frequently asked questions
Next recipes
All 6 recipes are on the API recipes index.