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
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | The page URL to optimize. |
postbackUrl | string | Yes | Callback URL used to send optimization updates back to the plugin or client. |
settings | object | Yes | Main optimization settings object. |
acceptEncoding | string | No | Accepted content encoding. Example: gzip. |
plugin_version | string | No | Version of the plugin or client sending the request. |
siteKey | string | Yes | Site-specific authentication or identification key. |
Settings Object
The settings object contains general optimization options and module-specific configuration.
General settings
| Parameter | Type | Description |
|---|---|---|
settings.imageQuality | string | Image optimization level. Supported values shown in the examples: lossless, glossy, lossy. |
settings.cropImages | boolean | Enables or disables image cropping. |
settings.enableTwoPhaseLoading | boolean | Enables or disables two-phase loading. |
settings.customCSS | string | Custom 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.
| Parameter | Type | Description |
|---|---|---|
settings.modules.ScriptRewrite.enabled | boolean | Enables or disables script rewriting. |
settings.modules.ScriptRewrite.settings.exclude.strings | array of strings | List of string-based exclusions. |
settings.modules.ScriptRewrite.settings.exclude.regexps | array | List of regexp-based exclusions. |
settings.modules.ScriptRewrite.settings.eventHandlersRewrite | boolean | Enables or disables event handler rewriting. |
settings.modules.ScriptRewrite.settings.rdelay | number | Delay value used by script rewriting. Examples shown include 0 and 86400000. |
settings.modules.ScriptRewrite.settings.excludeGDPR | boolean | Enables exclusion behavior for GDPR-related scripts. |
settings.modules.ScriptRewrite.injectBootstrapScripts | boolean | Enables bootstrap script injection. |
Example regexp exclusion:
{
"type": "RegExp",
"source": "RegExpExclusionMarc",
"flags": "i"
}
ImageRewrite
Controls image rewriting behavior.
| Parameter | Type | Description |
|---|---|---|
settings.modules.ImageRewrite.enabled | boolean | Enables or disables image rewriting. |
settings.modules.ImageRewrite.settings.forceImageDimensions | boolean | Forces image dimensions when enabled. |
ReducedFonts
Controls reduced font behavior.
| Parameter | Type | Description |
|---|---|---|
settings.modules.ReducedFonts.settings.soft | boolean | Enables or disables soft reduced-font behavior. |
Parameter Notes
Image quality values
The following values are shown in the examples:
losslessglossylossy
Crop images
This setting accepts:
truefalse
Force image dimensions
This setting accepts:
truefalse
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/enqueueendpoint. - The request body is JSON.
- The
settingsobject is the main place where optimization behavior is configured. ScriptRewrite,ImageRewrite, andReducedFontsare the modules shown in the available examples.customCSScan be empty or contain a CSS string.- Integrations do not change the request parameter structure.