Test XPath attributes against stored HTML
const url = 'https://dashboard.justcrawl.io/api/v1/extraction/test-xpath';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"domain":"example","pageType":"example","attributes":[{"name":"example","xpaths":["example"],"type":"text","description":"example","antiPatterns":["example"],"semanticType":"brand_name","validation":{"minLength":1,"maxLength":1,"min":1,"max":1,"pattern":"example"}}],"jobId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://dashboard.justcrawl.io/api/v1/extraction/test-xpath \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "domain": "example", "pageType": "example", "attributes": [ { "name": "example", "xpaths": [ "example" ], "type": "text", "description": "example", "antiPatterns": [ "example" ], "semanticType": "brand_name", "validation": { "minLength": 1, "maxLength": 1, "min": 1, "max": 1, "pattern": "example" } } ], "jobId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" }'Synchronously re-runs extraction with the supplied attribute set against an existing
cached HTML blob — the dashboard’s “Try this XPath before saving” surface. The blob is
sourced from either the explicit jobId (when supplied) or the most recent job with a
stored body for the domain. No new scrape is dispatched.
Capped at 5MB of HTML per call; larger blobs return 413 rather than time out. The
extractor is run with a one-shot schema (id: 'test', version: 1) so this never
mutates the org’s saved attributes — use PUT /attributes/{domain} for that.
Requires workflows:write.
Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ”object
object
object
Optional. If omitted, uses the most recent job with stored HTML for the domain.
Responses
Section titled “ Responses ”Extracted values, quality scores, and the source job’s URL.
object
object
object
Example generated
{ "values": {}, "qualityScore": { "completeness": 1, "validation": 1, "composite": 1 }, "jobId": "example", "url": "example"}Validation failed — request body or query is missing/invalid
object
Example
{ "error": "Missing or invalid \"url\" field"}Missing or invalid authentication token
object
Example
{ "error": "Missing or invalid authentication token"}Insufficient permissions for this operation
object
Example
{ "error": "No organization. Complete onboarding first."}Resource not found
object
Example
{ "error": "Workflow not found"}HTML blob exceeds the 5MB sync limit. Narrow the test set or split the page.
Unexpected server error. Logs and PostHog $exception capture
object
Example
{ "error": "Something went wrong"}