SmartVaxAI API Integration

This documentation is for EHR vendors to integrate with the SmartVaxAI platform through our secure API endpoints. Our API allows you to process and extract data from vaccination cards and submit it to EHR systems.

Authentication

All API requests require the following authentication:

  • API Key Header:x-api-key
  • Bearer Token:Authorization: Bearer your-token
x-api-key: your-api-key-here
Authorization: Bearer your-token-here

Base URL

All API endpoints are accessible at this GCP Cloud Run URL:

https://smartvax-api-new-730874408505.us-central1.run.app

API Endpoints Overview

EndpointMethodPurposeURL
Health CheckGETVerify API availability/health
Submit RecordPOSTSubmit vaccination data/api/vaccinations
Process VaccinationPOSTProcess vaccination card with AI/api/ehr/process-vaccination
Submit to EHRPOSTSubmit to EHR system/api/ehr/submit-vaccination
Process & SendPOSTCombined process and send/api/ehr/process-send
Batch StatusGETGet batch processing status/api/batch/status
Flush BatchesPOSTForce process all pending batches/api/batch/flush

NEW: Batch Processing

Our API now supports batch processing for improved efficiency when submitting multiple vaccination records.

Benefits of Batch Processing:

  • Reduced API calls to EHR systems
  • Lower network overhead and better performance
  • Optimized throughput for large volumes of records
  • Automatic grouping by healthcare organization

How It Works:

When batch processing is enabled, records submitted to /api/vaccinations are automatically:

  1. Grouped by site ID and EHR vendor
  2. Held until batch size threshold or time limit is reached
  3. Processed in optimized batches for better performance
  4. Submitted to EHR systems with compression for large batches

Submit Vaccination Record

Submit vaccination card data with optional image for processing:

Endpoint:

POST/api/vaccinations

Header Requirements:

  • x-api-key: Your API key
  • Content-Type: application/json
  • x-test-run-id: Optional tracking ID for testing

Request Body:

{
  "patientFirstName": "John",               // Required
  "patientLastName": "Doe",                 // Required
  "patientDOB": "1980-01-01",               // Required, ISO date format
  "vaccineName": "COVID-19 Vaccine",        // Required
  "vaccineDate": "2023-05-15",              // Vaccination date (also accepts administration_date)
  "vaccineLocation": "City Medical Center", // Optional
  "healthcare_professional": "Dr. Smith",   // Optional
  "userId": "user-id-123",                  // Required - User ID for tracking
  "organizationId": "org-id-456",           // Required - Organization ID
  "status": "pending",                      // Optional - valid values: "pending", "verified"
  "notes": "First dose",                    // Optional
  "imageData": "data:image/jpeg;base64,..." // Optional but recommended - Base64 encoded image
}

Response:

{
  "status": "accepted",
  "message": "Vaccination record queued for processing",
  "supabaseId": "f7c051c3-3c08-45d1-a1a4-32b07b7c2d3a",
  "imageUrl": "https://example.com/storage/vaccination_images/path/to/image.jpg",
  "messageId": "12345678901234"
}

Image Processing:

When you include imageData in your request, the API performs these steps:

  1. Stores the image in Supabase Storage in the vaccination_images bucket
  2. Creates a record in the vaccination_images table with metadata
  3. Associates the image with the vaccination record via image_id
  4. The image can be retrieved using the returned imageUrl

Status Field Values:

The API accepts the following status values. All other values will be automatically mapped to one of these:

  • pending: Initial state, record is awaiting verification
  • verified: Record has been verified and is ready for EHR submission
  • submitted: Record has been submitted to an EHR system
  • error: An error occurred during processing

Note: The API internally maps similar status values (e.g., "processed" maps to "verified") for flexibility.

Database Schema

Understanding the database schema is essential for successful integration:

vaccination_records Table:

FieldTypeDescription
idUUIDPrimary key
patient_first_nameTEXTPatient's first name
patient_last_nameTEXTPatient's last name
patient_birthdateDATEPatient's date of birth
vaccine_nameTEXTName of the vaccine
administration_date / vaccine_dateDATEDate of vaccination (supports both field names)
healthcare_professionalTEXTName of healthcare professional
healthcare_organizationTEXTName of healthcare facility
image_idUUIDReference to vaccination_images table
statusTEXTRecord status (pending, verified, submitted, error)

vaccination_images Table:

FieldTypeDescription
idUUIDPrimary key
user_idTEXTUser ID who uploaded the image
organization_idUUIDOrganization ID
storage_pathTEXTPath to image in Supabase Storage
original_filenameTEXTOriginal filename
mime_typeTEXTMIME type of the image
ocr_statusTEXTOCR processing status
ocr_dataJSONBExtracted data from OCR processing

Troubleshooting

Common Issues:

Status Value Not Accepted

If you're getting errors related to the status field, ensure you're using one of the supported values: "pending", "verified", "submitted", or "error". The API will attempt to map similar values but explicit values are preferred.

Image Not Appearing

If the image is not appearing in the dashboard:

  • Ensure the image data is correctly formatted as a Data URL (data:image/jpeg;base64,...)
  • Verify that the image size is reasonable (under 10MB)
  • Check that your API key has the proper permissions for image storage
API Key Issues

If you receive authentication errors, verify your API key is correctly included in the header as "x-api-key". For access or permission issues, contact the SmartVaxAI team at support@smartvaxai.com.

API Test Console

You can test the API endpoints directly from your development environment using the examples above.

Next Steps

  • Request API credentials from your SmartVaxAI representative
  • Implement integration following the examples above
  • Test your integration with sample vaccination cards
  • Contact support@smartvaxai.com if you need assistance