{"openapi":"3.0.0","info":{"title":"Purch API","version":"1.0.0","description":"x402-enabled e-commerce API for creating crypto-powered product orders on Amazon, Shopify, and other platforms. Payments are processed using the x402 protocol with USDC on Solana.","contact":{"name":"Purch","url":"https://github.com/purch-xyz/purch-api"},"license":{"name":"MIT"}},"servers":[{"url":"https://x402.purch.xyz","description":"API Server"}],"tags":[{"name":"orders","description":"Order creation and management"},{"name":"health","description":"Health check endpoints"}],"paths":{"/":{"get":{"summary":"API Information","description":"Get API metadata and available endpoints","tags":["health"],"responses":{"200":{"description":"API information","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"version":{"type":"string"},"description":{"type":"string"},"protocol":{"type":"string"},"documentation":{"type":"string"},"endpoints":{"type":"array"}}}}}}}}},"/health":{"get":{"summary":"Health Check","description":"Check API health status","tags":["health"],"responses":{"200":{"description":"Service is healthy","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"ok"},"service":{"type":"string","example":"purch-api"}}}}}}}}},"/orders/solana":{"post":{"summary":"Create Order (Solana)","description":"Create an e-commerce order paid with USDC on Solana. Supports Amazon, Shopify, and browser automation platforms. Requires x402 payment of $0.01 USDC.","tags":["orders"],"x-x402":{"price":"$0.01","network":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","token":"USDC","required":true},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email","payerAddress","productUrl","physicalAddress"],"properties":{"email":{"type":"string","format":"email","description":"Email address for order notifications","example":"customer@example.com"},"payerAddress":{"type":"string","pattern":"^[1-9A-HJ-NP-Za-km-z]{32,44}$","description":"Solana wallet address (base58 format)","example":"9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM"},"productUrl":{"type":"string","format":"uri","description":"Product URL from supported platforms (Amazon, Shopify, browser automation sites)","example":"https://www.amazon.com/dp/B08N5WRWNW"},"physicalAddress":{"type":"object","required":["name","line1","city","postalCode","country"],"properties":{"name":{"type":"string","description":"Recipient name","example":"John Doe"},"line1":{"type":"string","description":"Address line 1","example":"123 Main St"},"line2":{"type":"string","description":"Address line 2 (optional)","example":"Apt 4B"},"city":{"type":"string","description":"City","example":"San Francisco"},"state":{"type":"string","description":"State/Province (optional, 2-letter code)","example":"CA"},"postalCode":{"type":"string","description":"Postal code","example":"94102"},"country":{"type":"string","pattern":"^[A-Z]{2}$","description":"ISO 3166-1 alpha-2 country code","example":"US"}}},"locale":{"type":"string","description":"Preferred locale (optional)","example":"en-US"}}}}}},"responses":{"201":{"description":"Order created successfully","headers":{"Location":{"description":"Absolute URL for the created order resource","schema":{"type":"string","format":"uri"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"orderId":{"type":"string","format":"uuid","description":"Unique order identifier","example":"550e8400-e29b-41d4-a716-446655440000"},"clientSecret":{"type":"string","description":"Client secret required to check order status","example":"$2b$10$..."},"serializedTransaction":{"type":"string","description":"Base64 encoded serialized Solana transaction ready for signing"}}}}}},"400":{"description":"Invalid request body"},"402":{"description":"Payment Required (x402)","headers":{"X-PAYMENT":{"schema":{"type":"string"},"description":"x402 payment challenge"}}}}}},"/orders/{orderId}":{"get":{"summary":"Get Order Status","description":"Retrieve the status of an order by ID. Requires authorization header with client secret.","tags":["orders"],"parameters":[{"name":"orderId","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Order ID","example":"550e8400-e29b-41d4-a716-446655440000"}],"security":[{"ClientSecret":[]}],"responses":{"200":{"description":"Order status retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"orderId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["pending","processing","completed","failed"],"description":"Current order status"},"createdAt":{"type":"string","format":"date-time","description":"ISO 8601 timestamp"}}}}}},"401":{"description":"Unauthorized - Invalid or missing client secret"},"404":{"description":"Order not found"}}}}},"components":{"securitySchemes":{"ClientSecret":{"type":"apiKey","in":"header","name":"Authorization","description":"Client secret returned from order creation. Used to authenticate order status requests."}}},"externalDocs":{"description":"x402 Protocol Documentation","url":"https://docs.cdp.coinbase.com/x402"}}