# Welcome to AuditBase!

AuditBase is the #1 code scanner for Solidity. Automatically generate smart contract audit reports in minutes. With us, you're not just running scans; you're securing peace of mind.

This guide is your personal roadmap to mastering AuditBase. Our goal is to help you automatically generate high-quality audit reports for Solidity code. These instructions will show you how to do that from start to finish.

AuditBase is equipped with over 500 detectors, each designed to pinpoint specific areas of concern.&#x20;

Curious about some of our most frequently used detectors? Take a moment to explore at [detectors.auditbase.com](https://detectors.auditbase.com) and dive deeper into what makes AuditBase your ultimate code scanning companion.

{% hint style="info" %}
**Note:** Our support team is available to answer questions in the chat widget in our application. If you have an urgent need, please reach out to <support@auditbase.com>.&#x20;
{% endhint %}

### Disclaimer

AuditBase ("the Software") is provided "as is," without warranty of any kind, and is used at your own risk. It performs automatic audits of solidity smart contracts, but we make no guarantees regarding its ability to identify all issues or vulnerabilities. The Software is not infallible and should not be your only means of verifying the security of your contracts.

We, our affiliates, or licensors, are not liable for any damages or losses related to your use of the Software or its results. By using the Software, you agree not to hold us responsible for any claim, liability, or cost arising from its use or findings.


# API Reference

Welcome to the AuditBase API! With AuditBase, you can analyze Solidity smart contracts.

**Request API Access**

AuditBase is your go-to smart contract scanning tool designed specifically for smart contract developers. Whether you're a seasoned developer or just starting out, our powerful and intuitive tool helps you secure your smart contracts by identifying vulnerabilities and providing actionable insights for improvement.

To request access to the AuditBase API, please [fill out this form](https://form.typeform.com/to/zglaz6Ud?utm_source=docs.auditbase.com).&#x20;


# V 1.1


# Overview

The Auditbase API allows one to create, get and list smart contract scans.   By sending a POST request to `/v1.1/scans`with the source code or with the contract address in the request body with a callback URL, the system initiates a scan of the source code.   Smart contracts are analyzed asynchronous, and upon completion the system will send the results of the scan to the specified callback URL.  There are two types of scans: the codescan and AI scan.   The codescan uses hundred of detectors to identify vulnerabilities while the AI  scan uses advanced AI to find vulnerabilities.


# Create Scan

## Create a New Scan

<mark style="color:green;">`POST`</mark> `/v1.1/scans`

Create a scan which analyzes smart contracts.   Scans can either be created by included the source files or by specifying the blockchain id and the contract address.  There are two types source code analysis,  "ai"  and "codescan".  &#x20;

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <api_key>` |

**Body**

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

| Name                                    | Type                | Description                                                                                      |
| --------------------------------------- | ------------------- | ------------------------------------------------------------------------------------------------ |
| name                                    | string              | Scan label                                                                                       |
| source                                  | string              | "upload" for direct file input, "explorer" for blockchain explorer source code retrieval         |
| type                                    | string              | Model used to analyze the source code.  "ai" or "codescan".                                      |
| `files [upload source]`                 | JSON Array of files | \[{"file\_name": "file1.sol", "content": "uint var1; ..."}]                                      |
| chain\_id \[explorer source]            | integer             |                                                                                                  |
| contract\_address \[explorer source]    | string              | The address of a contract with verified source code                                              |
| webhook\_url \[optional]                | string              | URL where you would like the results sent in a post request                                      |
| language \[optional] default="solidity" | string              | The language of the source code.  "solidity" or "cosmos" for ai scan.   "solidity" for codescan. |

**Upload Scan Example**

<pre class="language-python"><code class="lang-python"><strong>file1 = Path('./example.sol').read_text()
</strong>file2 = Path('./example2.sol').read_text()
file3 = Path('./example3.sol').read_text()
    
key = "&#x3C;your auditbase key>"
host = 'https://api.auditbase.com'
route = '/v1.1/scans'
url = host + route
post_data = {
    "params":{
        "source": "upload",
        "name": "scan1",
        "files": [{"file_name": "file1.sol", "content": file1},
        {"file_name": "file2.sol", "content": file2}]
        ,
        "webhook_url": "https://yourwebhook/webhook",
        "type": "ai",
        "language": "solidity",
    },
}

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

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

</code></pre>

**Blockchain Explorer Scan Example**. &#x20;

A list of acceptable values for the chain\_id are listed [here](/api-access/v-1.1/supported-blockchains).<br>

<pre class="language-python"><code class="lang-python"><strong>key = "&#x3C;your AuditBase key>"
</strong>host = 'https://api.auditbase.com'
route = '/v1.1/scans'
url = host + route

post_data = {
      "params":{
          "source": "explorer",
          "chain_id": 1,
          "contract_address": "0xCC7ed2ab6c3396DdBc4316D2d7C1b59ff9d2091F",
          "webhook_url": "&#x3C;your webhook callback address>",
          "type": "codescan",
      },
}

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

response = requests.post(url, json=post_data, headers=headers)
print("response: ", response.json())
</code></pre>

**Response**

**returns ScanPlacement Result Object**

{% tabs %}
{% tab title="200" %}

<pre class="language-json"><code class="lang-json">{
  "success": true,
<strong>  "scan_id": "60188023-0b6f-4994-ba15-3d973efb0711",
</strong>  "webhook_url": "your-specified-callback-url.com"
}
</code></pre>

{% endtab %}

{% tab title="400" %}

```json
{
  "success": "failure",
  "scan_id": "",
  "message": "error reason"
}
```

{% endtab %}
{% endtabs %}

**Webhook Response**

Once a scan completes, AuditBase will callback a webhook with the following data:&#x20;

{% tabs %}
{% tab title="200" %}

````json
{
    "status": "success",
    "scan_id": "d50d67c6-3b5a-4a9e-86e6-e18a19b1efa2",
    "score": 8.2,
    "num_lines": 721,
    "timestamp": 1726804295
    "severity_counts": {
        "high": 0,
        "low": 2, 
        "medium": 1,
     },
     "issues": [
         {
             "count": 1, 
             "description": 'The division cannot overflow, since both the numerator and the denominator are non-negative.', 
             "id": 'd50d67c6-3b5a-4a9e-86e6-e18a19b1efc1', 
             "identifier": 'G013', 
             "severity": 'gas_optimization', 
             "snippet": '```solidity\nFile: tmp/4dba7fd7-4c36-4683-aac7-e69dfeb11e1f/23309182-e8eb-4236-b00c-0e6e622a56bc.sol\n\n74              uint fee = (amount * taxCollected) / 100;\n\n```\n', 
             "title": '`unchecked {}` can be used on the division of two `uints` in order to save gas'
         }
     ]
}
````

{% endtab %}

{% tab title="400" %}

```
{
    "status": "failure",
    "message": "error reason",
    "scan_id": "d50d67c6-3b5a-4a9e-86e6-e18a19b1efc1"
}
```

{% endtab %}
{% endtabs %}


# Get Scan

## Get Scan by ID&#x20;

<mark style="color:green;">`GET`</mark> `/v1.1/scans/:scan_id`

Retrieve a specific scan by the ID of the scan.&#x20;

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Response**

**Returns  ScanResultSuccess or ErrorResponse**

{% tabs %}
{% tab title="200" %}

````json
{
    "status": "success",
    "scan_id": "d50d67c6-3b5a-4a9e-86e6-e18a19b1efa2",
    "score": 8.2,
    "num_lines": 721,
    "timestamp": 1726804295
    "severity_counts": {
        "high": 0,
        "medium": 1,
        "low": 2, 
     },
     "issues": [
         {
             "count": 1, 
             "description": 'The division cannot overflow, since both the numerator and the denominator are non-negative.', 
             "id": 'd50d67c6-3b5a-4a9e-86e6-e18a19b1efc1', 
             "severity": 'gas_optimization', 
             "snippet": '```solidity\nFile: tmp/4dba7fd7-4c36-4683-aac7-e69dfeb11e1f/23309182-e8eb-4236-b00c-0e6e622a56bc.sol\n\n74              uint fee = (amount * taxCollected) / 100;\n\n```\n', 
             "title": '`unchecked {}` can be used on the division of two `uints` in order to save gas'
         }
     ]
}
````

{% endtab %}

{% tab title="400" %}

```json
{
  "status": "failure",
  "message": "error reason",
  "scan_id": "",
}
```

{% endtab %}
{% endtabs %}


# List Scans

## List all scans

<mark style="color:green;">`GET`</mark> `/v1.1/scans`

List all scans for an account.&#x20;

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Response**

Returns array of ScanResultSuccess (without the list of issues) or Error Response

{% tabs %}
{% tab title="200" %}

````json
[
  {
    "status": "success",
    "scan_id": "d50d67c6-3b5a-4a9e-86e6-e18a19b1efa2",
    "score": 8.2,
    "num_lines": 721,
    "timestamp": 1726804295
    "severity_counts": {
        "high": 0,
        "medium": 1,
        "low": 2,    
     },
     "issues": [
         {
             "count": 1, 
             "description": 'The division cannot overflow, since both the numerator and the denominator are non-negative.', 
             "id": 'd50d67c6-3b5a-4a9e-86e6-e18a19b1efc1', 
             "identifier": 'G013', 
             "severity": 'gas_optimization', 
             "snippet": '```solidity\nFile: tmp/4dba7fd7-4c36-4683-aac7-e69dfeb11e1f/23309182-e8eb-4236-b00c-0e6e622a56bc.sol\n\n74              uint fee = (amount * taxCollected) / 100;\n\n```\n', 
             "title": '`unchecked {}` can be used on the division of two `uints` in order to save gas'
         }
     ]
}
]
````

{% endtab %}

{% tab title="400" %}

```json
{
   "status": "failure",
   "message": "scan not found, no results_url found"
   "scan_id": ""
}
```

{% endtab %}
{% endtabs %}


# Supported Blockchains

The following is a list of blockchains that can be used with explorer scans.

| Chain               | Network         | Chain Id  |
| ------------------- | --------------- | --------- |
| Ethereum            | Mainnet         | 1         |
| Ethereum            | Goerli          | 5         |
| Ethereum            | Sepolia         | 11155111  |
| Optimism            | Mainnet         | 10        |
| Optimism            | Sepolia         | 11155420  |
| Arbitrum            | Mainnet         | 42161     |
| Arbitrum            | Sepolia         | 42161     |
| Polygon             | Mainnet         | 137       |
| Polygon             | Amoy            | 80002     |
| Binance Smart Chain | Mainnet         | 56        |
| Binance Smart Chain | Testnet         | 97        |
| Base                | Mainnet         | 8453      |
| Base                | Sepolia         | 1789      |
| Blast               | Mainnet         | 81457     |
| Blast               | Sepolia         | 168587773 |
| Avalanche           | C-Chain Mainnet | 43114     |
| Avalanche           | Fuji            | 43113     |
| Scroll              | Mainnet         | 534352    |
| Scroll              | Testnet         | 534351    |


# Objects Definitions

**ScanResultSuccess Object**

Stores the results a scan

| Field            | Type                   | Description |
| ---------------- | ---------------------- | ----------- |
| issues           | Array of Issue Objects |             |
| status           | String                 | "success"   |
| scan\_id         | String                 |             |
| num\_lines       | Integer                |             |
| severity\_counts | Severity Counts Object |             |
| score            | Integer                |             |
| timestamp        | Integer                |             |

**Issue Object**

| Field       | Type           |
| ----------- | -------------- |
| title       | String         |
| description | String         |
| severity    | Severity  Enum |
| snippet     | String         |

**ErrorResponse Object**

| Field          | Type   | Description    |
| -------------- | ------ | -------------- |
| status         | String | "failure"      |
| error\_message | String | failure reason |
| scan\_id       | String |                |

**ScanResultInProgress Object**

| Field    | Type   |                |
| -------- | ------ | -------------- |
| status   | String | "in\_progress" |
| scan\_id | String |                |

**Severity Counts Object**

| Field             | Type |
| ----------------- | ---- |
| high              | int  |
| medium            | int  |
| low               | int  |
| non\_critical     | int  |
| gas\_optimization | int  |

**Scan Placement Response Object**

| Field    | Type   | Description                                    |
| -------- | ------ | ---------------------------------------------- |
| status   | String | "success", "in\_progress", "failure"           |
| message  | String | If failed, give reason for failure             |
| scan\_id | String | Used to retreive scans results from get\_scans |

**Severity Enum**

An enum indicating the severity of the of the Issue

| Category          |                                                                                                                                                                                                                                                                           |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| high              | High flaws can result in the loss of assets or the alteration of data and are typically simple to exploit.  Some high flaws can be challenging to attack, but they can have a big impact on how smart contracts work, like giving the public access to essential features |
| medium            | Although medium-level vulnerabilities should be fixed, they cannot result in the loss of assets or the manipulation of data.                                                                                                                                              |
| low               | Low-level flaws are typically caused by bits of unneeded, old code that don't have a big influence on the execution.                                                                                                                                                      |
| non\_critical     | A non-critical issue refers to a bug or vulnerability that, while potentially inconvenient, does not pose an immediate or severe threat to the security, functionality, or performance of a smart contract.                                                               |
| gas\_optimization | The issue identifies unnecessary gas usage.                                                                                                                                                                                                                               |


# V 1.0


# Scan API

Programmatically scan Solidity smart contracts with AuditBase.

AuditBase's Scanning API provides a powerful interface for programmatically conducting scans across various datasets and systems. It enables users to automate the scanning process, integrate with custom applications, and efficiently identify potential issues by leveraging AuditBase's comprehensive scanning capabilities. This API is designed for flexibility, allowing for customization to fit specific project needs while maintaining high levels of security and efficiency in data scanning operations.


# Create File Upload Scans

## Create a New Scan

<mark style="color:green;">`POST`</mark> `/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**

```python
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**

{% tabs %}
{% tab title="200" %}

<pre class="language-json"><code class="lang-json">{
  "success": true,
<strong>  "scan_id": "60188023-0b6f-4994-ba15-3d973efb0711",
</strong>  "webhook_url": "your-specified-callback-url.com"
}
</code></pre>

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "Invalid request"
}
```

{% endtab %}
{% endtabs %}

**Webhook Response**

Once a scan completes, AuditBase will callback a webhook with the following data:&#x20;

{% tabs %}
{% tab title="200" %}

````json
{
   "success":true,
   "scan_id":"60188023-0b6f-4994-ba15-3d973efb0711",
   "data":{
      "findings":[
         {
            "id":"cb775b85-a334-4096-bbb6-1ec3540b46c4",
            "title":"Centralization risk for trusted owners",
            "description":"Having a single EOA as the only owner of contracts is a large centralization risk and a single point of failure. A single private key may be taken in a hack, or the sole holder of the key may become unable to retrieve the key when necessary. Consider changing to a multi-signature setup, or having a role-based authorization model.",
            "identifier":"M001",
            "count":1,
            "gas_savings":"-",
            "severity":"M",
            "snippet":"```solidity\nFile: tmp/0bd226dd-a4da-4dbe-8005-6616cae58949/contract.sol\n\n559         function renounceOwnership() public onlyOwner {\n568         function transferOwnership(address newOwner) public onlyOwner {\n602         function changeName(string memory name) public onlyOwner{\n\n```\n"
         },
         {
            "id":"bae2e591-5fca-48ed-8233-eaceec8649c2",
            "title":"Use `Ownable2Step` rather than `Ownable`",
            "description":"`Ownable2Step` and `Ownable2StepUpgradeable` prevent the contract ownership from mistakenly being transferred to an address that cannot handle it (e.g. due to a typo in the address), by requiring that the recipient of the owner permissions actively accept via a contract call of its own.",
            "identifier":"L001",
            "count":1,
            "gas_savings":"-",
            "severity":"L",
            "snippet":"```solidity\nFile: tmp/0bd226dd-a4da-4dbe-8005-6616cae58949/contract.sol\n\n590     contract Token is ERC20, ERC20Detailed, ERC20Burnable, Ownable {\n\n```\n"
         },
         {
            "id":"d49b8e59-5c39-4a28-9500-bd1a434e8125",
            "title":"Burn functions should be protected with a modifier",
            "description":"  ",
            "identifier":"L002",
            "count":1,
            "gas_savings":"-",
            "severity":"L",
            "snippet":"```solidity\nFile: tmp/0bd226dd-a4da-4dbe-8005-6616cae58949/contract.sol\n\n492         function burn(uint256 amount) public {\n493             _burn(msg.sender, amount);\n494         }\n\n```\n"
         },
         {
            "id":"e489b2cf-7385-4945-a971-d2a2d56a5831",
            "title":"No limits when setting state variable amounts",
            "description":"It is important to ensure state variables numbers are set to a reasonable value.",
            "identifier":"L003",
            "count":1,
            "gas_savings":"-",
            "severity":"L",
            "snippet":"```solidity\nFile: tmp/0bd226dd-a4da-4dbe-8005-6616cae58949/contract.sol\n\n441             _decimals = decimals;\n\n```\n"
         }
      ]
   }
}
````

{% endtab %}
{% endtabs %}


# List Scans

## List all scans

<mark style="color:green;">`POST`</mark> `/v1/scans`

List all scans for an account.&#x20;

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
   "success":true,
   "data":{
      "scans":[
         {
            "id":"d0e37577-902e-4571-be7b-e4d774167658",
            "name":"scan1",
            "source":"upload",
            "last_check_status":"completed",
            "team_id":"6fa3edd1-153c-4643-8393-0cf1bfbdd358",
            "created_at":1711058709,
            "updated_at":1711058748,
            "last_scan_score":4.73,
            "files":[
               {
                  "id":"a5202abd-86c6-4ac8-875b-3b27391c6c91",
                  "uploadUrl":"https://broadways3.s3.amazonaws.com/uploads/6fa3edd1-153c-4643-8393-0cf1bfbdd358/cfb9cf20-d8a2-4bc5-8f9b-007ccce868b0.sol"
               }
            ]
         }
      ]
   }
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "Invalid request"
}
```

{% endtab %}
{% endtabs %}


# Create Block Explorer Scans

## Create a Block Explorer Scan

<mark style="color:green;">`POST`</mark> `/v1/scans/explorer`

This endpoint allows you to initiate a scan of a specific smart contract on a blockchain via a block explorer interface. By providing the smart contract's address and the chain ID, users can receive detailed security scan of the contract's source code.&#x20;

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Body**

<table><thead><tr><th width="214">Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code>contract_address</code></td><td>string</td><td>Address of the smart contract to scan</td></tr><tr><td><code>chain_id</code></td><td>number</td><td>ID of the chain the contract is deployed on. </td></tr></tbody></table>

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  "success": true,
  "scan_id": "60188023-0b6f-4994-ba15-3d973efb0711",
  "webhook_url": "your-specified-callback-url.com"
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "Invalid request"
}
```

{% endtab %}
{% endtabs %}

**Webhook Response**

Once a scan completes, AuditBase will callback a webhook with the following data:&#x20;

{% tabs %}
{% tab title="200" %}

````json
{
   "success":true,
   "scan_id":"60188023-0b6f-4994-ba15-3d973efb0711",
   "data":{
      "findings":[
         {
            "id":"cb775b85-a334-4096-bbb6-1ec3540b46c4",
            "title":"Centralization risk for trusted owners",
            "description":"Having a single EOA as the only owner of contracts is a large centralization risk and a single point of failure. A single private key may be taken in a hack, or the sole holder of the key may become unable to retrieve the key when necessary. Consider changing to a multi-signature setup, or having a role-based authorization model.",
            "identifier":"M001",
            "count":1,
            "gas_savings":"-",
            "severity":"M",
            "snippet":"```solidity\nFile: tmp/0bd226dd-a4da-4dbe-8005-6616cae58949/contract.sol\n\n559         function renounceOwnership() public onlyOwner {\n568         function transferOwnership(address newOwner) public onlyOwner {\n602         function changeName(string memory name) public onlyOwner{\n\n```\n"
         },
         {
            "id":"bae2e591-5fca-48ed-8233-eaceec8649c2",
            "title":"Use `Ownable2Step` rather than `Ownable`",
            "description":"`Ownable2Step` and `Ownable2StepUpgradeable` prevent the contract ownership from mistakenly being transferred to an address that cannot handle it (e.g. due to a typo in the address), by requiring that the recipient of the owner permissions actively accept via a contract call of its own.",
            "identifier":"L001",
            "count":1,
            "gas_savings":"-",
            "severity":"L",
            "snippet":"```solidity\nFile: tmp/0bd226dd-a4da-4dbe-8005-6616cae58949/contract.sol\n\n590     contract Token is ERC20, ERC20Detailed, ERC20Burnable, Ownable {\n\n```\n"
         },
         {
            "id":"d49b8e59-5c39-4a28-9500-bd1a434e8125",
            "title":"Burn functions should be protected with a modifier",
            "description":"  ",
            "identifier":"L002",
            "count":1,
            "gas_savings":"-",
            "severity":"L",
            "snippet":"```solidity\nFile: tmp/0bd226dd-a4da-4dbe-8005-6616cae58949/contract.sol\n\n492         function burn(uint256 amount) public {\n493             _burn(msg.sender, amount);\n494         }\n\n```\n"
         },
         {
            "id":"e489b2cf-7385-4945-a971-d2a2d56a5831",
            "title":"No limits when setting state variable amounts",
            "description":"It is important to ensure state variables numbers are set to a reasonable value.",
            "identifier":"L003",
            "count":1,
            "gas_savings":"-",
            "severity":"L",
            "snippet":"```solidity\nFile: tmp/0bd226dd-a4da-4dbe-8005-6616cae58949/contract.sol\n\n441             _decimals = decimals;\n\n```\n"
         }
      ]
   }
}
````

{% endtab %}
{% endtabs %}


# Get Scan

## Get Scan by ID&#x20;

<mark style="color:green;">`GET`</mark> `/v1/scans/:scan_id`

Retrieve a specific scan by the ID of the scan.&#x20;

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Response**

{% tabs %}
{% tab title="200" %}

````json
{
    "summary": {
        "high_issue_count": 0,
        "low_issue_count": 2, 
        "medium_issue_count": 1,
         "num_lines": 111, 
         "score": 6.96
     },
     "issues": [
         {
             "count": 1, 
             "description": 'The division cannot overflow, since both the numerator and the denominator are non-negative.', 
             "id": 'd50d67c6-3b5a-4a9e-86e6-e18a19b1efc1', 
             "identifier": 'G013', 
             "severity": 'G', 
             "snippet": '```solidity\nFile: tmp/4dba7fd7-4c36-4683-aac7-e69dfeb11e1f/23309182-e8eb-4236-b00c-0e6e622a56bc.sol\n\n74              uint fee = (amount * taxCollected) / 100;\n\n```\n', 
             "title": '`unchecked {}` can be used on the division of two `uints` in order to save gas'
         }
     ]
}
````

{% endtab %}

{% tab title="400" %}

```json
{
   "error": "scan not found, no results_url found"
}
```

{% endtab %}
{% endtabs %}


# AI Analysis API

## Create an AI Scan

<mark style="color:green;">`POST`</mark> `/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**

```python
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**

{% tabs %}
{% tab title="200" %}

```json
{
  "success": true,
  "scan_id": "1234-5678-abcd-efgh",
  "callback_url": "https://your-callback-url.com",
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "Invalid request"
}
```

{% endtab %}
{% endtabs %}

**Webhook Response**

{% tabs %}
{% tab title="200" %}

```json
{
   "success": true,
   "data": { 
      "summary": {
        "high_issue_count": severities.get('high', 0),
        "medium_issue_count": severities.get('medium', 0), 
        "low_issue_count": severities.get('low', 0), 
         "num_lines": sloc, 
         "score": score
      },
      "findings": [
         {
            "title":"Propose Function Signature and Calldata Length Mismatch",
            "description":"The `propose` function enforces that the lengths of `_signatures` and `_calldatas` arrays must match. If the length of signatures does not match the calldata, the function reverts to prevent mismatches that could be exploited. If different lengths are intended for proper operation, this could inadvertently break business logic.",
            "snippet":"if (_signatures.length != _calldatas.length) revert TG_INVALID_SIGNATURES_LENGTH();",
            "confidence":0.8,
            "severity":"Medium"
         },
         {
            "title":"Protection Against Flash Loan Attacks",
            "description":"The contract uses a fixed `votingDelay` to allow token holders time to prepare for a vote and to protect against flash loan attacks. This is generally considered good practice, but the actual delay should be assessed to ensure it is sufficient based on the project's parameters.",
            "snippet":"function votingDelay() public pure override returns (uint256) { return 7200; } // 1 day",
            "confidence":1.0,
            "severity":"Non-critical"
         }
      ]
   }
}
```

{% endtab %}

{% tab title="400" %}

```json
{
    "success": false,
    "error": "the reason for the error",
}
```

{% endtab %}
{% endtabs %}


# Create a Project

The core of AuditBase is projects. Projects are where you import Solidity code, manage scans, and generate reports.&#x20;

There are three ways to create projects

* Upload `.sol` files
* Scan from Block Explorers
* Integrate with our GitHub application


# File Upload

To enhance the efficiency and organization of our project submission and review process, we kindly ask you to adhere to the following detailed steps. This structured approach is designed to ensure that your project is not only successfully submitted but also ready for a thorough analysis and review.

* Start by clicking the "+ New Project" button, located on the right-hand side of the screen within the AuditBase interface. This is your first step towards bringing external projects into your AuditBase account.

<figure><img src="/files/i0RyZgoDACtXpXQ00kjl" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/6xLBmt5hzY8htrlQEokC" alt=""><figcaption></figcaption></figure>

* **Input Project Name:** Begin the submission process by entering a distinctive and descriptive name for your project in the "Project Name" field. This step is crucial, as the project name serves as a unique identifier throughout the review process. A well-chosen name simplifies the tracking and retrieval of your project within our system, facilitating easier access.
* **Upload .sol File:** After naming your project, proceed to upload your Solidity programming files. It is essential that these files carry the ".sol" extension, indicating their adherence to the Solidity programming language standards. This specificity ensures that the files can be correctly compiled and analyzed, laying the groundwork for an accurate evaluation of your project's technical merits.
* **Click Start Scan:** With your project name specified and your Solidity files uploaded, the final step is to initiate the analysis process by clicking on the "Start Scan" button. This action triggers our system to begin a comprehensive examination of your submission, employing a series of automated checks and analyses to assess the quality, security, and efficiency of your Solidity code.

The design of this submission process is intentionally straightforward to enhance the user experience, aiming to eliminate complexities and potential obstacles. Our goal is to ensure that your project is not only submitted efficiently but also cataloged correctly within the system. This allows for your work to be accessible for both immediate review and future reference, facilitating ongoing analysis and potential iteration.

<br>


# Block Explorer Scanning

For conducting a Block Explorer scan, follow this detailed step-by-step process. This guide is designed to help users navigate the process efficiently, ensuring accurate and comprehensive results for your blockchain exploration needs.

<figure><img src="/files/B94mb9iAYOFVKs0VjmF6" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/wnzKstA2bGvREb2E3BHP" alt=""><figcaption></figcaption></figure>

**Upload Contract Address:**

* Start by locating the input field designated for the "Contract Address" on the Block Explorer platform.
* Carefully enter the full address of the smart contract you wish to explore. Accuracy is crucial here to ensure that the exploration results correspond to the intended contract.

**Choose the Contract Platform:**

* After entering your contract address, proceed to select the platform on which your contract is deployed.
* You will be given options such as **Ethereum, Optimism, Arbitrum, Polygon, and Binance**. Each platform has distinct characteristics and supports different functionalities.
* Make your selection based on the platform your contract is deployed on. This choice is important as it affects the specific details and functionalities available for exploration in the next steps of your scan.

**Choose the Contract Network:**

* The next step involves selecting the network your contract operates on.
* Options available for selection will typically include Mainnet and a valid Testnet (i.e. Goerli, and Sepolia):
  * Mainnet is the primary network where actual transactions with real value occur.
  * Test networks allow for contract testing without financial risks, providing a sandbox environment for development and testing.

By accurately selecting the contract's platform and network, you enable a more targeted and efficient exploration, facilitating a deeper understanding of the contract's activities and blockchain interactions.<br>


# GitHub Integration

<figure><img src="/files/BECCfOIC5O9gaFPq2Fxz" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/SRx0xOY2SYn3SaV5qM4Z" alt=""><figcaption></figcaption></figure>

**Connect GitHub App:**

* Look for and select the "Connect GitHub App" button on the following screen. This option is particularly recommended for developers, as it streamlines the process of integrating GitHub repositories with your AuditBase account.

<figure><img src="/files/JvYPAR71K8dblBNdfHBq" alt=""><figcaption></figcaption></figure>

**Link Your GitHub Account:**

* Proceed by clicking on the "Link Your GitHub Account" button. You will be redirected to the GitHub sign-in page, a critical step for linking your accounts and enabling the integration.

**GitHub Sign-In:**

* On the GitHub sign-in page, enter your GitHub username or email address and password. Click "Sign in" to authenticate your account and authorize the connection to AuditBase.

**Import Repository Page:**

* After successfully linking your GitHub account, you will be automatically directed to the "Import Repository" page within AuditBase. Here, you have the opportunity to import your existing GitHub repositories directly into your AuditBase account. This page facilitates the selection and importation of repositories, making it easier to manage your projects in one centralized location.

**Completing the Integration:**

* Follow the on-screen instructions on the "Import Repository" page to select and import your desired repositories. This may involve specifying certain repositories or configuring settings related to the import process.


# Delete a Project

Deleting a project is a permanent action that removes all the data associated with that project. Please ensure that you have backed up any necessary information before proceeding. Follow these steps to delete a project:

**Open the Project:**

* Begin by navigating to the main dashboard where all your projects are displayed.
* Click on the project you wish to delete to open it. This will take you to the project's overview page, where you can access all the information and settings related to the project.

**Navigate to the Bottom of the Overview Page:**

* Once you're on the project's overview page, scroll down to the very end of the page. Take your time to ensure you don't accidentally skip over any important information or settings as you scroll.

**Locate and Click the Delete Button:**

* At the bottom of the overview page, look for a small button labeled "Delete this project." This button is usually positioned in the middle of the page, making it distinct from other options.
* Click on "Delete this project" to initiate the deletion process. You may be prompted with a confirmation dialog box asking you to confirm your decision to delete the project. This step is crucial as it prevents accidental deletions.

<figure><img src="/files/pm8EBNfzmGojXfpC5f0m" alt=""><figcaption></figcaption></figure>

**Confirm Deletion:**

* Confirming the Action: Upon clicking "Delete this project," a confirmation dialog will appear to ensure that you intend to proceed with the deletion. Read the message carefully, as it will inform you that this action is irreversible.
* Finalize the Deletion: To proceed, confirm the deletion as instructed by the dialog. This involves clicking a "Confirm” button, if you have any doubts or wish to back up data, this is your last chance to cancel the action.

<figure><img src="/files/T9Poxu0kdQYWRxr8Ix4e" alt=""><figcaption></figcaption></figure>

**After Deleting a Project:**

* Once the project is successfully deleted, it will be permanently removed from your dashboard or project list, along with all associated data.
* Consider verifying that the project has been completely removed by returning to your dashboard.


# Reports

Accessing, sharing, and downloading reports from your project can provide valuable insights into your project's status, performance, or audit results.

<figure><img src="/files/jTxt4EftjgZN22m4ygPH" alt=""><figcaption></figcaption></figure>

**Open the Project:**

* Start by navigating to your main dashboard or the list where all of your projects are displayed.
* Identify and click on the project for which you wish to view and download reports. This action will take you to the specific project's overview.

**Access the Audit Report:**

* Within the project's overview, locate the section titled "audit report" where the reports are stored.
* Look for a button labeled "view report" in this section. This button is your gateway to accessing the detailed report for your project's audits.

<figure><img src="/files/j5WKKd98q5xCvb6T8hwJ" alt=""><figcaption></figcaption></figure>

**View the Report:**

* Click on the "view report" button to open the report. The report will be presented in a format that allows you to easily read through the findings, conclusions, or insights derived from the audit or analysis conducted on your project.

**Share the Report:**

* Look for a "share" button typically located near the report viewing options. Clicking this button will open a menu with sharing options.

**Choose Report Access:**

* Within the sharing options, you'll have the choice between making the report "private" or "public." Select the desired level of access based on how you wish to share the report:
  * **Private:** Keeps the report accessible only to those with direct permission or access to the project.
  * **Public:** Makes the report accessible to anyone with the link, broadening the reach of your report's findings.

**Public Sharing:**

* If you opt for public sharing, a "copy link" button will appear after you select the public option. Click this button to copy the report's link to your clipboard, making it ready to share with others via email, messaging platforms, or social media.

**Export the Report:**

* Locate an "export" button, often found in the same area as the download and share options. Clicking on this button initiates the process to export the report.

**Download .md File:**

* After clicking the export button, the system will automatically prepare and download a markdown file (.md) containing your report. This file format is beneficial for further processing, editing, or incorporating the report into other documents or platforms that support markdown syntax.

**Download the Report:**

* Once you have the report open and are ready to download a copy, look towards the right-hand corner of the interface where the report is displayed.
* Find the "download" button, click this button to initiate the downloading process.
* Upon clicking the download button, the report will be automatically prepared and downloaded to your computer in PDF format. This ensures that the report is accessible and readable on a wide range of devices and software.


# Sign Up

A detailed guide for new users on how to sign up and verify your accounts.

**Input Email and Password:**

* Begin the sign-up process by navigating to the registration section of the platform.
* You will find fields to input your email address and create a password. Ensure your email address is active and accessible, as it will be used for verification purposes. When creating your password, follow any guidelines provided to ensure it's strong and secure.
* Submit your registration details by clicking the "Sign Up" button. This action creates your account with the platform, subject to verification.

<figure><img src="/files/BpWUyl2H7ywkim8W9rMv" alt=""><figcaption></figcaption></figure>

**Email Verification:**

* Immediately after registration, a verification email will be sent to the email address you provided. Check your inbox for this email; it may sometimes land in the spam or junk folder, so be sure to check there if it's not immediately visible.
* The verification email will contain a link or a button with instructions to "Verify Your Account". Clicking on this link confirms that the email address belongs to you and completes the verification process.
* If the verification is not completed, the account will enter a temporary locked state. In this state, you will be unable to access the full features of the platform. Should you attempt to log in before verifying your email, you will be reminded to complete this essential step. Access to your account and its features will only be granted once the email verification process is complete.<br>

**Important Notes:**

* **Verification Timeframe:** It's important to complete the email verification promptly after receiving the verification email.
* **Resending Verification Email:** If you didn't receive the verification email or encountered issues, look for an option to resend the verification email within the page you are redirected to.
* **Account Security:** Always keep your login credentials secure and do not share them with others. Using a unique password that combines letters, numbers, and special characters can significantly enhance your account's security.


# Add Team Members

**Access Team Management:**

* Begin by locating the profile icon, typically situated on the right-hand side of the screen on your platform's dashboard or main interface.
* Click on the profile icon to reveal a dropdown menu. From the options presented, select "Manage Team." This action will navigate you to the team management area, where you can view existing team members and make adjustments to your team settings.<br>

<figure><img src="/files/mYqAuaq4BPdYlDbOLgAU" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/Px5vp7i8WFDl8ObaTEYZ" alt=""><figcaption></figcaption></figure>

**Initiate Addition of New Team Member:**

* Within the team management section, look for a button labeled "+ Add Team Member" and click on it. This action opens a form or dialogue box designed to gather information about the new team member you wish to add.

**Input Team Member's Email Address:**

* In the provided field within the form, enter the email address of the individual you are adding to your team. Ensure the email address is accurate to prevent any issues with the invitation process. The email address will be used to send an invitation to the individual, allowing them to join your team on the platform.

**Choose Team Member Role:**

* Next, you will need to assign a role to the new team member. The options typically include "member" and "admin."
  * **Member:** Select this role if the individual requires standard access to the platform's features, suitable for general team members without the need for administrative privileges.
  * **Admin:** Choose this role if the individual needs administrative access, allowing them to manage team settings, add or remove team members, and have other elevated permissions.

**Finalize the Addition:**

* After filling out the email address and selecting the appropriate role, proceed to complete the process by clicking the send invitation button.
* The platform will then send an invitation to the provided email address, guiding the invitee through the steps to join your team.


# Manage Subscriptions

Managing your subscription is an essential part of maintaining your account and ensuring you're getting the most out of the services offered. Follow these steps to view, modify, or update your subscription plan:

**Access Account Settings:**

* Begin by locating the profile icon, which is typically situated in the right-hand corner of your screen. This icon serves as a portal to your personal and account settings.
* Click on the profile icon to reveal a dropdown menu, then select "Settings." This action will direct you to the settings overview for your account, where you can modify various preferences and details related to your account's operation.

**Navigate to Billing:**

* Within the settings menu, direct your attention to the left side of the screen. Here, you'll find a list or navigation panel that outlines different sections of the settings menu you can access.
* Locate and click on "Billing." This section is dedicated to all matters related to your account's financials, including subscription details, payment methods, and historical billing information. It's here that you'll find comprehensive details regarding your current subscription status.

<figure><img src="/files/HnINhG5RONGtSl7SehBT" alt=""><figcaption></figcaption></figure>

**View Subscription and Select Plan:**

* In the Billing section, you'll see an overview of your current subscription, including the plan type and other relevant details. To modify your subscription or to explore other plan options, look for the "Select Plan" button.
* Clicking on the "Select Plan" button will redirect you to the pricing page. This page outlines all available subscription plans, detailing the features, benefits, and costs associated with each. Take your time to review the options to find the plan that best aligns with your needs and usage requirements.

**Selecting a New Plan:**

* **Choosing a Plan:** On the pricing page, compare the available plans to determine which one suits your needs best. Consider factors like the number of users, the extent of access to premium features, and the overall cost.
* **Subscription Details:** After selecting a new plan, you may be prompted to confirm your choice and review the subscription details, including the billing cycle, the date of your next billing, and any changes to your service access.
* **Finalizing Changes:** Complete any required fields and confirm your selection. You may need to enter or confirm payment information if your new plan entails a change in billing.


