πŸ€–AI Analysis API

Create an AI Scan

POST /v1/ai-scan/upload

The AI scan endpoint allows users to submit Solidity source code for analysis. By sending a POST request to /v1/ai-scan/upload with the source code and a callback URL in the request body, the system initiates an AI-driven scan of the provided code. Upon completion, the system will send the results of the scan to the specified callback URL. This process facilitates automatic security and optimization checks for Smart Contracts written in Solidity, enabling developers to identify and address potential issues efficiently.

Headers

Name
Value

Content-Type

application/json

Authorization

Bearer <token>

Body

Include a "params" object with the following key/value pairs:

Name
Type
Description

name

string

User scan label

files

JSON

{"file1.sol": "file content", ... ,"filelast.sol": "file content"}

webhook_url

string

URL to callback after the AI scan completes.

scan_type

string

"solidity" or "cosmos"

Example

file1 = Path('./example.sol').read_text()
file2 = Path('./example2.sol').read_text()
file3 = Path('./example3.sol').read_text()
    
key = "<your auditbase key>"
route = 'v1/scans/ai/upload'
url = host + route
post_data = {
    "params":{
        "name": "scan1",
        "files": {"file1.sol": file1, "file2.sol": file2, "file3.sol": file3},
        "webhook_url": "https://<your call url>/webhook",
        "scan_type": "cosmos"
    },
}

headers = {
    'Content-Type': 'application/json',
    'Authorization': f'Bearer {key}',
}

response = requests.post(url, json=post_data, headers=headers)
print("response: ", response.json())

Response

Webhook Response

Last updated