Back to API documentation

POST /api/v1/batch/fix

Scan and auto-fix up to 50 HTML5 ad creatives in a single request. Returns fixed ZIP files as base64-encoded data with before/after metrics.

Overview

The batch fix endpoint combines scanning and fixing for multiple creatives. Each file is analysed, automatically corrected (clickTag conversion, image compression, JS/CSS minification, ZIP restructuring, backup image generation, etc.), then verified by AI to ensure the creative functions correctly and the clickTag implementation is valid for the target platform. The response contains the fixed ZIP files encoded in base64, along with before/after scores and a list of fixes applied.

Unlike the single /fix endpoint which returns a binary ZIP, the batch endpoint returns JSON with base64-encoded ZIPs so that multiple fixed files can be delivered in a single response.

Plan requirement: Available with API Business ($899/month) or API Enterprise (custom pricing) plans only. These plans include fix capabilities by default.

Request

Endpoint

POST https://adloom.io/api/v1/batch/fix

Authentication

Include your API key in the request header:

X-API-Key: adl_your_api_key_here

Content type

Requests must use multipart/form-data encoding.

Parameters

files (required)

Type: File[] (multiple ZIP files)

One or more ZIP files. Maximum 50 files per request. Field name: files, files[], or file (repeated).

target_platform (optional)

Type: String

Target ad platform for all files in the batch. For API Platform plans, this is ignored and the platform locked to the API key is used instead. Valid values: cm360, dv360, amazon_ad_server, adform, equativ, innovid, thetradedesk, amazon_dsp, yahoo_dsp, stackadapt, mediasmart.

Example requests

Using curl

curl -X POST https://adloom.io/api/v1/batch/fix \
  -H "X-API-Key: adl_your_api_key_here" \
  -F "files=@banner-300x250.zip" \
  -F "files=@banner-728x90.zip" \
  -F "files=@banner-160x600.zip" \
  -F "target_platform=cm360"

Using JavaScript/Node.js

const fs = require('fs');

const formData = new FormData();
formData.append('files', fs.createReadStream('banner-300x250.zip'));
formData.append('files', fs.createReadStream('banner-728x90.zip'));
formData.append('target_platform', 'cm360');

const response = await fetch('https://adloom.io/api/v1/batch/fix', {
  method: 'POST',
  headers: { 'X-API-Key': 'adl_your_api_key_here' },
  body: formData
});

const data = await response.json();

// Save each fixed ZIP
for (const result of data.results) {
  if (result.success && result.fixedZipBase64) {
    const buffer = Buffer.from(result.fixedZipBase64, 'base64');
    fs.writeFileSync(`fixed-${result.filename}`, buffer);
    console.log(`Saved fixed-${result.filename}`);
    console.log(`  Score: ${result.report.before.score} -> ${result.report.after.score}`);
    console.log(`  Fixes: ${result.report.fixesApplied.length}`);
  }
}

Response

Status code

200 OK on success (even if individual files failed)

Response fields

summary

Type: Object

total (number): Total files submitted
succeeded (number): Files successfully fixed
failed (number): Files that failed to process
averageScoreBefore (number): Average score before fixes
averageScoreAfter (number): Average score after fixes
totalFixesApplied (number): Total fixes applied across all files

results

Type: Array

Per-file results:

filename (string): Original filename
success (boolean): Whether fix was successful
error (string, optional): Error message if failed
report (object, optional): Contains targetPlatform, before (score, issues), after (score, issues), and fixesApplied (array of fix descriptions)
fixedZipBase64 (string, optional): The fixed creative as a base64-encoded ZIP file. Decode and save to get the fixed file.

Example response

{
  "success": true,
  "summary": {
    "total": 2,
    "succeeded": 2,
    "failed": 0,
    "averageScoreBefore": 64,
    "averageScoreAfter": 95,
    "totalFixesApplied": 8
  },
  "results": [
    {
      "filename": "banner-300x250.zip",
      "success": true,
      "report": {
        "targetPlatform": "cm360",
        "before": { "score": 58, "issues": 6 },
        "after": { "score": 94, "issues": 1 },
        "fixesApplied": [
          "Converted clickTag to CM360 format",
          "Compressed images (saved 32 KB)",
          "Minified CSS",
          "Injected meta ad.size"
        ]
      },
      "fixedZipBase64": "UEsDBBQAAAAIAP..."
    },
    {
      "filename": "banner-728x90.zip",
      "success": true,
      "report": {
        "targetPlatform": "cm360",
        "before": { "score": 70, "issues": 4 },
        "after": { "score": 96, "issues": 0 },
        "fixesApplied": [
          "Converted clickTag to CM360 format",
          "Generated backup image",
          "Minified JavaScript",
          "Added https to asset URLs"
        ]
      },
      "fixedZipBase64": "UEsDBBQAAAAIAP..."
    }
  ],
  "usage": { "used": 502, "limit": 10000 },
  "durationMs": 8340
}

Decoding fixed files

Fixed creatives are returned as base64-encoded ZIP files in the fixedZipBase64 field. Here is how to decode and save them in various languages:

Node.js

const buffer = Buffer.from(result.fixedZipBase64, 'base64');
fs.writeFileSync('fixed-creative.zip', buffer);

Python

import base64

data = base64.b64decode(result["fixedZipBase64"])
with open("fixed-creative.zip", "wb") as f:
    f.write(data)

Error handling

400 Bad request

No files provided or more than 50 files submitted

401 Unauthorized

Invalid or missing API key

403 Forbidden

Your plan does not support batch or fix operations

429 Too many requests

Insufficient quota for the requested batch size