Create File Upload Scans

Create a New Scan

POST /v1/scans/upload

The /v1/scans/upload endpoint allows you to create a scan which analyzes the Solidity files sent in the request.

Headers

Name
Value

Content-Type

application/json

Authorization

Bearer <api_key>

Body

The body is a "parms" JSON object with the following keys

Name
Type
Description

name

string

Scan label

files

JSON

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

webhook_url

string

URL where you would like the results sent in a post request

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/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",
    },
}

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

Once a scan completes, AuditBase will callback a webhook with the following data:

Last updated