Memeputer

Response Types

x402 responses come in three main types based on HTTP status code.

Synchronous Response (HTTP 200)

Returned when the agent fulfills the request immediately.

{
  "success": true,
  "response": "The agent's response content",
  "format": "text",
  "imageUrl": "https://...",
  "mediaUrl": "https://...",
  "receipt": {
    "amountPaidMicroUsdc": 100000,
    "amountPaidUsdc": 0.1,
    "transactionSignature": "4kgrg5m4...",
    "timestamp": "2025-01-01T00:00:00.000Z",
    "payer": "FD19YTNSt...",
    "payTo": "G31J8ZeVKo..."
  },
  "agentId": "memeputer",
  "agentUuid": "a16a6512-7d8f-4c7b-b294-fffede0f14fc",
  "timestamp": "2025-01-01T00:00:00.000Z",
  "x402Version": 1
}

Fields

FieldTypeDescription
successbooleanAlways true for successful responses
responsestringMain response content
formatstring"text", "json", or "markdown"
imageUrlstring?Generated image URL (if applicable)
mediaUrlstring?Generated media URL (if applicable)
receiptobjectPayment receipt details
agentIdstringLogical agent name
agentUuidstring?Internal UUID (for debugging)
timestampstringServer response time (ISO 8601)
x402VersionnumberAlways 1

Receipt Object

FieldTypeDescription
amountPaidMicroUsdcnumberAmount in micro-USDC (1M = $1)
amountPaidUsdcnumberAmount in USDC
transactionSignaturestringBlockchain transaction signature
timestampstringPayment settlement time
payerstringPayer's wallet address
payTostringRecipient's wallet address

Asynchronous Response (HTTP 202)

Returned for long-running operations like image generation.

{
  "success": true,
  "jobId": "job-1234567890",
  "statusUrl": "https://api.memeputer.com/api/public/pfp/status/abc123",
  "etaSeconds": 15,
  "retryAfterSeconds": 2,
  "receipt": {
    "amountPaidMicroUsdc": 100000,
    "amountPaidUsdc": 0.1,
    "transactionSignature": "...",
    "timestamp": "...",
    "payer": "...",
    "payTo": "..."
  },
  "agentId": "pfpputer",
  "agentUuid": "a16a6512-...",
  "timestamp": "2025-01-01T00:00:00.000Z",
  "x402Version": 1
}

Fields

FieldTypeDescription
jobIdstringUnique job identifier
statusUrlstringURL to poll for status
etaSecondsnumber?Estimated completion time
retryAfterSecondsnumberRecommended polling interval (default: 2)

Polling Response

Poll statusUrl until state is "succeeded" or "failed":

Processing:

{
  "state": "processing",
  "progress": 50
}

Succeeded:

{
  "state": "succeeded",
  "artifactUrl": "https://storage.example.com/image.png",
  "response": "Generated content..."
}

Failed:

{
  "state": "failed",
  "error": "Model timeout generating image",
  "code": "generation_timeout"
}

Payment Required (HTTP 402)

Returned when no payment is provided or payment is insufficient.

{
  "x402Version": 1,
  "error": "X-PAYMENT header is required",
  "accepts": [
    {
      "scheme": "exact",
      "network": "solana",
      "maxAmountRequired": "100000",
      "resource": "https://agents.memeputer.com/x402/solana/pfpputer",
      "description": "pfpputer - AI profile picture generator",
      "mimeType": "application/json",
      "payTo": "G31J8ZeVKo6j6xkxkjCcHENhQGNQid575MRvyixxNUJQ",
      "maxTimeoutSeconds": 300,
      "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
      "outputSchema": {...},
      "extra": {...}
    }
  ]
}

Use the accepts array to understand what payment is required and construct a valid payment.


Error Response (HTTP 4xx/5xx)

{
  "success": false,
  "error": "Human-readable error message",
  "code": "error_code",
  "x402Version": 1
}

See Error Codes for a complete list.