FastPixel API

The FastPixel API lets you send a page URL together with optimization settings so the page can be processed by the optimizer.

This request includes the target page URL, a postback URL for updates, and a settings object that controls features such as script rewriting, image rewriting, reduced fonts, image quality, cropping, two-phase loading, and custom CSS.

Endpoint

Method: POST
Endpoint: /api/v1/enqueue

Request Body

Send a JSON body like this:

{
"url": "https://domain.com/",
"postbackUrl": "https://domain.com/wp-json/fastpixel-website-accelerator/v1/update",
"settings": {
"modules": {
"ScriptRewrite": {
"enabled": true,
"settings": {
"exclude": {
"strings": [],
"regexps": []
},
"eventHandlersRewrite": false,
"rdelay": 0,
"excludeGDPR": true
},
"injectBootstrapScripts": true
},
"ImageRewrite": {
"enabled": true,
"settings": {
"forceImageDimensions": false
}
},
"ReducedFonts": {
"settings": {
"soft": true
}
}
},
"imageQuality": "glossy",
"cropImages": true,
"enableTwoPhaseLoading": true,
"customCSS": ""
},
"acceptEncoding": "gzip",
"plugin_version": "1.2.3",
"siteKey": "your-site-key"
}

Request Parameters

Top-level parameters

ParameterTypeRequiredDescription
urlstringYesThe page URL to optimize.
postbackUrlstringYesCallback URL used to send optimization updates back to the plugin or client.
settingsobjectYesMain optimization settings object.
acceptEncodingstringNoAccepted content encoding. Example: gzip.
plugin_versionstringNoVersion of the plugin or client sending the request.
siteKeystringYesSite-specific authentication or identification key.

Settings Object

The settings object contains general optimization options and module-specific configuration.

General settings

ParameterTypeDescription
settings.imageQualitystringImage optimization level. Supported values shown in the examples: lossless, glossy, lossy.
settings.cropImagesbooleanEnables or disables image cropping.
settings.enableTwoPhaseLoadingbooleanEnables or disables two-phase loading.
settings.customCSSstringCustom CSS to include during processing. Can be empty.

Modules

The settings.modules object groups together the feature-specific optimization modules.

ScriptRewrite

Controls script rewriting behavior.

ParameterTypeDescription
settings.modules.ScriptRewrite.enabledbooleanEnables or disables script rewriting.
settings.modules.ScriptRewrite.settings.exclude.stringsarray of stringsList of string-based exclusions.
settings.modules.ScriptRewrite.settings.exclude.regexpsarrayList of regexp-based exclusions.
settings.modules.ScriptRewrite.settings.eventHandlersRewritebooleanEnables or disables event handler rewriting.
settings.modules.ScriptRewrite.settings.rdelaynumberDelay value used by script rewriting. Examples shown include 0 and 86400000.
settings.modules.ScriptRewrite.settings.excludeGDPRbooleanEnables exclusion behavior for GDPR-related scripts.
settings.modules.ScriptRewrite.injectBootstrapScriptsbooleanEnables bootstrap script injection.

Example regexp exclusion:

{
"type": "RegExp",
"source": "RegExpExclusionMarc",
"flags": "i"
}

ImageRewrite

Controls image rewriting behavior.

ParameterTypeDescription
settings.modules.ImageRewrite.enabledbooleanEnables or disables image rewriting.
settings.modules.ImageRewrite.settings.forceImageDimensionsbooleanForces image dimensions when enabled.

ReducedFonts

Controls reduced font behavior.

ParameterTypeDescription
settings.modules.ReducedFonts.settings.softbooleanEnables or disables soft reduced-font behavior.

Parameter Notes

Image quality values

The following values are shown in the examples:

  • lossless
  • glossy
  • lossy

Crop images

This setting accepts:

  • true
  • false

Force image dimensions

This setting accepts:

  • true
  • false

Custom CSS

You can send a CSS string in customCSS.

Example:

"customCSS": ".css Custom css.. demo"

An empty string is also valid:

"customCSS": ""

Integrations

Integrations do not affect the request parameters.

Example Requests

Example 1: Lossless optimization with script rewriting disabled

{
"url": "https://domain.com/",
"postbackUrl": "https://domain.com/wp-json/fastpixel-website-accelerator/v1/update",
"settings": {
"modules": {
"ScriptRewrite": {
"enabled": false,
"settings": {
"exclude": {
"strings": [],
"regexps": []
},
"eventHandlersRewrite": false
},
"injectBootstrapScripts": true
},
"ImageRewrite": {
"enabled": true,
"settings": {
"forceImageDimensions": false
}
},
"ReducedFonts": {
"settings": {
"soft": true
}
}
},
"imageQuality": "lossless",
"cropImages": false,
"enableTwoPhaseLoading": true,
"customCSS": ""
},
"acceptEncoding": "gzip",
"plugin_version": "1.2.3",
"siteKey": "your-site-key"
}

Example 2: Glossy optimization with script rewriting enabled

{
"url": "https://domain.com/sample-page",
"postbackUrl": "https://domain.com/wp-json/fastpixel-website-accelerator/v1/update",
"settings": {
"modules": {
"ScriptRewrite": {
"enabled": true,
"settings": {
"exclude": {
"strings": [],
"regexps": []
},
"eventHandlersRewrite": false,
"rdelay": 0,
"excludeGDPR": true
},
"injectBootstrapScripts": true
},
"ImageRewrite": {
"enabled": true,
"settings": {
"forceImageDimensions": false
}
},
"ReducedFonts": {
"settings": {
"soft": true
}
}
},
"imageQuality": "glossy",
"cropImages": true,
"enableTwoPhaseLoading": true,
"customCSS": ""
},
"acceptEncoding": "gzip",
"plugin_version": "1.2.3",
"siteKey": "your-site-key"
}

Example 3: Lossy optimization with delay and soft reduced fonts disabled

{
"url": "https://domain.com/",
"postbackUrl": "https://domain.com/wp-json/fastpixel-website-accelerator/v1/update",
"settings": {
"modules": {
"ScriptRewrite": {
"enabled": true,
"settings": {
"exclude": {
"strings": [],
"regexps": []
},
"eventHandlersRewrite": false,
"rdelay": 86400000,
"excludeGDPR": true
},
"injectBootstrapScripts": true
},
"ImageRewrite": {
"enabled": true,
"settings": {
"forceImageDimensions": false
}
},
"ReducedFonts": {
"settings": {
"soft": false
}
}
},
"imageQuality": "lossy",
"cropImages": true,
"enableTwoPhaseLoading": true,
"customCSS": ""
},
"acceptEncoding": "gzip",
"plugin_version": "1.2.3",
"siteKey": "your-site-key"
}

Response

The examples show successful requests returning HTTP status 200.

At the moment, the response body itself is not documented here because it is not included in the source material used for this page.

Notes

  • All examples use the /api/v1/enqueue endpoint.
  • The request body is JSON.
  • The settings object is the main place where optimization behavior is configured.
  • ScriptRewrite, ImageRewrite, and ReducedFonts are the modules shown in the available examples.
  • customCSS can be empty or contain a CSS string.
  • Integrations do not change the request parameter structure.
fr_FRFrench