/hyax-api/v1/posts/featured-images/clearRemove featured images by URL
Across all of the team's posts, removes every featured image whose stored URL or recorded import URL contains `urlContains` (case-insensitive), for example a domain the images were hot-linked from. Only the matching featured images are removed; a post's other featured images stay. A `post.image` that matches moves to the first remaining featured image, or is cleared. This is a dry run unless `dryRun` is `false`: by default it returns each matching post with the images it would `remove` and `keep`, and changes nothing. Posts in `needsReview` are never changed: their cover matches, but there is no import record showing which featured row is its copy, so fix those with the replace or remove endpoints. Up to `limit` posts are handled per call; repeat while `remaining` is above 0, which does not count `needsReview`. Posts and stored files are kept.
Base URL: https://platform.hyax.com · Replace YOUR_API_KEY with your team API key.
Request body
| Field | Required | Description |
|---|---|---|
urlContains | Required | Text the image URL must contain. At least 3 characters. |
dryRun | No | Defaults to `true` (list only). Pass `false` to remove the images. |
limit | No | Most posts to handle in one call. Default 100, max 500. |
Request
curl -X POST 'https://platform.hyax.com/hyax-api/v1/posts/featured-images/clear' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"urlContains": "olddomain.com",
"dryRun": false
}'Response
{
"success": true,
"dryRun": false,
"data": {
"urlContains": "olddomain.com",
"matched": 2,
"needsReviewCount": 0,
"needsReview": [],
"cleared": 2,
"failed": 0,
"remaining": 0,
"posts": [
{
"id": "clx…",
"title": "Hello world",
"slug": "hello-world",
"status": "PUBLISHED",
"image": "https://olddomain.com/uploads/cover.jpg",
"imageMatches": true,
"remove": [{ "id": "clx…", "url": "https://cdn.example.com/a1b2.jpg", "sourceUrls": ["https://olddomain.com/uploads/cover.jpg"] }],
"keep": [{ "id": "clx…", "url": "https://cdn.example.com/second.jpg", "sourceUrls": [] }],
"cleared": true
}
]
}
}