{
  "openapi": "3.1.0",
  "info": {
    "title": "x402 Agent Toolkit",
    "version": "1.0.0",
    "description": "Paid utility endpoints for AI agents. Pay with USDC on Base or Solana. Pure computation, no LLM dependency.",
    "contact": {
      "email": "sna4an@users.noreply.github.com"
    },
    "x-guidance": "This API provides data processing utilities for AI agents. All endpoints require USDC payment via the x402 protocol. Use POST with JSON body for all endpoints except /api/info which uses GET."
  },
  "servers": [
    {
      "url": "https://x402-agent-toolkit.vercel.app"
    }
  ],
  "paths": {
    "/api/url-to-text": {
      "post": {
        "operationId": "urlToText",
        "summary": "Scrape URL and extract text",
        "description": "Fetches a URL and returns clean text content with HTML stripped.",
        "tags": [
          "Data Processing"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.020000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "minLength": 1,
                    "description": "URL to scrape"
                  }
                },
                "required": [
                  "url"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Scraped text content",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "text": {
                      "type": "string"
                    },
                    "chars": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/json-transform": {
      "post": {
        "operationId": "jsonTransform",
        "summary": "Transform JSON data",
        "description": "Apply transformations to JSON: filter, pick, flatten, keys, count.",
        "tags": [
          "Data Processing"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.010000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "data": {
                    "description": "Input JSON data"
                  },
                  "operation": {
                    "type": "string",
                    "enum": [
                      "filter",
                      "pick",
                      "flatten",
                      "keys",
                      "count"
                    ]
                  },
                  "params": {
                    "type": "object"
                  }
                },
                "required": [
                  "data",
                  "operation"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Transformed result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/csv-parse": {
      "post": {
        "operationId": "csvParse",
        "summary": "Parse CSV to JSON",
        "description": "Parse CSV text into structured JSON with auto-detected delimiters.",
        "tags": [
          "Data Processing"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.010000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "csv": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "csv"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Parsed CSV data",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/text-stats": {
      "post": {
        "operationId": "textStats",
        "summary": "Get text statistics",
        "description": "Analyze text: word count, reading time, top words, and more.",
        "tags": [
          "Text Analysis"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.005000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "text"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Text statistics",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/hash-generate": {
      "post": {
        "operationId": "hashGenerate",
        "summary": "Generate cryptographic hash",
        "description": "Generate SHA256, MD5, SHA512 hash from input string.",
        "tags": [
          "Cryptography"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.005000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {
                    "type": "string",
                    "minLength": 1
                  },
                  "algorithm": {
                    "type": "string",
                    "enum": [
                      "sha256",
                      "md5",
                      "sha512"
                    ]
                  }
                },
                "required": [
                  "input"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Generated hash",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    }
  }
}