OpenAPI reference

OpenAPI Reference

Use the OpenAPI document to generate clients, inspect request and response schemas, and validate Primitive402 integrations against the same route contract served at /openapi.json.

Current production mode: Base mainnet USDC billing beta on primitive402.dev.
status.json is the live source Billing policy Mainnet readiness Mainnet monitoring

Machine-readable source of truth

/openapi.json is the canonical OpenAPI 3.1 contract for Primitive402. This page is a static, CSP-safe reference rendered from that same document.

Open raw JSON
OpenAPI version 3.1.0
API version 0.16.0
Server URL https://primitive402.dev

Developer links

Use the tool pages for examples and field guidance, the catalog pages for discovery metadata, and the raw OpenAPI JSON with external OpenAPI tools when you want a generated client or validator.

Local /v1 routes

Development and demo routes with the same request and response schemas as the paid aliases.

7 routes
POST /v1/safe-fetch-url

Safe Fetch URL

Fetches a public HTTP or HTTPS URL after SSRF checks, follows only safe redirects, restricts response size and content type, extracts readable text or markdown, hashes the returned content, and optionally includes deterministic prompt-injection risk signals.

POST /v1/safe-fetch-url
POST /v1/extract-return-policy

Extract Return Policy

Fetches a public HTTP or HTTPS page through Primitive402's SSRF-protected safe-fetch pipeline, extracts readable text, and applies deterministic policy rules to identify return windows, free return signals, restocking fees, refund methods, exchange terms, cancellation terms, warranty mentions, important conditions, snippets, confidence, and content hashes.

POST /v1/extract-return-policy
POST /v1/extract-subscription-terms

Extract Subscription Terms

Fetches a public HTTP or HTTPS page through Primitive402's SSRF-protected safe-fetch pipeline, extracts readable text, and applies deterministic subscription-term rules to identify trial availability and length, billing frequency, renewal type, renewal and introductory pricing mentions, cancellation terms, refund terms, minimum commitments, notice periods, price-change language, important conditions, snippets, confidence, and content hashes.

POST /v1/extract-subscription-terms
POST /v1/check-product-fit

Check Product Fit

Fetches a public HTTP or HTTPS product page through Primitive402's SSRF-protected safe-fetch pipeline, extracts readable text, and applies deterministic product-fit rules to detect a conservative price mention, match buyer constraints, flag avoid terms, find compatibility and shipping or availability notes, score fit, return confidence, snippets, and content hashes.

POST /v1/check-product-fit

Discovery and status routes

The current OpenAPI spec focuses on Primitive402 tool routes. Discovery documents are linked from this page and the docs home.

Schema components

Input and output models are listed by their actual components.schemas names from /openapi.json.

15 schemas

Route-to-schema index

Tool Local route x402 route Input Output
safe_fetch_url /v1/safe-fetch-url /x402/v1/safe-fetch-url SafeFetchUrlInput SafeFetchUrlOutput
check_prompt_injection_risk /v1/check-prompt-injection-risk /x402/v1/check-prompt-injection-risk PromptInjectionRiskInput PromptInjectionRiskOutput
verify_claim_against_source /v1/verify-claim-against-source /x402/v1/verify-claim-against-source VerifyClaimAgainstSourceInput VerifyClaimAgainstSourceOutput
create_page_proof /v1/create-page-proof /x402/v1/create-page-proof CreatePageProofInput CreatePageProofOutput
extract_return_policy /v1/extract-return-policy /x402/v1/extract-return-policy ExtractReturnPolicyInput ExtractReturnPolicyOutput
extract_subscription_terms /v1/extract-subscription-terms /x402/v1/extract-subscription-terms ExtractSubscriptionTermsInput ExtractSubscriptionTermsOutput
check_product_fit /v1/check-product-fit /x402/v1/check-product-fit CheckProductFitInput CheckProductFitOutput

Scrollable JSON preview

This abbreviated preview is for scanning. The complete machine-readable file remains /openapi.json.

Show OpenAPI JSON preview
{
  "openapi": "3.1.0",
  "info": {
    "title": "Primitive402 API",
    "version": "0.16.0",
    "description": "Tiny paid tools for AI agents. Composable x402 microtools for safe web ingestion, source verification, page proofs, return policy extraction, subscription terms extraction, and product-fit checks."
  },
  "servers": [
    {
      "url": "https://primitive402.dev",
      "description": "Configured public API base URL"
    }
  ],
  "paths": [
    "/v1/safe-fetch-url",
    "/x402/v1/safe-fetch-url",
    "/v1/check-prompt-injection-risk",
    "/x402/v1/check-prompt-injection-risk",
    "/v1/verify-claim-against-source",
    "/x402/v1/verify-claim-against-source",
    "/v1/create-page-proof",
    "/x402/v1/create-page-proof",
    "/v1/extract-return-policy",
    "/x402/v1/extract-return-policy",
    "/v1/extract-subscription-terms",
    "/x402/v1/extract-subscription-terms",
    "/v1/check-product-fit",
    "/x402/v1/check-product-fit"
  ],
  "components": {
    "schemas": [
      "ErrorResponse",
      "SafeFetchUrlInput",
      "SafeFetchUrlOutput",
      "PromptInjectionRiskInput",
      "PromptInjectionRiskOutput",
      "VerifyClaimAgainstSourceInput",
      "VerifyClaimAgainstSourceOutput",
      "CreatePageProofInput",
      "CreatePageProofOutput",
      "CheckProductFitInput",
      "CheckProductFitOutput",
      "ExtractReturnPolicyInput",
      "ExtractReturnPolicyOutput",
      "ExtractSubscriptionTermsInput",
      "ExtractSubscriptionTermsOutput"
    ]
  }
}

Viewer decision

This reference intentionally improves the existing custom viewer instead of adding Swagger UI, Scalar, or Redoc. Those viewers are useful with external tooling, but this public docs page stays dependency-light, self-hosted, and compatible with style-src 'self' and script-src 'self' without inline scripts or CDN assets.