{
  "openapi": "3.1.0",
  "info": {
    "title": "AutoPay API",
    "version": "1.5.3",
    "description": "Pay-per-call web page fetch (Markdown) and Base wallet snapshots (synchronous), plus async search, verification, and research. Pay with x402 USDC on Base (X-PAYMENT) or prepaid Stripe credits (Authorization: Bearer ak_live_...). HTTP 402 if unpaid includes x402 v1 accepts plus Stripe links. Paid requests return 202 and are typically ready in 10–20 minutes; poll GET /v1/jobs/{id}.",
    "contact": {
      "name": "Synairo Sp. z o.o.",
      "email": "hello@synairo.com",
      "url": "https://autopay-site-production.up.railway.app"
    },
    "x-guidance": "Use GET /v1/fetch?url= ($0.01) to turn any public web page into clean Markdown instantly, GET /v1/wallet?address= ($0.01) for a Base wallet snapshot, GET /v1/search?query= ($0.01) for cited web search, POST /v1/verify {claim} ($0.08) to fact-check a claim/company/URL, POST /v1/research {question} ($0.30) for a short cited brief. Search/verify/research return 202 + job_id; poll GET /v1/jobs/{id} (free). Pay per call with x402 USDC on Base (X-PAYMENT header) or a prepaid Bearer key."
  },
  "servers": [
    {
      "url": "https://autopay-site-production.up.railway.app"
    }
  ],
  "paths": {
    "/v1/search": {
      "get": {
        "operationId": "search",
        "description": "Queue a cited web lookup. Pay with X-PAYMENT (x402 USDC on Base) or a prepaid API key. Returns 202. Poll /v1/jobs/{id}. Typical ETA 10–20 minutes.",
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-PAYMENT",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Base64-encoded x402 v1 payment payload for USDC on Base."
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "x402": []
          }
        ],
        "responses": {
          "202": {
            "description": "Job queued. Typical turnaround 10–20 minutes. Poll GET /v1/jobs/{id} until status is done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "accepted": {
                      "type": "boolean"
                    },
                    "status": {
                      "type": "string",
                      "example": "queued"
                    },
                    "job_id": {
                      "type": "string"
                    },
                    "poll": {
                      "type": "string"
                    },
                    "eta_minutes": {
                      "type": "object"
                    },
                    "price_usd": {
                      "type": "number"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment required. Body includes x402 v1 accepts and Stripe credit-pack links."
          }
        },
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.01"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        }
      }
    },
    "/v1/verify": {
      "post": {
        "operationId": "verify",
        "description": "Queue a claim/company/URL verification. Pay with X-PAYMENT (x402 USDC on Base) or a prepaid API key. Returns 202. Poll /v1/jobs/{id}. Typical ETA 10–20 minutes.",
        "parameters": [
          {
            "name": "X-PAYMENT",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "claim": {
                    "type": "string"
                  }
                },
                "required": [
                  "claim"
                ]
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {
            "x402": []
          }
        ],
        "responses": {
          "202": {
            "description": "Job queued. Typical turnaround 10–20 minutes. Poll GET /v1/jobs/{id} until status is done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "accepted": {
                      "type": "boolean"
                    },
                    "status": {
                      "type": "string",
                      "example": "queued"
                    },
                    "job_id": {
                      "type": "string"
                    },
                    "poll": {
                      "type": "string"
                    },
                    "eta_minutes": {
                      "type": "object"
                    },
                    "price_usd": {
                      "type": "number"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment required. Body includes x402 v1 accepts and Stripe credit-pack links."
          }
        },
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.08"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        }
      }
    },
    "/v1/research": {
      "post": {
        "operationId": "research",
        "description": "Queue a short cited research brief. Pay with X-PAYMENT (x402 USDC on Base) or a prepaid API key. Returns 202. Poll /v1/jobs/{id}. Typical ETA 10–20 minutes.",
        "parameters": [
          {
            "name": "X-PAYMENT",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "question": {
                    "type": "string"
                  }
                },
                "required": [
                  "question"
                ]
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {
            "x402": []
          }
        ],
        "responses": {
          "202": {
            "description": "Job queued. Typical turnaround 10–20 minutes. Poll GET /v1/jobs/{id} until status is done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "accepted": {
                      "type": "boolean"
                    },
                    "status": {
                      "type": "string",
                      "example": "queued"
                    },
                    "job_id": {
                      "type": "string"
                    },
                    "poll": {
                      "type": "string"
                    },
                    "eta_minutes": {
                      "type": "object"
                    },
                    "price_usd": {
                      "type": "number"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment required. Body includes x402 v1 accepts and Stripe credit-pack links."
          }
        },
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.30"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        }
      }
    },
    "/v1/jobs/{id}": {
      "get": {
        "operationId": "getJob",
        "description": "Poll a job. status is queued, running, done, error, or needs_delivery.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Job"
          },
          "404": {
            "description": "Not found"
          }
        },
        "security": []
      }
    },
    "/v1/fetch": {
      "get": {
        "operationId": "fetchPage",
        "description": "Fetch one public web page and return clean Markdown (title, description, text, optional links). Synchronous, no JavaScript rendering. $0.01 via X-PAYMENT (x402 USDC on Base) or a prepaid API key; charged only on success.",
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uri"
            }
          },
          {
            "name": "max_chars",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 500,
              "maximum": 200000,
              "default": 50000
            }
          },
          {
            "name": "links",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "X-PAYMENT",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "x402": []
          }
        ],
        "x-price-usd": 0.01,
        "responses": {
          "200": {
            "description": "Page as Markdown",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "final_url": {
                      "type": "string"
                    },
                    "status": {
                      "type": "integer"
                    },
                    "title": {
                      "type": "string"
                    },
                    "markdown": {
                      "type": "string"
                    },
                    "chars": {
                      "type": "integer"
                    },
                    "truncated": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid or blocked URL (not charged)"
          },
          "402": {
            "description": "Payment required. Body includes x402 v1 accepts and Stripe credit links."
          },
          "502": {
            "description": "Upstream failed (not charged)"
          }
        },
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.01"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        }
      }
    },
    "/v1/wallet": {
      "get": {
        "operationId": "walletSnapshot",
        "description": "Base mainnet wallet snapshot: ETH balance, USDC balance, nonce, contract check, optional ERC-20 balance via &token=. Synchronous, read-only. $0.01 via X-PAYMENT (x402 USDC on Base) or a prepaid API key; charged only on success.",
        "parameters": [
          {
            "name": "address",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^0x[0-9a-fA-F]{40}$"
            }
          },
          {
            "name": "token",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^0x[0-9a-fA-F]{40}$"
            }
          },
          {
            "name": "X-PAYMENT",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "x402": []
          }
        ],
        "x-price-usd": 0.01,
        "responses": {
          "200": {
            "description": "Wallet snapshot",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "address": {
                      "type": "string"
                    },
                    "block_number": {
                      "type": "integer"
                    },
                    "eth": {
                      "type": "object"
                    },
                    "usdc": {
                      "type": "object"
                    },
                    "nonce": {
                      "type": "integer"
                    },
                    "is_contract": {
                      "type": "boolean"
                    },
                    "token": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid address (not charged)"
          },
          "402": {
            "description": "Payment required. Body includes x402 v1 accepts and Stripe credit links."
          },
          "502": {
            "description": "RPC unavailable (not charged)"
          }
        },
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.01"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        }
      }
    },
    "/v1/balance": {
      "get": {
        "operationId": "balance",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "402": {
            "description": "Payment required"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      },
      "x402": {
        "type": "apiKey",
        "in": "header",
        "name": "X-PAYMENT",
        "description": "x402 v1 payment payload (USDC on Base). Unpaid calls return HTTP 402 with accepts."
      }
    }
  }
}
