ipfs.openx402.ai

Upload files to IPFS with USDC, powered by @openx402

x402 Facilitator: openx402.ai • Base • Solana • Polygon • BSC

Github @openx402
📁

Drop your file here or click to browse

Supports: Images, JSON, Text, PDF, and more

Max file size: 100MB

Selected File:

Simple 2-Step Process

1

Upload File (FREE)

POST /upload - Store in RAM, get file ID

curl -X POST https://ipfs.openx402.ai/upload \
  -F "file=@yourfile.png"

Response: { "id": "abc123", "paymentUrl": "..." }
2

Pin to IPFS (0.01 USDC)

GET /pin/:id - Pay & permanently store on IPFS

curl https://ipfs.openx402.ai/pin/abc123

Response: { "ipfsHash": "QmXxx...", "pinataUrl": "..." }

Developer Guide

How It Works

Upload files to IPFS in 2 simple steps. First upload to RAM (free), then pay 0.01 USDC to permanently pin to IPFS.

JavaScript Example

// Step 1: Upload file to RAM (FREE)
const formData = new FormData();
formData.append('file', yourFile);

const uploadResponse = await fetch('https://ipfs.openx402.ai/upload', {
  method: 'POST',
  body: formData
});

const uploadData = await uploadResponse.json();
console.log('File ID:', uploadData.id);
console.log('Payment URL:', uploadData.paymentUrl);

// Step 2: Pin to IPFS (0.01 USDC)
// Open uploadData.paymentUrl in browser for user to pay
// After payment, file is automatically pinned to IPFS

Python Example

import requests

# Step 1: Upload file to RAM (FREE)
files = {'file': open('yourfile.png', 'rb')}
response = requests.post('https://ipfs.openx402.ai/upload', files=files)

data = response.json()
print(f"File ID: {data['id']}")
print(f"Payment URL: {data['paymentUrl']}")

# Step 2: Pin to IPFS (0.01 USDC)
# Direct user to payment URL, file pins after payment

Response Formats

Step 1 Response (Upload)

{
  "success": true,
  "id": "abc123xyz",
  "filename": "yourfile.png",
  "size": 1024000,
  "expiresIn": "1 hour",
  "paymentUrl": "https://ipfs.openx402.ai/pin/abc123xyz"
}

Step 2 Response (After Payment)

{
  "ipfsHash": "QmXxx...",
  "pinataUrl": "https://gateway.pinata.cloud/ipfs/QmXxx...",
  "fileName": "yourfile.png",
  "fileSize": 1024000
}

Common Errors

❌ Error: "File not found or expired"

Cause: File ID is invalid or expired (files expire after 1 hour)

✅ Fix: Upload the file again and complete payment within 1 hour

❌ Error: "File too large"

Cause: File exceeds 100MB limit

✅ Fix: Compress your file to under 100MB

💡 Why 2 Steps?

This workflow separates file upload from payment, providing a better user experience:

  • Fast uploads: Upload completes instantly without waiting for payment
  • Pay when ready: Users can complete payment at their convenience
  • No wasted uploads: Only pay for files you actually want to keep
  • Simple integration: Easy to implement in your app