Image Similarity API
Score how alike two images are, and say whether one is a copy of the other. Two measures run on each pair and they answer different questions — a vision model gives a semantic similarity score, so a different photograph of the same subject scores high, while a perceptual hash gives a Hamming distance, which catches a resized, recompressed or lightly cropped copy of the same file. Both thresholds are yours to set, and every row carries the raw numbers alongside the verdict so you can re-tune without re-running.
MEDIAN LAGon demand
FIELDS8
TOTAL USERS7
MONTHLY ACTIVE5
TOTAL RUNS51
SUCCESS (30D)62.1%
RATINGno ratings yet
LAST MODIFIED2026-09-03
PUBLISHED2026-08
Input parameters
| PARAMETER | TYPE | REQ | DEFAULT | DESCRIPTION |
|---|---|---|---|---|
| sourceImage | string | no | — | The reference image every target is compared against, as a public http(s) URL. |
| sourceImageUpload | array | no | — | Upload the reference image directly instead of linking to it. |
| targetImages | array | no | — | The images to compare against the source, up to 500 per run. One comparison row is returned and charged per target. — drives your bill |
| comparisonMode | string | no | both | Run the vision model, the perceptual hash, or both. Both is the default and is what makes the two verdict columns independent. |
| threshold | number | no | 0.85 | Cosine similarity cutoff, 0 to 1, above which a pair is flagged similar. |
| phashThreshold | integer | no | 8 | Maximum perceptual-hash Hamming distance, 0 to 64, at which a target counts as a near duplicate. |
| sourceImageId | string | no | — | Your own identifier for the source image, echoed on every result row. |
| customId | string | no | — | A run-level identifier echoed on every row, for joining results back to your own records. |
| headers | object | no | — | Extra HTTP headers sent with every image download, for example a Referer. |
| proxyConfiguration | object | no | — | Route image downloads through a proxy. Not needed for most public images. |
Output schema
| FIELD | TYPE | DESCRIPTION | NULLABLE |
|---|---|---|---|
| targetIndex | integer | Position of this target in the input list | no |
| targetImage | string | The target image compared against the source | no |
| similarityScore | number | Cosine similarity from the vision model, 0 to 1 | yes |
| phashDistance | integer | Perceptual-hash Hamming distance, 0 to 64. Lower means a closer file-level match | yes |
| verdict | string | The combined call for this pair | no |
| isSimilar | boolean | Whether similarityScore cleared your threshold | no |
| isNearDuplicate | boolean | Whether phashDistance fell within your phashThreshold | no |
| errorMessage | string | Why a target could not be fetched or decoded, when one could not | yes |
Code
One source against several targets
curl -X POST "https://api.apify.com/v2/acts/johnvc~image-similarity-api/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
-H 'Content-Type: application/json' \
-d '{ "sourceImage": "https://example.com/a.jpg",
"targetImages": ["https://example.com/b.jpg", "https://example.com/c.jpg"],
"comparisonMode": "both" }'
Duplicate detection only, tighter hash cutoff
curl -X POST "https://api.apify.com/v2/acts/johnvc~image-similarity-api/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
-H 'Content-Type: application/json' \
-d '{ "sourceImage": "https://example.com/a.jpg",
"targetImages": ["https://example.com/b.jpg"],
"comparisonMode": "phash", "phashThreshold": 4 }'
What people use it for
- Finding duplicate images in a catalogue
- Detecting reuploaded or lightly edited copies of an asset
- Deduplicating an image dataset before training
- Matching a product photo against a supplier catalogue
- Flagging near-duplicate listings in a marketplace
More sources for Transcripts, images and content pipelines, Product and price intelligence →