AI FeaturesAI API Endpoints

AI API Endpoints

Reference for the AI endpoint available through the Web3 Market API. This endpoint requires an X-API-Key header with a valid API key and a Pro plan subscription.


POST /api/ai/review

Performs a security review of Solidity contract source code. Returns a list of issues with severity levels and a summary.

Available via w3m audit --ai.

Request

{
  "source": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n...",
  "filename": "MyToken.sol"
}
FieldTypeRequiredDescription
sourcestringYesThe full Solidity source code to review
filenamestringYesThe name or filename of the contract

Response

{
  "issues": [
    {
      "severity": "warning",
      "description": "Unbounded loop in distribute() could exceed block gas limit",
      "suggestion": "Consider implementing a batched distribution pattern"
    }
  ],
  "summary": "1 warning found. No critical issues detected."
}
FieldTypeDescription
issuesarrayList of security issues found
issues[].severitystringOne of critical, warning, or info
issues[].descriptionstringDescription of the issue
issues[].suggestionstringSuggested fix or improvement
summarystringHuman-readable summary of the review

Headers

HeaderValueRequired
X-API-KeyYour Web3 Market API keyYes
Content-Typeapplication/jsonYes

Error Handling

StatusMeaning
200Success
400Invalid request body
401Invalid or expired API key. Run w3m auth to authenticate.
403AI contract review requires a Pro plan. Upgrade at web3.market/pricing.
429Rate limit exceeded. Wait and try again.
500Internal server error
⚠️

The AI review endpoint requires a Pro plan. If your account is on the Free tier, requests will return a 403 error. Upgrade at web3.market/pricing.