402ify API Reference

Overview

This document covers the 402ify API for creating and managing PayGates (payment-protected API endpoints). For x402-hub protocol endpoints, see x402-hub API Reference.

Base URL

  • Production: https://402ify.com, https://402.sigwei.com

All endpoints use /api/v1/ prefix with standardized responses including API version metadata.

Authentication

402ify uses the same authentication system as x402-hub (SIWE-based wallet signing).

Bearer Token (Required for PayGate Management)

Authorization: Bearer <JWT_TOKEN>

Authentication Flow

Get Authentication Message

GET /api/v1/auth/message?walletAddress=0xYOUR_WALLET

Response:
{
  "message": "402.sigwei.com wants you to sign in with your Ethereum account:\n0x742D35Cc6634C19D8B4e8d5C1234567890123456\n\nI accept the Sigwei Terms of Service: https://402.sigwei.com/tos\n\nURI: https://402.sigwei.com/api/v1/auth\nVersion: 1\nChain ID: 8453\nNonce: abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890\nIssued At: 2024-01-15T10:30:00Z",
  "apiVersion": "v1",
  "timestamp": "2024-01-15T10:30:00Z"
}

SIWE Compliance: Authentication messages follow the Sign-In with Ethereum (EIP-4361) standard with EIP-55 checksummed addresses.

Login with Wallet Signature

Refresh Token

Get Current User

Logout

PayGate Management APIs

List PayGates

Create PayGate (URL)

Multi-Method PayGates

PayGates can support multiple HTTP methods by providing a comma-separated string:

Create PayGate (File)

Get Specific PayGate

Update PayGate

Available Fields:

  • title: Display name for the PayGate (optional)

  • description: Detailed description (optional)

  • price: New price in USDC (e.g., "0.02" for $0.02) (optional)

  • paymentAddress: Blockchain address where payments should be sent (optional, important for security)

  • credits: Number of times a payment can be reused (optional)

  • requireAuth: Whether authentication is required (optional)

  • headerAuthMode: How to send sigwei_secret ("plaintext" or "hmac") (optional)

  • assumeValid: Skip blockchain verification for faster payments (optional, defaults to false)

  • method: HTTP methods as comma-separated string (e.g., "GET,POST,PUT") (optional)

Security Note: The paymentAddress field allows you to update where payments are sent. This is critical for security if your original payment address becomes compromised. All payment addresses are encrypted and stored securely.

Update PayGate Secret

Delete PayGate

Transfer API

Execute USDC Transfer

Premium PayGates API

Create Premium PayGate

Extend Premium PayGate

Dashboard API

Get Statistics

Account Management API

Get Account Tier Information

Response Fields:

  • accountTier: Current account tier ("free", "pro", "max")

  • billingCycle: Billing frequency ("monthly", "yearly")

  • tierUpdatedAt: When tier was last updated (ISO 8601)

  • paygateCount: Current number of PayGates created

  • paygateLimit: Maximum PayGates allowed for this tier

  • rateLimit: Requests per minute per PayGate (0 = unlimited)

  • monthlyPriceUSDC: Monthly price in wei USDC (6 decimals)

  • yearlyPriceUSDC: Yearly price in wei USDC (0 if not available)

Get Billing Information

Response Fields:

  • currentTier: Currently active tier

  • effectiveTier: Tier considering expiration (falls back to "free" if expired)

  • billingCycle: Current billing cycle ("monthly", "yearly")

  • tierExpiresAt: When current tier expires (null for free tier)

  • pendingTier: Tier scheduled to activate after current expires (null if none)

  • pendingExpiresAt: When pending tier will expire (null if no pending tier)

  • accountCreatedAt: Account creation date (ISO 8601)

  • tierLastUpdated: When tier was last modified (ISO 8601)

Update Account Tier

Request Body:

  • targetTier (required): Target tier ("pro", "max")

  • billingCycle (optional): "monthly" or "yearly" (defaults to "monthly")

  • duration (optional): Number of billing cycles (defaults to 1)

Response Fields:

  • success: Whether update was successful

  • newTier: The tier that was set

  • message: Human-readable status message

  • effectiveDate: When the change takes effect (upgrades immediate, downgrades at expiration)

Tier Behavior:

  • Upgrades: Applied immediately with new expiration date

  • Downgrades/Extensions: Scheduled as pending, activate when current tier expires

  • Free to Paid: Always immediate upgrade

  • Paid to Free: Only when current paid tier expires

Available Tiers:

  • Free: 10 PayGates, 5 req/min per PayGate, $0/month

  • Pro: 20 PayGates, 60 req/min per PayGate, $20/month or $200/year

  • Max: 100 PayGates, unlimited req/min, $100/month (no yearly option)

Transaction History API

Get Transaction History

PayGate Access

Standard Payment Flow

Access any PayGate using its short code. PayGates support the HTTP methods they were configured with:

Authentication-Required PayGate

For PayGates with requireAuth: true:

Health Check

API Health

Error Response Format

All errors return structured responses:

Common HTTP status codes:

  • 400 - Bad Request (validation errors)

  • 401 - Unauthorized (missing or invalid authentication)

  • 402 - Payment Required (x402 flow initiation)

  • 403 - Forbidden (valid auth but insufficient permissions)

  • 404 - Not Found (PayGate or resource not found)

  • 429 - Too Many Requests (rate limiting)

  • 500 - Internal Server Error

Last updated