Back to API documentation

POST /api/v1/fix

Validate and automatically correct issues in ad creatives. Returns a fixed ZIP file with before/after metrics and applied fixes.

Overview

The /fix endpoint performs the same validation as the /scan endpoint, then automatically corrects common issues in your creative (clickTag conversion, JS/CSS minification, image compression, ZIP restructuring, backup image generation). Every fix is verified by AI to ensure the creative still functions correctly and the clickTag implementation is valid for the target platform. It returns a binary ZIP file containing your fixed creative alongside detailed before/after metrics in custom response headers.

Plan requirement: Available with API Fix, API Platform, API Business, or API Enterprise plans.

Request

Endpoint

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

Content type

Requests must use multipart/form-data encoding.

Parameters

file (required)

Type: File (ZIP)

Your ad creative as a ZIP file. Must contain an index.html at the root or in a subdirectory. Maximum total size 2 MB; initial load (HTML, CSS, JS) maximum 150 KB.

target_platform (optional)

Type: String

Specifies which ad platform to optimize for. When omitted, fixes are applied for all platforms. For API Platform plan users, this parameter is locked to your key's default platform.

Valid values:

Ad servers: cm360, innovid, amazon_ad_server, adform, equativ
DSPs: dv360, thetradedesk, amazon_dsp, yahoo_dsp, stackadapt, mediasmart

Example requests

With target platform

curl -X POST https://adloom.io/api/v1/fix \
  -H "X-API-Key: adl_your_api_key_here" \
  -F "file=@creative.zip" \
  -F "target_platform=dv360" \
  -o creative_fixed.zip

Without target platform (all platforms)

curl -X POST https://adloom.io/api/v1/fix \
  -H "X-API-Key: adl_your_api_key_here" \
  -F "file=@creative.zip" \
  -o creative_fixed.zip

JavaScript example

const formData = new FormData();
formData.append('file', creativeZipFile);
formData.append('target_platform', 'cm360');

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

const blob = await response.blob();
const reportJson = JSON.parse(response.headers.get('X-Adloom-Report'));
const scoreBefore = response.headers.get('X-Adloom-Score-Before');
const scoreAfter = response.headers.get('X-Adloom-Score-After');

// Save the fixed ZIP
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'creative_fixed.zip';
a.click();

Response

Status code

200 OK on success. A binary ZIP file is returned as the response body with metadata in custom headers.

Response headers

Metadata is provided in custom headers alongside the binary ZIP file:

Content-Type

Value: application/zip

Identifies the response body as a ZIP archive.

Content-Disposition

Example: attachment; filename="fixed-creative.zip"

Instructs the client to treat the response as a downloadable file.

X-Adloom-Report

Type: JSON string (plain text, not base64)

Complete validation and fix report. Contains filename, target platform, before/after scores and issues, list of applied fixes, processing duration, and API usage.

Example value:

{"filename":"creative.zip","targetPlatform":"dv360","before":{"score":72,"issues":8},"after":{"score":96,"issues":0},"fixesApplied":[{"type":"clickTag_conversion","description":"Converted generic clickTag to DV360 format"},{"type":"js_minification","description":"Minified JavaScript, saved 4.2 KB"},{"type":"image_compression","description":"Optimized 3 images, saved 12.5 KB"},{"type":"backup_image_generation","description":"Generated missing backup image"}],"durationMs":2450,"usage":{"used":145,"limit":1000}}

X-Adloom-Score-Before

Type: Integer (0-100)

Quality score of the creative before any fixes were applied.

X-Adloom-Score-After

Type: Integer (0-100)

Quality score of the creative after all fixes were applied.

X-Adloom-Fixes

Type: Integer

Total count of distinct fixes applied to the creative.

Example response

HTTP/1.1 200 OK
Content-Type: application/zip
Content-Disposition: attachment; filename="fixed-creative.zip"
Content-Length: 847263
X-Adloom-Score-Before: 72
X-Adloom-Score-After: 96
X-Adloom-Fixes: 4
X-Adloom-Report: {"filename":"creative.zip","targetPlatform":"dv360","before":{"score":72,"issues":8},"after":{"score":96,"issues":0},"fixesApplied":[{"type":"clickTag_conversion","description":"Converted generic clickTag to DV360 format"},{"type":"js_minification","description":"Minified JavaScript, saved 4.2 KB"},{"type":"image_compression","description":"Optimized 3 images, saved 12.5 KB"},{"type":"backup_image_generation","description":"Generated missing backup image"}],"durationMs":2450,"usage":{"used":145,"limit":1000}}

[Binary ZIP file data]

Fixes applied

The /fix endpoint automatically corrects the following issues:

ClickTag conversion

Detects clickTag implementations and converts them to the target platform's expected format (CM360, DV360, Adform, etc.). Handles generic, proprietary, and malformed clickTag patterns.

JavaScript minification

Compresses JavaScript files using advanced minification, removing whitespace, comments, and optimizing code structure while preserving functionality.

CSS minification

Removes unnecessary whitespace and comments from CSS files, reducing bandwidth usage without affecting styling.

Image compression

Optimises images using intelligent compression algorithms and modern formats (WebP where supported), reducing file size while maintaining visual quality.

ZIP restructuring

Flattens nested folder hierarchies, renames the entry HTML file to index.html (regardless of its original name), removes junk files (.DS_Store, __MACOSX, Thumbs.db, source maps), fixes internal asset references to match the new flat structure, and repackages the archive with optimal compression. The result is a clean ZIP that every ad server accepts on the first upload.

Backup image generation

Automatically generates a backup static image from the creative if missing, required by IAB standards for fallback display.

Animation control

Ensures CSS animations and JavaScript-based animations stop after the first play cycle, complying with platform requirements for ad display.

HTTP to HTTPS upgrade

Automatically converts all HTTP resource references to HTTPS to comply with modern security standards and avoid mixed-content warnings.

Meta tag injection

Injects required ad.size meta tags and other essential meta tags for proper creative sizing, rendering, and platform compatibility.

Junk file removal

Removes unnecessary files (source maps, documentation, hidden files) from the ZIP to reduce size without affecting the working creative.

AI verification

After all fixes are applied, Adloom uses AI to verify the modified creative. The AI analyses the HTML, JavaScript, and CSS to confirm: the clickTag implementation is valid for the target platform, event listeners are intact, asset references are correct after ZIP restructuring, no functionality was broken during the fix process, and the creative will render correctly. This happens automatically on every /fix call. Your creative content is processed securely and is not used for AI model training. See our privacy policy for details on data processing.

Parsing the report header

The X-Adloom-Report header contains a JSON string with complete details about the validation and fixes applied. Extract and parse it as follows:

JavaScript example

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

// Parse the report from the header
const reportJson = JSON.parse(
  response.headers.get('X-Adloom-Report')
);

console.log('Score improvement:',
  reportJson.after.score - reportJson.before.score
);
console.log('Issues fixed:',
  reportJson.before.issues - reportJson.after.issues
);
console.log('Fixes applied:');
reportJson.fixesApplied.forEach(fix => {
  console.log(`  - ${fix.type}: ${fix.description}`);
});

cURL with jq

curl -s -X POST https://adloom.io/api/v1/fix \
  -H "X-API-Key: adl_your_api_key_here" \
  -F "file=@creative.zip" \
  -D - \
  -o creative_fixed.zip | \
  grep "X-Adloom-Report:" | \
  sed 's/X-Adloom-Report: //' | \
  jq '.fixesApplied'

Plan-specific behaviour

API Fix

Fixes are applied for all 12 supported platforms. The target_platform parameter is optional; when omitted, optimisations for all platforms are included.

API Platform

Your API key is configured with a single default platform. Fixes are always applied for that platform only, regardless of the target_platform parameter provided in the request.

Update your default platform in the dashboard under API keys.

API Business

Same as API Fix. Fixes are applied for all platforms or a specified subset. Additionally supports batch endpoint for processing up to 50 creatives in a single request.

API Enterprise

Custom configuration. Can target specific platforms, support on-premise deployment, or any combination needed. Contact sales@adloom.io for setup.

Error handling

Refer to the error handling guide for common API errors. Additional /fix-specific responses:

403 Forbidden

Your API key's plan does not include the /fix endpoint. Upgrade to API Fix, API Platform, API Business, or API Enterprise.

400 Bad request

Invalid target_platform for your API key, or malformed request. API Platform keys cannot use a target_platform different from their default.

413 Payload too large

ZIP file exceeds 2 MB, or initial load exceeds 150 KB. Reduce file size and resubmit.

429 Too many requests

Rate limit or quota exceeded. Check your plan's monthly limit and overage rates.