Live Examples

Try these ready-to-run examples with real sample images. Just add your API key!

These examples use real sample images hosted by Quick Home AI. You can run these examples immediately without needing your own images.

View Sample Image URLs

Use these URLs to test the API:

  • https://auth.quickhome.ai/storage/v1/object/public/api-example-images/living-room.jpg
  • https://auth.quickhome.ai/storage/v1/object/public/api-example-images/kitchen.jpg
  • https://auth.quickhome.ai/storage/v1/object/public/api-example-images/bedroom.jpg
  • https://auth.quickhome.ai/storage/v1/object/public/api-example-images/exterior.jpg
  • https://auth.quickhome.ai/storage/v1/object/public/api-example-images/empty-room.jpg
  • https://auth.quickhome.ai/storage/v1/object/public/api-example-images/messy-kitchen.jpg
  • https://auth.quickhome.ai/storage/v1/object/public/api-example-images/furnished-bedroom.jpg
  • https://auth.quickhome.ai/storage/v1/object/public/api-example-images/front-exterior-golden.jpg

Example 1: Complete Upload Workflow

Upload photos from your local filesystem using the three-step process. This method supports files up to 50MB each and bypasses serverless function limits.

const fs = require('fs');
const fetch = require('node-fetch');

const API_KEY = 'your_api_key_here';
const BASE_URL = 'https://www.quickhome.ai/api/v1';

async function uploadOrder() {
  // Step 1: Request upload URLs
  const urlResponse = await fetch(`${BASE_URL}/orders/upload-urls`, {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${API_KEY}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      interiorCount: 3,
      exteriorCount: 0
    })
  });
  
  const { uploadSessionId, interiorUrls } = await urlResponse.json();
  
  // Step 2: Upload files directly to storage
  const files = [
    { path: 'living-room.jpg', type: 'image/jpeg' },
    { path: 'kitchen.jpg', type: 'image/jpeg' },
    { path: 'bedroom.jpg', type: 'image/jpeg' }
  ];
  
  for (let i = 0; i < files.length; i++) {
    const fileBuffer = fs.readFileSync(files[i].path);
    await fetch(interiorUrls[i].uploadUrl, {
      method: 'PUT',
      body: fileBuffer,
      headers: {
        'Content-Type': files[i].type,
        'x-upsert': 'false'
      }
    });
  }
  
  // Step 3: Create order with file references
  const orderResponse = await fetch(`${BASE_URL}/orders/from-uploads`, {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${API_KEY}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      address: '266 Dana Point Ave, Ventura, CA 93004, USA',
      serviceType: 'interior',
      uploadSessionId,
      interiorFiles: interiorUrls.map((url, i) => ({
        filePath: url.filePath,
        fileName: files[i].path,
        index: i
      })),
      interiorEnhancements: ['declutter', 'hdr_enhancement']
    })
  });
  
  const result = await orderResponse.json();
  console.log('Job ID:', result.jobId);
}

uploadOrder();

Upload Process Benefits

  • • Supports files up to 50MB per photo
  • • Direct-to-storage upload (faster and more reliable)
  • • Pre-signed URLs valid for 1 hour
  • • No serverless function limits
  • • Supported formats: JPEG, PNG, WebP, HEIC

Example 2: Upload from Image URLs

If your images are hosted online, download them first then upload using the two-step process.

const API_KEY = 'your_api_key_here';
const BASE_URL = 'https://www.quickhome.ai/api/v1';

// Download image from URL
const imageUrl = 'https://example.com/my-property-photo.jpg';
const imageResponse = await fetch(imageUrl);
const imageBlob = await imageResponse.blob();

// Step 1: Create upload session
const sessionResponse = await fetch(`${BASE_URL}/uploads/sessions`, {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${API_KEY}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    serviceType: 'interior',
    files: [
      { role: 'interior', filename: 'photo.jpg', mimeType: 'image/jpeg' }
    ]
  })
});

const { uploadSessionId, files } = await sessionResponse.json();

// Step 2: Upload file to storage
await fetch(files[0].uploadUrl, {
  method: 'PUT',
  body: imageBlob,
  headers: { 'Content-Type': 'image/jpeg' }
});

// Step 3: Create order
const orderResponse = await fetch(`${BASE_URL}/orders`, {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${API_KEY}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    address: '266 Dana Point Ave, Ventura, CA 93004, USA',
    serviceType: 'interior',
    uploadSessionId: uploadSessionId,
    interiorPhotos: [{
      filePath: files[0].storagePath,
      fileName: files[0].filename,
      index: files[0].index
    }],
    interiorEnhancements: ['declutter']
  })
});

const result = await orderResponse.json();
console.log('Job ID:', result.jobId);

Example 3: Interior and Exterior - Complete Property Enhancement

This example enhances both interior and exterior photos in a single order. It stages an empty room and enhances the exterior with a blue sky.

const fs = require('fs');
const fetch = require('node-fetch');

const API_KEY = 'your_api_key_here';
const BASE_URL = 'https://www.quickhome.ai/api/v1';

async function uploadBothInteriorAndExterior() {
  // Step 1: Create upload session
  const sessionResponse = await fetch(`${BASE_URL}/uploads/sessions`, {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${API_KEY}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      serviceType: 'both',
      files: [
        { role: 'interior', filename: 'empty-room.jpg', mimeType: 'image/jpeg' },
        { role: 'exterior', filename: 'exterior.jpg', mimeType: 'image/jpeg' }
      ]
    })
  });

  const { uploadSessionId, files } = await sessionResponse.json();

  // Step 2: Upload files to storage
  const interiorFile = fs.readFileSync('empty-room.jpg');
  await fetch(files[0].uploadUrl, {
    method: 'PUT',
    body: interiorFile,
    headers: { 'Content-Type': 'image/jpeg' }
  });

  const exteriorFile = fs.readFileSync('exterior.jpg');
  await fetch(files[1].uploadUrl, {
    method: 'PUT',
    body: exteriorFile,
    headers: { 'Content-Type': 'image/jpeg' }
  });

  // Step 3: Create order
  const orderResponse = await fetch(`${BASE_URL}/orders`, {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${API_KEY}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      address: '266 Dana Point Ave, Ventura, CA 93004, USA',
      serviceType: 'both',
      uploadSessionId: uploadSessionId,
      interiorPhotos: [{
        filePath: files[0].storagePath,
        fileName: files[0].filename,
        index: files[0].index
      }],
      exteriorPhotos: [{
        filePath: files[1].storagePath,
        fileName: files[1].filename,
        index: files[1].index
      }],
      interiorEnhancements: ['virtual_staging', 'hdr_enhancement'],
      exteriorEnhancements: ['sky_enhancement', 'grass_enhancement']
    })
  });

  const result = await orderResponse.json();
  console.log('Job ID:', result.jobId);
}

uploadBothInteriorAndExterior();

Example 4: Exterior Only with Your Own Photo

Upload your own exterior photo for enhancement with blue sky and green grass.

const fs = require('fs');
const fetch = require('node-fetch');

const API_KEY = 'your_api_key_here';
const BASE_URL = 'https://www.quickhome.ai/api/v1';

async function uploadExterior() {
  // Step 1: Create upload session
  const sessionResponse = await fetch(`${BASE_URL}/uploads/sessions`, {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${API_KEY}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      serviceType: 'exterior',
      files: [
        { role: 'exterior', filename: 'my-house.jpg', mimeType: 'image/jpeg' }
      ]
    })
  });

  const { uploadSessionId, files } = await sessionResponse.json();

  // Step 2: Upload file to storage
  const exteriorFile = fs.readFileSync('my-house.jpg');
  await fetch(files[0].uploadUrl, {
    method: 'PUT',
    body: exteriorFile,
    headers: { 'Content-Type': 'image/jpeg' }
  });

  // Step 3: Create order
  const orderResponse = await fetch(`${BASE_URL}/orders`, {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${API_KEY}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      address: '266 Dana Point Ave, Ventura, CA 93004, USA',
      serviceType: 'exterior',
      uploadSessionId: uploadSessionId,
      exteriorPhotos: [{
        filePath: files[0].storagePath,
        fileName: files[0].filename,
        index: files[0].index
      }],
      exteriorEnhancements: ['sky_enhancement', 'grass_enhancement']
    })
  });

  const result = await orderResponse.json();
  console.log('Job ID:', result.jobId);
}

uploadExterior();

Example 5: Exterior Only - Automatic Property Photos (No Upload Required)

This example creates an exterior order without uploading photos. The API will automatically fetch property photos based on the address and apply the requested enhancements.

const API_KEY = 'your_api_key_here';

// Create exterior order without uploading photos
// The API will automatically fetch property images
const response = await fetch('https://www.quickhome.ai/api/v1/orders', {
  method: 'POST',
  headers: { 
    'Authorization': `Bearer ${API_KEY}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    address: '266 Dana Point Ave, Ventura, CA 93004, USA',
    serviceType: 'exterior',
    exteriorEnhancements: ['sky_enhancement', 'grass_enhancement', 'golden_hour']
  })
});

const result = await response.json();
console.log('Job ID:', result.jobId);
console.log('Status:', result.status);

Complete Workflow: Create, Poll, and Download

This example shows the complete end-to-end workflow with error handling.

const fs = require('fs');
const FormData = require('form-data');

const API_KEY = 'your_api_key_here';
const BASE_URL = 'https://www.quickhome.ai/api/v1';

async function enhancePhotos(photoPaths, address) {
  // Step 1: Create order with local photos
  console.log('Uploading photos and creating order...');
  const formData = new FormData();
  formData.append('address', address);
  formData.append('serviceType', 'interior');
  formData.append('interiorEnhancements', JSON.stringify(['declutter', 'hdr_enhancement']));
  
  for (const path of photoPaths) {
    formData.append('interiorPhotos', fs.createReadStream(path));
  }

  const createResponse = await fetch(`${BASE_URL}/orders`, {
    method: 'POST',
    headers: { 
      'Authorization': `Bearer ${API_KEY}`,
      ...formData.getHeaders()
    },
    body: formData,
  });

  const { jobId } = await createResponse.json();
  console.log(`Job created: ${jobId}`);

  // Step 2: Poll for completion
  console.log('Waiting for processing...');
  let status = 'processing';
  while (status === 'processing' || status === 'pending') {
    await new Promise(resolve => setTimeout(resolve, 5000));

    const statusResponse = await fetch(
      `${BASE_URL}/jobs/${jobId}/status`,
      { headers: { 'Authorization': `Bearer ${API_KEY}` } }
    );

    const statusData = await statusResponse.json();
    status = statusData.status;
    console.log(`Progress: ${statusData.progress?.percentage || 0}%`);
  }

  console.log('Job completed!');

  // Step 3: Download results
  const downloadResponse = await fetch(
    `${BASE_URL}/downloads/${jobId}`,
    { headers: { 'Authorization': `Bearer ${API_KEY}` } }
  );

  const { images } = await downloadResponse.json();
  console.log(`${images.length} enhanced image(s) ready`);

  return images;
}

// Example usage
enhancePhotos(
  ['living-room.jpg', 'kitchen.jpg', 'bedroom.jpg'],
  '266 Dana Point Ave, Ventura, CA 93004, USA'
);

Next Steps

Quick Home AI | Professional Property Photos