HIPAA Auditor API Documentation

Comprehensive REST API for HIPAA compliance management. All endpoints require authentication via JWT tokens.

Authentication

All API endpoints require JWT authentication. Include the access token in the Authorization header.

POST /api/auth.php?action=login

Authenticate user and receive JWT tokens.

Request Body

{
    "email": "user@example.com",
    "password": "password123",
    "mfa_code": "123456" // Optional if MFA is enabled
}

Response

{
    "success": true,
    "tokens": {
        "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
        "refresh_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
        "expires_in": 900,
        "token_type": "Bearer"
    },
    "user": {
        "id": 1,
        "name": "John Doe",
        "email": "user@example.com",
        "role": "compliance_officer",
        "organization_id": 1,
        "organization_name": "Demo Health Inc."
    }
}

POST /api/auth.php?action=refresh

Refresh access token using refresh token.

Request Body

{
    "refresh_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..."
}

Security Risk Assessment

POST /api/sra.php?action=create

Create a new SRA assessment.

Request Body

{
    "title": "Q4 2024 Security Risk Assessment"
}

POST /api/sra.php?action=save_answer

Save an answer to an SRA question.

Request Body

{
    "sra_id": 1,
    "question_id": 1,
    "answer": "comprehensive",
    "comments": "We have comprehensive access control policies in place."
}

POST /api/sra.php?action=complete

Complete an SRA assessment and generate score.

Request Body

{
    "sra_id": 1,
    "answers": {
        "1": {"answer": "comprehensive", "risk_rating": "low"},
        "2": {"answer": "standard", "risk_rating": "low"},
        // ... all 25 questions
    }
}

Response

{
    "success": true,
    "score": 85,
    "breakdown": {
        "low": 15,
        "medium": 8,
        "high": 2,
        "critical": 0
    },
    "message": "SRA completed successfully"
}

GET /api/sra.php?action=export&sra_id=1&format=pdf

Export SRA report in various formats (pdf, json, zip).

Evidence Management

POST /api/evidence.php?action=upload

Upload evidence files with metadata.

Multipart Form Data

evidence_file: [file]
filename: "security_policy.pdf"
description: "Updated security policy document"
tags: "policy, security, compliance"
evidence_type: "document"
sra_id: 1

GET /api/evidence.php?action=get_evidence

Retrieve all evidence for the organization.

Response

{
    "evidence": [
        {
            "id": 1,
            "filename": "security_policy.pdf",
            "evidence_type": "document",
            "description": "Updated security policy document",
            "tags": "policy, security, compliance",
            "file_size": 1024000,
            "version_count": 2,
            "created_at": "2024-01-15 10:30:00",
            "uploaded_by_name": "John Doe"
        }
    ]
}

POST /api/evidence.php?action=update_metadata

Update evidence metadata and custom fields.

Request Body

{
    "evidence_id": 1,
    "metadata": {
        "description": "Updated description",
        "tags": "policy, security, updated",
        "evidence_type": "document",
        "custom": {
            "department": "IT",
            "approval_status": "approved",
            "review_date": "2024-12-31"
        }
    }
}

Training & Certificates

POST /api/training.php?action=enroll

Enroll user in a training course.

Request Body

{
    "course_id": 1
}

GET /api/training.php?action=get_enrollments

Get user's course enrollments and progress.

Response

{
    "enrollments": [
        {
            "id": 1,
            "course_id": 1,
            "title": "HIPAA Essentials",
            "status": "in_progress",
            "progress_percentage": 65,
            "started_at": "2024-01-15 10:00:00",
            "certificate_url": null
        }
    ]
}

POST /api/training.php?action=update_progress

Update course progress.

Request Body

{
    "enrollment_id": 1,
    "progress_percentage": 100
}

Code Examples

JavaScript (Fetch API)

// Login and get tokens
const loginResponse = await fetch('/api/auth.php?action=login', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
    },
    body: JSON.stringify({
        email: 'user@example.com',
        password: 'password123'
    })
});

const loginData = await loginResponse.json();
const accessToken = loginData.tokens.access_token;

// Make authenticated request
const sraResponse = await fetch('/api/sra.php?action=get_answers&sra_id=1', {
    headers: {
        'Authorization': `Bearer ${accessToken}`
    }
});

const sraData = await sraResponse.json();

PHP (cURL)

// Login
$loginData = [
    'email' => 'user@example.com',
    'password' => 'password123'
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://zone.radiatus.com/audit-hipaaauditor/api/auth.php?action=login');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($loginData));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$loginResult = json_decode($response, true);
$accessToken = $loginResult['tokens']['access_token'];

// Make authenticated request
curl_setopt($ch, CURLOPT_URL, 'https://zone.radiatus.com/audit-hipaaauditor/api/sra.php?action=get_answers&sra_id=1');
curl_setopt($ch, CURLOPT_POST, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ' . $accessToken
]);

$response = curl_exec($ch);
$sraData = json_decode($response, true);

Python (requests)

import requests
import json

# Login
login_data = {
    'email': 'user@example.com',
    'password': 'password123'
}

response = requests.post(
    'https://zone.radiatus.com/audit-hipaaauditor/api/auth.php?action=login',
    json=login_data
)

login_result = response.json()
access_token = login_result['tokens']['access_token']

# Make authenticated request
headers = {'Authorization': f'Bearer {access_token}'}
response = requests.get(
    'https://zone.radiatus.com/audit-hipaaauditor/api/sra.php?action=get_answers&sra_id=1',
    headers=headers
)

sra_data = response.json()

Error Handling

All API endpoints return consistent error responses:

Error Response Format

{
    "error": "Error message description",
    "code": "ERROR_CODE", // Optional
    "details": {} // Optional additional details
}

Common HTTP Status Codes

  • 200 - Success
  • 201 - Created
  • 400 - Bad Request
  • 401 - Unauthorized
  • 403 - Forbidden
  • 404 - Not Found
  • 500 - Internal Server Error

Rate Limiting

API requests are rate limited to prevent abuse:

  • Authentication endpoints: 5 requests per minute per IP
  • General API endpoints: 100 requests per minute per user
  • File upload endpoints: 10 requests per minute per user