VisualSearch
What you get
- Pinterest: the pin’s original image.
- X: the post itself, read from X: its text, original photos and videos, and author.
- Web pages: a picture of the captured page.
Results include page details and an image download. Page pictures are generated from saved content, so their appearance can differ from the live website.
Get started
Use your Codegraff API key and send the URL you want to capture. Access is currently limited to approved accounts.
curl https://gateway.codegraff.com/v1/visualsearch \
-H "Authorization: Bearer $CODEGRAFF_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com/"}'The response includes the captured page and an image or picture. To download it, use its download_url with your API key and send itsaccess_token as the X-VisualSearch-Asset-Token header. Keep your API key on your server, not in browser code.
Have a query instead of a URL?
Saved results, faster retrieval
Successful captures join a shared collection. When a recent result already exists, VisualSearch can return it without fetching the website again. You get the same content at the same request price, with less waiting.
Need an updated version? Add "refresh": true to your request. Public pages are supported; pages requiring a login may not be available.
Posts from X
Send an X post link to /v1/visualsearch and it is read from X directly. You get the post (text, author, like, repost and reply counts, photos and videos) and its first photo as image. Links are cleaned up for you: twitter.com, mobile links, fxtwitter-style mirrors, links without https:// and share parameters like ?s=20 all work, and nothing but the post id reaches X.
curl https://gateway.codegraff.com/v1/visualsearch \
-H "Authorization: Bearer $CODEGRAFF_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://x.com/xdevelopers/status/1849000000000000001"}'To search X instead, send a query. You get up to 20 posts from the last 7 days per request (max_results 10 to 20), the first photo as image, and a next_token to get the next page. X's search operators work, such as has:images, from:username, lang:en and -is:retweet.
curl https://gateway.codegraff.com/v1/visualsearch \
-H "Authorization: Bearer $CODEGRAFF_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query":"isometric illustration has:images -is:retweet","max_results":20}'Media links point to X's own image and video files. Deleted or protected posts return 404, and are not charged.
An X request usually returns in about half a second, and its images download from X in well under a tenth of a second. Photo URLs give X's medium size. Add ?name= to pick another:
?name=small: about 40 KB, for thumbnails.?name=medium: the default, about 90 KB.?name=large: about 180 KB.?name=orig: the original upload at full resolution.
Pricing
Paid access starts at $4 per 1,000 successful capture requests. The request price is the same whether the result is newly captured or already saved.
X is $0.143 per request, for a post link or a search page. Authors, photos and videos are included. Deleted posts and searches that find nothing are not charged. Every response reports its charge in codegraff_usage. X requests need paid credits; promotional credit does not cover them. They do not need VisualSearch approval.