Everything you need to integrate HomAI's property intelligence into your applications. Get started with our APIs, SDKs, and comprehensive guides.
Get up and running with HomAI in minutes. Follow this step-by-step guide to perform your first property analysis.
First, create a new HomAI client instance with your API credentials.
// Initialize HomAI API client
const HomAI = require('@homai/api-client');
const client = new HomAI({
apiKey: 'your-api-key',
environment: 'production' // or 'sandbox'
});
// Verify connection
const status = await client.getStatus();
console.log('HomAI status:', status);
Upload a property image or provide coordinates for satellite imagery analysis.
// Option 1: Upload local image
const fs = require('fs');
const imageFile = fs.readFileSync('property.jpg');
const analysis = await client.analyze({
image: imageFile,
location: {
lat: 40.7128,
lng: -74.0060,
address: "123 Main St, New York, NY"
},
options: {
includeRiskAssessment: true,
generatePDF: true
}
});
// Option 2: Use satellite imagery
const satelliteAnalysis = await client.analyzeBySatellite({
coordinates: { lat: 40.7128, lng: -74.0060 },
zoomLevel: 20,
options: {
includeRiskAssessment: true
}
});
Handle the analysis results and extract relevant information.
// Process analysis results
console.log('Analysis completed:', analysis.status);
console.log('Confidence score:', analysis.confidenceScore);
console.log('Risk assessment:', analysis.riskScore);
// Access roof analysis data
analysis.roofAnalysis.forEach((roof, index) => {
console.log(`Roof ${index + 1}:`);
console.log(' Material:', roof.material);
console.log(' Condition:', roof.condition);
console.log(' Risk factors:', roof.riskFactors);
});
// Download PDF report
if (analysis.reportURL) {
const report = await client.downloadReport(analysis.reportURL);
fs.writeFileSync('analysis-report.pdf', report);
}
Complete reference for all HomAI API endpoints, parameters, and response formats.
{ "image": "[binary image data]", "location": { "lat": 40.7128, "lng": -74.0060, "address": "123 Main St, New York, NY" }, "options": { "includeRiskAssessment": true, "generatePDF": true, "detailLevel": "comprehensive" } }
{ "analysisId": "ana_1234567890", "status": "completed", "confidenceScore": "87%", "riskScore": "Medium", "roofAnalysis": [ { "roofId": "roof_1", "material": "Asphalt Shingles", "condition": "Good", "estimatedAge": "10-15 years", "maintenanceNeeded": "Gutter cleaning recommended", "riskFactors": ["Tree proximity"] } ], "insuranceAssessment": { "premiumMultiplier": 1.1, "riskCategory": "Standard", "recommendations": ["Annual inspection"] }, "reportURL": "https://api.homai.ai/reports/ana_1234567890.pdf", "createdAt": "2025-01-15T10:30:00Z" }
Step-by-step integration guides for popular platforms and frameworks.
Integrate HomAI into your WordPress site with our official plugin.
<?php
// Add to your theme's functions.php or custom plugin
// Initialize HomAI
function init_homai_client() {
return new HomAI_Client([
'api_key' => get_option('homai_api_key'),
'environment' => 'production'
]);
}
// Shortcode for property analysis
function homai_analysis_shortcode($atts) {
$atts = shortcode_atts([
'property_id' => '',
'show_form' => 'true'
], $atts);
ob_start();
include 'templates/property-analysis-form.php';
return ob_get_clean();
}
add_shortcode('homai_analysis', 'homai_analysis_shortcode');
?>
Build property analysis features into your React applications.
import React, { useState } from 'react';
import { HomAIClient } from '@homai/react-sdk';
const PropertyAnalysis = () => {
const [analysis, setAnalysis] = useState(null);
const [loading, setLoading] = useState(false);
const client = new HomAIClient({
apiKey: process.env.REACT_APP_HOMAI_API_KEY
});
const handleAnalysis = async (imageFile, location) => {
setLoading(true);
try {
const result = await client.analyze({
image: imageFile,
location: location,
options: {
includeRiskAssessment: true,
generatePDF: true
}
});
setAnalysis(result);
} catch (error) {
console.error('Analysis failed:', error);
} finally {
setLoading(false);
}
};
return (
<div className="property-analysis">
<PropertyUpload onAnalysis={handleAnalysis} />
{loading && <LoadingSpinner />}
{analysis && <AnalysisResults data={analysis} />}
</div>
);
};
export default PropertyAnalysis;
Ready-to-use code examples for common use cases and integration scenarios.
Process multiple properties in parallel for large-scale analysis.
// Batch processing multiple properties
const analyzeMultipleProperties = async (properties) => {
const results = await Promise.allSettled(
properties.map(async (property) => {
try {
const analysis = await client.analyze({
image: property.imageFile,
location: property.location,
options: {
includeRiskAssessment: true,
generatePDF: false // Skip PDF for batch processing
}
});
return {
propertyId: property.id,
status: 'completed',
data: analysis
};
} catch (error) {
return {
propertyId: property.id,
status: 'failed',
error: error.message
};
}
})
);
// Process results
const successful = results.filter(r => r.value?.status === 'completed');
const failed = results.filter(r => r.value?.status === 'failed');
console.log(`Processed ${successful.length} properties successfully`);
console.log(`${failed.length} properties failed`);
return results;
};
Track analysis progress with real-time status updates.
// Real-time progress tracking
const analyzeWithProgress = async (imageFile, location, onProgress) => {
// Start analysis
const analysisId = await client.startAnalysis({
image: imageFile,
location: location,
options: { includeRiskAssessment: true }
});
// Poll for progress updates
let analysis;
let attempts = 0;
const maxAttempts = 60; // 5 minutes max
while (attempts < maxAttempts) {
try {
analysis = await client.getAnalysis(analysisId);
// Update progress
onProgress({
stage: analysis.stage,
progress: analysis.progress,
estimated_time: analysis.estimatedTimeRemaining
});
if (analysis.status === 'completed') {
break;
} else if (analysis.status === 'failed') {
throw new Error(analysis.error);
}
// Wait 5 seconds before next check
await new Promise(resolve => setTimeout(resolve, 5000));
attempts++;
} catch (error) {
console.error('Progress check failed:', error);
break;
}
}
return analysis;
};
// Usage
const progressCallback = (progress) => {
console.log(`Stage: ${progress.stage}, Progress: ${progress.progress}%`);
updateProgressBar(progress.progress);
};
const result = await analyzeWithProgress(imageFile, location, progressCallback);
Official SDKs and libraries for popular programming languages and frameworks.
For Node.js and browser applications
# Install via npm
npm install @homai/api-client
# Install via yarn
yarn add @homai/api-client
For data science and backend applications
# Install via pip
pip install homai
# Install via conda
conda install -c homai homai
For WordPress and Laravel applications
# Install via Composer
composer require homai/php-sdk
For high-performance backend services
# Install via go get
go get github.com/homai/go-sdk
Set up webhooks to receive real-time notifications about analysis completion and status updates.
// Configure webhook endpoint
const express = require('express');
const app = express();
app.use(express.json());
// Webhook endpoint for analysis completion
app.post('/webhooks/homai/analysis-complete', (req, res) => {
const { analysisId, status, data } = req.body;
// Verify webhook signature
const signature = req.headers['x-homai-signature'];
if (!verifyWebhookSignature(req.body, signature)) {
return res.status(401).send('Invalid signature');
}
// Process analysis completion
handleAnalysisCompletion(analysisId, data);
res.status(200).send('OK');
});
// Verify webhook signature for security
const crypto = require('crypto');
function verifyWebhookSignature(payload, signature) {
const expectedSignature = crypto
.createHmac('sha256', process.env.HOMAI_WEBHOOK_SECRET)
.update(JSON.stringify(payload))
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(`sha256=${expectedSignature}`)
);
}
Common issues and solutions to help you integrate and use HomAI effectively.
This error occurs when the API key is incorrect or missing.
Solutions:
The uploaded image doesn't meet minimum quality requirements.
Requirements:
Your application has exceeded the API rate limits.
Rate Limits:
Our developer support team is here to help you integrate HomAI into your applications. Get in touch with questions, feedback, or integration assistance.