{
  "openapi": "3.1.0",
  "info": {
    "title": "gofetch",
    "version": "0.7.0",
    "description": "Paid public-page facts for AI agents. Pay per call in USDC on Base (eip155:8453) with x402 v2 via the PayAI facilitator. No JavaScript rendering, no paywall bypass.",
    "x-guidance": "Three pay-per-call routes, no account or API key. GET /v1/fees/base-exact returns the current PayAI exact-scheme settle fee on Base as JSON ($0.005; fresh=1 skips the 8h freshness cache). POST /v1/extract takes a JSON body {url, schema}, where url is a public http(s) page and schema is a JSON Schema for the fields you want; it returns {ok, data} and charges only when ok is true ($0.01). GET /v1/fetch?url=<public page> returns the page as markdown ($0.01; legacy, being retired). Static HTML only: JS-rendered or bot-protected pages make extract return ok:false with error needs_js or blocked and no charge. Unpaid requests get HTTP 402 with an x402 v2 PAYMENT-REQUIRED header; retry with a PAYMENT-SIGNATURE header.",
    "contact": {
      "name": "gofetch",
      "email": "hello@getgofetch.dev",
      "url": "https://getgofetch.dev"
    }
  },
  "servers": [
    {
      "url": "https://getgofetch.dev"
    }
  ],
  "paths": {
    "/v1/fees/base-exact": {
      "get": {
        "operationId": "baseExactFee",
        "summary": "PayAI exact-scheme settle fee on Base",
        "tags": [
          "Fees"
        ],
        "description": "Current PayAI facilitator fee for one exact-scheme settlement on Base, in credits and USD. Source: https://facilitator.payai.network/pricing. Cached up to 8h for freshness; fresh=1 bypasses the cache. $0.005 per call.",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.005000"
          },
          "protocols": [
            {
              "x402": {
                "network": "eip155:8453",
                "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
                "payTo": "0x714F69Aef602c76543AdED914Ea4Eb23fE9F8527"
              }
            }
          ]
        },
        "parameters": [
          {
            "name": "fresh",
            "in": "query",
            "required": false,
            "description": "Set to 1 to bypass the 8h freshness cache",
            "schema": {
              "type": "string",
              "enum": [
                "1"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Fee ticker",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "network": {
                      "type": "string"
                    },
                    "scheme": {
                      "type": "string"
                    },
                    "credits_per_settle": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "usd_per_settle": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "as_of": {
                      "type": "string"
                    },
                    "expires_at": {
                      "type": "string"
                    },
                    "source": {
                      "type": "string"
                    },
                    "cached": {
                      "type": "boolean"
                    },
                    "charged": {
                      "type": "boolean"
                    },
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok"
                  ]
                },
                "example": {
                  "ok": true,
                  "network": "Base",
                  "scheme": "exact (EIP-3009)",
                  "credits_per_settle": 2.12,
                  "usd_per_settle": 0.00212,
                  "as_of": "2026-10-22T00:00:00.000Z",
                  "charged": true
                }
              }
            }
          },
          "402": {
            "description": "Payment Required. x402 v2 challenge in the PAYMENT-REQUIRED header (base64 JSON); the same JSON is in the body.",
            "headers": {
              "PAYMENT-REQUIRED": {
                "description": "Base64-encoded x402 v2 PaymentRequired object",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/v1/extract": {
      "post": {
        "operationId": "extractFields",
        "summary": "Extract JSON fields from a public page",
        "tags": [
          "Extract"
        ],
        "description": "Reads one public page as static HTML (no JavaScript rendering) and returns the fields described by your JSON Schema (max 20 properties). $0.01, charged only when ok is true. JS-only pages return ok:false error needs_js; bot walls return ok:false error blocked; neither is charged.",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.010000"
          },
          "protocols": [
            {
              "x402": {
                "network": "eip155:8453",
                "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
                "payTo": "0x714F69Aef602c76543AdED914Ea4Eb23fE9F8527"
              }
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url",
                  "schema"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri",
                    "description": "Public http(s) page to read",
                    "example": "https://www.rba.gov.au/statistics/cash-rate/"
                  },
                  "schema": {
                    "type": "object",
                    "description": "JSON Schema describing the fields to return",
                    "example": {
                      "type": "object",
                      "properties": {
                        "cash_rate_target": {
                          "type": "number",
                          "description": "current cash rate target, percent"
                        },
                        "effective_date": {
                          "type": "string",
                          "description": "date the current target took effect"
                        }
                      },
                      "required": [
                        "cash_rate_target"
                      ]
                    }
                  }
                }
              },
              "example": {
                "url": "https://www.rba.gov.au/statistics/cash-rate/",
                "schema": {
                  "type": "object",
                  "properties": {
                    "cash_rate_target": {
                      "type": "number",
                      "description": "current cash rate target, percent"
                    },
                    "effective_date": {
                      "type": "string",
                      "description": "date the current target took effect"
                    }
                  },
                  "required": [
                    "cash_rate_target"
                  ]
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Extraction result. ok:false means no charge.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object"
                    },
                    "url": {
                      "type": "string"
                    },
                    "fetched_at": {
                      "type": "string"
                    },
                    "js_rendered": {
                      "type": "boolean"
                    },
                    "charged": {
                      "type": "boolean"
                    },
                    "field_sources": {
                      "type": "object",
                      "description": "Per field: where the value came from and a 0-1 confidence"
                    },
                    "error": {
                      "type": "string"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "partial": {
                      "type": "object",
                      "description": "On ok:false, fields that were found (not charged)"
                    },
                    "hint": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok"
                  ]
                },
                "example": {
                  "ok": true,
                  "data": {
                    "cash_rate_target": 4.6,
                    "effective_date": "2026-09-30"
                  },
                  "field_sources": {
                    "cash_rate_target": {
                      "source": "table-column:Cash rate target %",
                      "confidence": 0.72
                    },
                    "effective_date": {
                      "source": "table-column:Effective Date",
                      "confidence": 0.72
                    }
                  },
                  "url": "https://www.rba.gov.au/statistics/cash-rate/",
                  "fetched_at": "2026-10-24T08:00:00.000Z",
                  "js_rendered": false,
                  "charged": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input. Only returned once a payment header is present; unpaid requests get 402.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "402": {
            "description": "Payment Required. x402 v2 challenge in the PAYMENT-REQUIRED header (base64 JSON); the same JSON is in the body.",
            "headers": {
              "PAYMENT-REQUIRED": {
                "description": "Base64-encoded x402 v2 PaymentRequired object",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/v1/fetch": {
      "get": {
        "operationId": "fetchMarkdown",
        "summary": "Public page as markdown",
        "tags": [
          "Fetch"
        ],
        "description": "Fetches one public HTML page (no JavaScript rendering) and returns its main text as markdown. $0.01 per call.",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.010000"
          },
          "protocols": [
            {
              "x402": {
                "network": "eip155:8453",
                "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
                "payTo": "0x714F69Aef602c76543AdED914Ea4Eb23fE9F8527"
              }
            }
          ]
        },
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "description": "Public http(s) page to convert",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://example.com"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Page text as markdown",
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                },
                "example": "# Example Domain\n\nSource: https://example.com\n\nThis domain is for use in documentation examples without needing permission. This is not a service; avoid relying on it for testing and monitoring purposes."
              }
            }
          },
          "400": {
            "description": "Invalid input. Only returned once a payment header is present; unpaid requests get 402.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "402": {
            "description": "Payment Required. x402 v2 challenge in the PAYMENT-REQUIRED header (base64 JSON); the same JSON is in the body.",
            "headers": {
              "PAYMENT-REQUIRED": {
                "description": "Base64-encoded x402 v2 PaymentRequired object",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "operationId": "health",
        "summary": "Health check",
        "security": [],
        "responses": {
          "200": {
            "description": "Service status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/llms.txt": {
      "get": {
        "operationId": "llmsTxt",
        "summary": "Plain-text guide for agents",
        "security": [],
        "responses": {
          "200": {
            "description": "Text",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/.well-known/x402": {
      "get": {
        "operationId": "x402Manifest",
        "summary": "Legacy x402 discovery manifest",
        "security": [],
        "responses": {
          "200": {
            "description": "Manifest JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  }
}