API Documentation

Integrate Pairsec security scanning into your development workflow

Quick Start

Base URL

https://pairsec.dev/api/v1

Authentication

The API supports two authentication methods:

1. JWT Token (Recommended for web apps)

Authorization: Bearer <jwt_token>

2. API Key (For CLI/external tools)

X-API-Key: <your_api_key>

Generate API Key

You can generate an API key from your dashboard or via the API:

POST /api/v1/users/api-key

Authentication

POST /auth/login

Login with email and password

POST /auth/register

Register new user account

GET /auth/me

Get current user information

Projects

GET /projects

List all user projects (paginated)

POST /projects

Create new project

GET /projects/{id}

Get project details with statistics

PUT /projects/{id}

Update project information

DELETE /projects/{id}

Delete project and all associated scans

Security Scans

POST /scans

Create new security scan

GET /scans

List all user scans with filtering

GET /scans/{id}

Get detailed scan results

GET /scans/{id}/findings

Get security findings for a scan

GET /scans/{id}/export

Export scan results (JSON/CSV)

User Management

GET /users/profile

Get user profile information

PUT /users/profile

Update user profile

POST /users/api-key

Generate new API key

DELETE /users/api-key

Revoke current API key

Example Requests

Login

curl -X POST https://pairsec.dev/api/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "password": "your_password"
  }'

Create Project

curl -X POST https://pairsec.dev/api/v1/projects \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My Web App",
    "repository_url": "https://github.com/user/repo"
  }'

Start Security Scan

curl -X POST https://pairsec.dev/api/v1/scans \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "project_id": 123,
    "scan_type": "full"
  }'

Response Format

All API responses follow a consistent format:

Success Response

{
  "data": { ... },
  "message": "Operation successful",
  "status": 200,
  "timestamp": "2024-01-15T10:30:00.000Z"
}

Error Response

{
  "error": "Error message",
  "status": 400,
  "timestamp": "2024-01-15T10:30:00.000Z",
  "details": "Additional error details (optional)"
}