Tool reference

Extract Return Policy

Use before a shopping or browser agent recommends, compares, or purchases a product.

Overview

extract_return_policy $0.03 USDC MCP: extract_return_policy SDK: extractReturnPolicy()

Fetches a public return policy or product page and returns conservative structured return, refund, exchange, cancellation, and warranty signals.

POST /v1/extract-return-policy POST /x402/v1/extract-return-policy

When an agent should use it

  • Check whether a merchant appears to allow returns before recommending a product.
  • Attach return-window and refund-method snippets to a commerce workflow decision.
  • Route unclear or low-confidence policy pages to additional research or human review.

Input fields

Schema ref: #/components/schemas/ExtractReturnPolicyInput

FieldRequiredTypeDescription
url required string Public HTTP or HTTPS URL to fetch. Localhost, private IPs, link-local addresses, embedded credentials, unsafe redirects, and non-http(s) schemes are rejected.
strictness optional string Extraction strictness. Allowed values: low, medium, or high. Higher strictness favors fewer guesses and more null fields when policy language is unclear.
maxSnippets optional integer Maximum number of evidence snippets to return. Claim verification allows 1 to 8; commerce extraction allows 1 to 10.
includeRawText optional boolean When true, include raw extracted text in the response. Defaults to false to keep responses compact and avoid returning unnecessary page text.

Output fields

Schema ref: #/components/schemas/ExtractReturnPolicyOutput

FieldRequiredTypeDescription
return_window_days required integer,null Detected return window in days. Null means the page did not clearly state a return window.
free_returns required boolean,null Whether the policy appears to offer free returns. Null means the page did not clearly address return shipping cost.
restocking_fee required string,null Detected restocking fee language. Null means no clear restocking fee statement was found.
exchange_policy required string,null Extracted exchange terms. Null means exchange policy language was not clearly found.
refund_method required string,null Detected refund method, such as original payment method or store credit. Null means unclear.
cancellation_policy required string,null Detected cancellation terms. Null means the page did not clearly address cancellations.
warranty_summary required string,null Short warranty-related summary when warranty language is present. Null means no clear warranty terms were found.
important_conditions required array Important policy conditions such as exclusions, item state, deadlines, or proof-of-purchase requirements.
extracted_snippets required array Short source snippets used by the extraction. Empty array means no concise supporting snippet was available.
confidence required number Number from 0 to 1 expressing how strongly the extracted signals support the result. Lower confidence means the caller should treat the output as tentative or seek review.
content_hash required string Hash of the fetched page content for comparison, caching, and lightweight audit trails.
fetched_at required string ISO timestamp when Primitive402 fetched the source page.
source_url required string Original URL submitted by the caller.
final_url required string,null Final fetched URL after safe redirects. Null means no final URL was available.
raw_text optional string Raw extracted page text. Present only when includeRawText is true.

curl example

curl -s https://primitive402.dev/v1/extract-return-policy \
  -H 'content-type: application/json' \
  -d '{
  "url": "https://example.com/returns",
  "strictness": "medium",
  "maxSnippets": 5
}' | jq

TypeScript SDK example

import { createNano402Client } from "@nano402/api/sdk";

const client = createNano402Client({
  baseUrl: "https://primitive402.dev"
});

const result = await client.extractReturnPolicy({
  "url": "https://example.com/returns",
  "strictness": "medium",
  "maxSnippets": 5
});
console.log(result);

Example response snippet

{
  "return_window_days": 30,
  "free_returns": true,
  "confidence": 0.88
}

Safety notes

  • All requested URLs are checked with SSRF protection before fetching.
  • The response contains policy extraction signals, not legal advice or guaranteed merchant terms.
  • When policy language is unclear, Primitive402 returns null fields and low confidence instead of guessing.

Common errors

  • 400 invalid_request: request body failed validation.
  • 402 payment_required: the x402 route was called without a valid payment header.
  • 429: rate limit exceeded.
  • 500 internal_error: unexpected server error.

Discovery

Back to tool library