Skip to navigation Skip to main content
Free on WordPress.org 4.9 / 5 WordPress.org Explore both Plugins
Free on WordPress.org 4.9 / 5 WordPress.org Explore both Plugins
  • WordPress
    Products
    Smart Cycle DiscountsDiscount automation › TrustLensCustomer trust intel › Cycle AI AIPlain-English campaigns ›
    New pluginComing soon
    Resources & toolsDocs, pricing, support ›
    Smart Cycle Discounts

    Smart Cycle Discounts

    Automate WooCommerce discount campaigns — schedule, target, and measure.

    62%
    Free Pro $59 5 discount types Recurring
    Jump into the page
    How it works Capabilities Promo codes Pricing
    Docs
    Getting started Discount types Scheduling
    Explore Smart Cycle Discounts → Changelog
    TrustLens

    TrustLens

    Customer trust intelligence — score buyers, spot abuse, protect revenue.

    Trust 86
    Free Pro $79 6 segments Abuse detection
    Jump into the page
    How it works Detection Outcomes Pricing
    Docs
    Trust scoring Detection modules Card-testing defense
    Explore TrustLens → Verify a report Changelog

    Cycle AI inside Smart Cycle Discounts

    Describe a sale in plain English — Cycle AI builds the whole campaign.

    “20% off hoodies this weekend”
    Included in Pro Natural language Catalog-aware
    See it work

    Type a sentence, get a ready-to-launch discount campaign that already understands your products, prices, and schedule.

    Live demo How it works
    Meet Cycle AI →

    A new plugin Coming soon

    Something is loading in the lab. Join the list to get the reveal first.

    Notify me on launch →

    Resources & tools

    Everything around the plugins — docs, free tools, and help.

    Learn
    Documentation Pricing & bundle Support
    Free tools
    Discount Calculator Sale Calendar
    Stay current
    SCD changelog TrustLens changelog
    Compare all plans →
    Secure checkout WordPress.org 14-day refund View pricing →
  • Affiliate
    Program
    OverviewHow the program works How it works4 steps from apply to earn Commission details30% · 60-day cookie · recurring
    Get started
    Apply nowOpen Takes ~2 minutes Earnings calculatorEstimate your monthly income FAQPayouts, cookies, renewals
    Resources
    Brand kitLogos, banners, copy, social PlaybookTactics that actually convert FTC disclosureHow to disclose properly Affiliate termsFull program agreement Contact teamOpen the contact form
    Earn 30% recurring on every saleFree to join · 60-day cookie · monthly PayPal payouts Apply now
  • Blog
  • DOCS
    Docs & resources

    Guides, references, and answers for every Webstepper plugin.

    Smart Cycle DiscountsAutomated WooCommerce discount campaigns
    Getting started› Discount types› Cycle AI›
    TrustLensCustomer trust & fraud intelligence
    Trust scoring› Detection modules› Card-testing defense›
    Docs home Guides FAQ Pricing Support
    WordPress tools that solve real problems
  • Contact Us
  • About
    Company

    Our Story

    Founded 2020

    Built by store owners, for store owners. We make WordPress tools that solve real problems.

    Learn more
    Built from experienceTools we use ourselves
    Time is preciousSimple, intuitive UX
    Real supportTalk to the founders
    Legal & contact
    Contact us Privacy policy Terms of service Refund policy
    14-day money-backNo questions asked
Popular requests
  • smart cycle discounts
  • trustlens
  • chargeback protection
GET STARTED

Glossary

1
  • TrustLens Glossary

Detection Modules

9
  • Card Testing Defense
  • Chargeback Tracking
  • Shipping Anomalies
  • Linked Accounts Detection
  • Category Aware Risk
  • Coupon Abuse Detection
  • Order Pattern Analysis
  • Return Abuse Detection
  • Modules Overview

Card Testing Defense

9
  • Attack History
  • Allowlists
  • Geo Diversity
  • Auto Escalation
  • Fingerprinting
  • VIP Bypass
  • Panic Button
  • Velocity Thresholds
  • Overview

Chargeback Monitor

7
  • Ratio Email Alerts
  • Dispute Evidence Report
  • Chargeback Monitor
  • Manual Dispute Entry
  • Stripe WooPayments Ingestion
  • Card Network Thresholds
  • Chargeback Ratio Speedometer

Customer Management

7
  • Admin Notes
  • Checkout Enforcement
  • Order Trust Column
  • Bulk Actions
  • Blocking and Allowlisting
  • Customer Detail Profile
  • Customer List

Automation

7
  • Async Dispatch Retries
  • Webhooks and HMAC
  • Rule Inspector
  • Actions Reference
  • Conditions Reference
  • Triggers Reference
  • Automation Overview

Trust Scoring

5
  • Account Age Loyalty Bonus
  • Signals Explained
  • Six Customer Segments
  • The 0–100 Score
  • How Trust Scoring Works
View Categories
  • Home
  • Docs
  • Trustlens
  • Developer Documentation
  • REST API Reference

REST API Reference

6 min read

TrustLens exposes a REST API for integrations. This page documents every endpoint with its request and response shape. The API is implemented in includes/class-rest-api.php and registered under the trustlens/v1 namespace.

Base URL: https://yoursite.com/wp-json/trustlens/v1


Authentication #

Every endpoint requires authentication. The plugin accepts two mechanisms:

Method 1 — WordPress User Authentication #

Any authenticated WordPress user with the manage_woocommerce capability can call the API. The most common implementation is the WordPress application-password feature:

  1. WordPress → Users → Edit your user
  2. Scroll to Application Passwords
  3. Add a new password (e.g. “TrustLens integration”)
  4. Use the username and generated password in HTTP Basic Auth
curl -u username:app_password \
  https://yoursite.com/wp-json/trustlens/v1/customers

Cookie-based authentication for browser requests also works as long as the logged-in user has manage_woocommerce.

Method 2 — TrustLens API Key #

For integrations that don’t have a WordPress user, TrustLens supports a static API key. The key is stored as a SHA-256 hash in the trustlens_api_key WordPress option and compared with hash_equals() for timing-safe matching.

Send the key in the X-TrustLens-API-Key request header:

curl -H "X-TrustLens-API-Key: your_api_key_here" \
  https://yoursite.com/wp-json/trustlens/v1/customers

Configure the key in TrustLens → Settings → API.


The Eight Endpoints #

Method Path Purpose
GET /customers List customers
GET /customers/lookup Look up a customer by raw email
GET /customers/{email_hash} Get customer record by hash
POST/PUT/PATCH /customers/{email_hash} Update customer state (block, allowlist, notes)
GET /customers/{email_hash}/events List events on a customer’s timeline
POST /customers/{email_hash}/recalculate Trigger immediate score recalculation
GET /stats Store-wide aggregate statistics
GET /stats/segments Segment distribution counts

The {email_hash} parameter is the keyed HMAC-SHA256 hash of the customer’s email (64 hex characters). Use /customers/lookup?email=... if you only have the raw email.


GET /customers #

Paginated list of customers with optional filters.

Query Parameters #

Param Description
page, per_page Standard pagination
segment Filter to one of: vip, trusted, normal, caution, risk, critical
min_score, max_score Trust score range filter
is_blocked, is_allowlisted Boolean filters
orderby, order Sort field and direction

Response includes X-WP-Total and X-WP-TotalPages headers in the standard WordPress REST convention.


GET /customers/lookup #

Look up a customer by raw email address. TrustLens hashes the email server-side and returns the matching customer record.

Query Parameters #

  • email (required) — raw email address

Returns the same payload as GET /customers/{email_hash}.


GET /customers/{email_hash} #

Get the full customer record.

Response (typical) #

{
  "email_hash": "...",
  "customer_email": "...",
  "trust_score": 75,
  "segment": "trusted",
  "is_blocked": false,
  "is_allowlisted": false,
  "total_orders": 12,
  "total_order_value": 1450.00,
  "total_refunds": 1,
  "full_refunds": 0,
  "partial_refunds": 1,
  "total_refund_value": 89.00,
  "return_rate": 8.33,
  "total_disputes": 0,
  "disputes_won": 0,
  "disputes_lost": 0,
  "total_coupons_used": 2,
  "first_order_coupons": 1,
  "coupon_then_refund": 0,
  "linked_accounts": 0,
  "first_order_date": "2023-04-15 10:30:00",
  "last_order_date": "2024-03-10 14:22:00",
  "score_updated_at": "2024-03-10 14:25:00",
  "admin_notes": "..."
}

Returns 404 if the hash doesn’t match any customer.


POST/PUT/PATCH /customers/{email_hash} #

Update mutable state on a customer record. The same endpoint is used for blocking, allowlisting, and editing admin notes — there are no separate /block or /allowlist endpoints.

Updatable Fields #

  • is_blocked (boolean)
  • is_allowlisted (boolean)
  • admin_notes (string)
  • tags (array of strings)

Example: Block a Customer #

curl -X PATCH \
  -H "Content-Type: application/json" \
  -H "X-TrustLens-API-Key: ..." \
  -d '{"is_blocked": true}' \
  https://yoursite.com/wp-json/trustlens/v1/customers/{email_hash}

Example: Allowlist a Customer #

{"is_allowlisted": true}

Sending "is_allowlisted": true triggers an automatic score recalculation that locks the score at 100. Removing the allowlist (false) triggers a recalculation that restores the score based on actual signals.

The response is the updated customer record.


GET /customers/{email_hash}/events #

Returns the customer’s event timeline — order placements, refunds, coupon applications, disputes, score updates, admin actions, etc.

Query Parameters #

  • page, per_page — pagination
  • event_type — filter to a specific event type (e.g. order_created)
  • since — ISO 8601 timestamp; return events at or after this time

Response Shape #

{
  "events": [
    {
      "id": 12345,
      "email_hash": "...",
      "event_type": "refund_issued",
      "event_data": { ... },
      "order_id": 5432,
      "created_at": "2024-03-10 14:22:00"
    },
    ...
  ]
}

event_data is a JSON-decoded object whose shape depends on the event type.


POST /customers/{email_hash}/recalculate #

Triggers an immediate, synchronous score recalculation. The recalculated score, segment, and current signal list are returned.

Response #

{
  "score": 52,
  "segment": "normal",
  "signals": [
    { "module": "returns", "score": -10, "reason": "Elevated return rate: 28%" },
    { "module": "account_age", "score": 10, "reason": "Established customer (6+ months)" }
  ]
}

This is the only endpoint that runs scoring inline rather than queueing it via Action Scheduler.


GET /stats #

Aggregate store-wide statistics.

Response (typical) #

{
  "total_scored_customers": 4823,
  "average_trust_score": 64,
  "store_return_rate": 8.4,
  "total_disputes_current_month": 12,
  "blocked_count": 47,
  "allowlisted_count": 89
}

Useful for external dashboards and integrations that want a quick health snapshot.


GET /stats/segments #

Customer count per segment.

Response #

{
  "vip": 127,
  "trusted": 892,
  "normal": 3456,
  "caution": 234,
  "risk": 89,
  "critical": 25
}

Error Format #

Errors follow the WordPress REST convention:

{
  "code": "trustlens_customer_not_found",
  "message": "Customer not found",
  "data": { "status": 404 }
}

Common error codes:

  • 401 — missing or invalid authentication
  • 403 — capability check failed
  • 404 — record not found
  • 400 — invalid request body or parameters

Pagination Headers #

List endpoints (/customers, /customers/{hash}/events) include WordPress’s standard headers:

  • X-WP-Total — total result count
  • X-WP-TotalPages — total page count given the current per_page

What This API Doesn’t Do #

To set expectations clearly:

  • No dispute endpoints. Disputes are not exposed as a standalone resource through the REST API. Dispute counts and outcomes are visible on the customer record’s stat columns. Use the WordPress admin or direct database queries for dispute-specific reads.
  • No health endpoint. No unauthenticated probe endpoint is registered.
  • No automation rule management. Automation rules are configured through the admin UI, not the REST API.
  • No webhook subscription management. Outgoing webhooks are configured per automation rule action through the admin UI.
  • No built-in rate limiting. The plugin does not enforce request-rate limits at the application layer. If you need rate limiting, apply it at the web server, CDN, or reverse-proxy layer.

Versioning #

The namespace trustlens/v1 is the current and only version. Future breaking changes would introduce v2 while keeping v1 available for backward compatibility. Non-breaking additions (new fields, new optional parameters) happen in v1 without a version bump.


Common Integration Patterns #

  • Read customer score from CRM: CRM calls GET /customers/lookup?email=... when displaying a customer record
  • Sync customer state to data warehouse: subscribe to TrustLens automation webhooks (configured per rule) and ingest events
  • Help desk integration: on ticket open, call GET /customers/lookup?email={ticket.requester} to surface trust context to the agent
  • External fraud-rule engine: consume webhook events from your rules, apply external logic, call PATCH /customers/{hash} with is_blocked: true when needed
Updated on June 18, 2026

What are your Feelings

  • Happy
  • Normal
  • Sad

Share This Article :

  • Facebook
  • X
  • LinkedIn
  • Pinterest
Database SchemaHooks and Filters Reference
Table of Contents
  • Authentication
    • Method 1 — WordPress User Authentication
    • Method 2 — TrustLens API Key
  • The Eight Endpoints
  • GET /customers
    • Query Parameters
  • GET /customers/lookup
    • Query Parameters
  • GET /customers/{email_hash}
    • Response (typical)
  • POST/PUT/PATCH /customers/{email_hash}
    • Updatable Fields
    • Example: Block a Customer
    • Example: Allowlist a Customer
  • GET /customers/{email_hash}/events
    • Query Parameters
    • Response Shape
  • POST /customers/{email_hash}/recalculate
    • Response
  • GET /stats
    • Response (typical)
  • GET /stats/segments
    • Response
  • Error Format
  • Pagination Headers
  • What This API Doesn't Do
  • Versioning
  • Common Integration Patterns
Newsletter

Insights that grow your business

Join thousands of WooCommerce store owners who get actionable tips, plugin updates, and industry news every week — plus 10% off either of our plugins as a welcome.

We respect your privacy. Unsubscribe at any time.

10% off welcome gift — A code for either plugin, on us
Weekly updates — Fresh content every Tuesday
Exclusive content — Tips you won't find on our blog
Early access — Be first to know about new plugins
Webstepper
Weekly WooCommerce Tips
Just now
This week: 5 proven strategies to boost your average order value using smart discount campaigns...
10% off inside
Webstepper

Tools for store owners who'd rather grow than grind.

Simple, powerful plugins that help WooCommerce store owners sell more — without the learning curve.

Products

  • Smart Cycle Discounts
  • TrustLens
  • Discount Calculator
  • Sale Calendar

Company

  • About Us
  • Blog
  • Contact
  • Affiliates
  • Log In

Resources

  • Help Center
  • Guides
  • Verify a report
  • Affiliate Program
  • Become a Partner

Questions? We actually answer.

Real humans, real help. No bots, no runaround. Usually within a few hours.

Get in touch
Operated by Setmood LLC · 7901 4th St N, St Petersburg, FL 33702 · United States

© 2026 Webstepper. All rights reserved.

Privacy Terms Refunds
Visa Mastercard PayPal Apple Pay Google Pay & more
Limited Time Offer

Get 10% off
Smart Cycle Discounts or TrustLens

Drop your email and we’ll send you a unique, single-use code — works on either plugin at checkout. New customers, first payment.

23 hours
:
59 minutes
:
59 seconds

No spam. Unsubscribe anytime.

  • WordPress
    Back
    Products
    Smart Cycle DiscountsDiscount automation › TrustLensCustomer trust intel › Cycle AI AIPlain-English campaigns ›
    New pluginComing soon
    Resources & toolsDocs, pricing, support ›
    Smart Cycle Discounts

    Smart Cycle Discounts

    Automate WooCommerce discount campaigns — schedule, target, and measure.

    62%
    Free Pro $59 5 discount types Recurring
    Jump into the page
    How it works Capabilities Promo codes Pricing
    Docs
    Getting started Discount types Scheduling
    Explore Smart Cycle Discounts → Changelog
    TrustLens

    TrustLens

    Customer trust intelligence — score buyers, spot abuse, protect revenue.

    Trust 86
    Free Pro $79 6 segments Abuse detection
    Jump into the page
    How it works Detection Outcomes Pricing
    Docs
    Trust scoring Detection modules Card-testing defense
    Explore TrustLens → Verify a report Changelog

    Cycle AI inside Smart Cycle Discounts

    Describe a sale in plain English — Cycle AI builds the whole campaign.

    “20% off hoodies this weekend”
    Included in Pro Natural language Catalog-aware
    See it work

    Type a sentence, get a ready-to-launch discount campaign that already understands your products, prices, and schedule.

    Live demo How it works
    Meet Cycle AI →

    A new plugin Coming soon

    Something is loading in the lab. Join the list to get the reveal first.

    Notify me on launch →

    Resources & tools

    Everything around the plugins — docs, free tools, and help.

    Learn
    Documentation Pricing & bundle Support
    Free tools
    Discount Calculator Sale Calendar
    Stay current
    SCD changelog TrustLens changelog
    Compare all plans →
    Secure checkout WordPress.org 14-day refund View pricing →
  • Affiliate
    Back
    Program
    OverviewHow the program works How it works4 steps from apply to earn Commission details30% · 60-day cookie · recurring
    Get started
    Apply nowOpen Takes ~2 minutes Earnings calculatorEstimate your monthly income FAQPayouts, cookies, renewals
    Resources
    Brand kitLogos, banners, copy, social PlaybookTactics that actually convert FTC disclosureHow to disclose properly Affiliate termsFull program agreement Contact teamOpen the contact form
    Earn 30% recurring on every saleFree to join · 60-day cookie · monthly PayPal payouts Apply now
  • Blog
  • DOCS
    Back
    Docs & resources

    Guides, references, and answers for every Webstepper plugin.

    Smart Cycle DiscountsAutomated WooCommerce discount campaigns
    Getting started› Discount types› Cycle AI›
    TrustLensCustomer trust & fraud intelligence
    Trust scoring› Detection modules› Card-testing defense›
    Docs home Guides FAQ Pricing Support
    WordPress tools that solve real problems
  • Contact Us
  • About
    Back
    Company

    Our Story

    Founded 2020

    Built by store owners, for store owners. We make WordPress tools that solve real problems.

    Learn more
    Built from experienceTools we use ourselves
    Time is preciousSimple, intuitive UX
    Real supportTalk to the founders
    Legal & contact
    Contact us Privacy policy Terms of service Refund policy
    14-day money-backNo questions asked
We use cookies to improve your experience on our website. By browsing this website, you agree to our use of cookies.
More info More info Accept