API Reference
Complete reference for the AIToTest REST API
Authentication
API Keys
All API requests require authentication using an API key in the Authorization header:
curl -X POST https://api.aitotest.com/v1/tests \
-H "Authorization: Bearer your_api_key" \
-H "Content-Type: application/json" \
-d '{"projectId": "123"}'Test Generation
Generate Tests
Create test cases for your code:
POST /v1/tests/generate
{
"projectId": "string",
"files": [{
"path": "string",
"content": "string"
}],
"config": {
"framework": "jest",
"coverage": {
"threshold": 80
}
}
}
Response:
{
"testId": "string",
"status": "pending",
"files": [{
"path": "string",
"content": "string"
}]
}Test Execution
Run Tests
Execute generated test cases:
POST /v1/tests/run
{
"testId": "string",
"environment": {
"nodeVersion": "16",
"dependencies": {
"jest": "^27.0.0"
}
}
}
Response:
{
"runId": "string",
"status": "running",
"results": null
}Results & Reports
Get Test Results
Retrieve test execution results:
GET /v1/tests/results/{runId}
Response:
{
"runId": "string",
"status": "completed",
"results": {
"passed": 10,
"failed": 0,
"coverage": {
"statements": 85,
"branches": 80,
"functions": 90,
"lines": 85
}
}
}Project Management
Create Project
POST /v1/projects
{
"name": "string",
"repository": "string",
"config": {
"framework": "jest"
}
}Update Project
PUT /v1/projects/{projectId}
{
"name": "string",
"config": {
"coverage": {
"threshold": 90
}
}
}Error Handling
Error Responses
| Status Code | Description |
|---|---|
| 400 | Invalid request parameters |
| 401 | Authentication failed |
| 403 | Insufficient permissions |
| 404 | Resource not found |
| 429 | Rate limit exceeded |
Rate Limits
Limits by Plan
| Plan | Requests/min | Daily Limit |
|---|---|---|
| Free | 60 | 1,000 |
| Pro | 300 | 10,000 |
| Enterprise | 1,000 | Unlimited |
SDKs & Libraries
Node.js
npm install aitotest-sdk
const AIToTest = require('aitotest-sdk');
const client = new AIToTest('api_key');Python
pip install aitotest
from aitotest import Client
client = Client('api_key')Java
<dependency>
<groupId>com.aitotest</groupId>
<artifactId>sdk</artifactId>
<version>1.0.0</version>
</dependency>