Developer Documentation

Welcome to the definitive guide for integrating NoValidate's Machine Learning engine. Protect your e-commerce platform from Return-to-Origin (RTO) fraud in minutes.

Authentication

Every request to the NoValidate API requires a secure API Key. Your API key identifies your store and ensures that risk profiles are accurately tied to your customer base.

You must include your API key in the `Authorization` HTTP header as a Bearer token. You can regenerate your key at any time in your Dashboard Settings.

Authorization: Bearer nv_live_xxxxxxxxxxxxxxxxxxxx

1. Evaluate Risk (Real-Time)

This endpoint should be called right before a user completes checkout, or immediately after an order is placed. The ML engine processes the data instantly and returns a risk score from 0 to 100.

POSThttps://novalidate-five.vercel.app/api/evaluate

Payload Parameters

phone Required
Customer's phone number. Always send with country code (e.g. +91).
price Required
Total numeric order value (e.g. 4500.50).
quantity Required
Total number of items being ordered.
payment_method Required
Selected payment method (e.g., "cod", "credit_card").
category_name Required
Primary product category (e.g., "Mobiles & Tablets").
email Optional
Customer's email address. Securely hashed to improve risk profiling.
discount_amount Optional
Total discount applied to the cart. Default is 0.0.

Integration Examples

const response = await fetch('https://novalidate-five.vercel.app/api/evaluate', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer nv_live_your_api_key',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    phone: '+919876543210',
    email: 'customer@gmail.com',
    price: 2450.00,
    quantity: 1,
    payment_method: 'cod',
    discount_amount: 0.0,
    category_name: 'Women\'s Fashion'
  })
});

const data = await response.json();
if (response.ok) {
  const riskScore = data.order.risk_score;
  const orderId = data.order.id; // SAVE THIS ID!
  console.log(`Order Risk is: ${riskScore}/100`);
}

Response & Recommendations

The API returns a precise risk_score along with an actionable recommendation based on the Custom Thresholds you set in your dashboard's Risk Rules Engine:

  • recommendation: "ALLOW": The risk score is below your Review Threshold. Safe to process and allow Cash on Delivery.
  • recommendation: "REVIEW": The risk score falls within your Review Band. We recommend triggering an OTP verification or flagging for manual review.
  • recommendation: "BLOCK": The risk score is above your Block Threshold. High probability of RTO. We recommend strictly enforcing prepaid or cancelling the order.

Tip: The response also includes a _debug object containing the applied_thresholds so you can always verify exactly which rules were enforced.

2. The Feedback Loop

Fraudsters are constantly evolving, and the best way to protect your store is by building an ironclad history of your customers.

By letting NoValidate know when an order is successfully Delivered or marked as an RTO, you actively teach the Machine Learning model about your specific audience. This creates a powerful, personalized security shield for your store—ensuring that the next time a fraudulent customer tries to place an order, our engine stops them in their tracks before they cost you money.

POSThttps://novalidate-five.vercel.app/api/orders/outcome

Payload Parameters

order_id Required
The UUID string returned from the initial `evaluate` call.
outcome Required
Must be exactly "DELIVERED" or "RTO".
// When a webhook from your courier confirms delivery:
const response = await fetch('https://novalidate-five.vercel.app/api/orders/outcome', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer nv_live_your_api_key',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    order_id: 'a1b2c3d4-5678-90ef-ghij-klmnopqrstuv',
    outcome: 'DELIVERED' // or 'RTO'
  })
});

Edge Cases & Workarounds

1. I don't have a way to track "Delivered" via API/Webhooks

If your platform (like basic Shopify setups or custom stores) cannot automatically send delivery status webhooks to your backend, you can update outcomes asynchronously via CSV uploads or chron jobs.

Workaround: Export a list of completed orders at the end of the week. Write a simple Python/Node script that loops through the CSV and fires the /api/orders/outcome endpoint for each order. It doesn't have to be strictly real-time!

2. What if I can only track "Paid" status, not "Delivered"?

If an order is marked as Paid (especially prepaid orders), the risk of RTO is virtually zero. You can safely map your platform's "PAID" or "COMPLETED" event to the NoValidate "DELIVERED" outcome. We treat them equivalently as "Successful transactions".

3. The customer cancelled the order before shipping

If an order is cancelled by the customer before it ever ships, you should not report it as an RTO. RTO specifically implies shipping costs were wasted. Simply ignore cancelled orders—do not call the outcome API for them.

Crucial: Timeout Strategies

The NoValidate ML engine evaluates orders in under 50ms. However, network latency between your servers and ours can occasionally spike.

Rule of Thumb: Always set a strict timeout of 2.5 to 3.0 seconds on your HTTP request to the /api/evaluate endpoint.

If the request times out, your system must fallback to a "Graceful Fail" state. Do not block the customer from checking out if NoValidate fails to respond. Allow the order to go through normally. It's better to process a potentially risky order than to block a legitimate customer due to a network blip.