Audit Project

POST https://shield-api.quillai.network/api/v1/projects/audit

You can initiate an audit by performing a GET request and passing in your userId and projectId details to the request. Depending upon the size of the project, an audit can take anywhere between 10 seconds to even a minute.

const fetchAuditDetails = async (projectId, userId, apiKey) => {
    const url = `https://shield-api.quillai.network/api/v1/projects/audit`;

    try {
        const response = await fetch(url, {
            method: 'POST',
            headers: {
                'x-api-key': apiKey
            },
            body: JSON.stringify({uploadId={uploadId}&userId=${userId}})
        });

        if (!response.ok) {
            throw new Error(`HTTP error! Status: ${response.status}`);
        }

        const auditData = await response.json();
        
        // Log the details from the response
        console.log("Total Lines of Code:", auditData.totalLines);
        console.log("Audited Files:", auditData.auditedFiles);
        console.log("Security Score:", auditData.securityScore);
        console.log("Vulnerability Count:", auditData.vulnerabilityCount);
        console.log("Vulnerabilities:", auditData.vulnerabilities);

        // Log the project report link
        console.log("Project Report Link:", auditData.projectReportLink);

    } catch (error) {
        console.error("Failed to fetch audit details:", error);
    }
};

// Example usage:
const projectId = 'your-project-id';
const userId = 'your-user-id';
const apiKey = 'your-api-key';

fetchAuditDetails(projectId, userId, apiKey);


Query Parameters

This route takes three query parameters, 'uploadId', 'userId' and 'name'. 'uploadId' is the id of the uploaded project, and can be taken from the upload project api. UserId is helpful in mapping users of your platform to QuillShield and maintaining their separate audit history, it can be any unique Identifier (wallet address, email etc). The 'name' parameter is an optional param, which is used to name the project.

Parameter
Description
Data Type
Requirement

uploadId

Project Id created

String

Required

userId

User Identifier

String

Required

name

Project Name

String

Optional

Response Codes

Responses
Description

๐ŸŸข 200

Success

๐ŸŸ  400

Error

๐Ÿ”ด 401

Unauthorised

Sample Response

Requesting Data in Markdown Formatting

If you intend on integrating onchain agents with our platform, the QuillShield API can make the process quite comfortable by providing you the data in markdown Format. To get data in a markdown format, you can simple add a 'format' parameter to the above request. Here's a more clear example: POST https://shield-api.quillai.network/api/v1/projects/audit?format=MD

And that's it, by adding that parameter you can query data in markdown format. The request data would follow the same response schema as shown previously with an addition of the 'markdown' attribute which contains the audit report in the markdown format

The response would be structured like this

Last updated