Pixel Position (BETA)
Pixel Position uses actual browser to determine element position on screen. Pixel Position API adds x
, y
, width
, and height
to organic results, local results, answer box and many other elements supported by X-Ray.
Pixel Position API
You can perform the API request to Pixel Position API for new and archive searches.
For new searches:
Add .json_with_pixel_position
to the end of /search
API endpoint.
GET
-
https://serpapi.com/search.json_with_pixel_position?engine=google&q=Coffee&api_key=SECRET_API_KEY
Alternatively, you could also add output
parameter (output=json_with_pixel_position
) to the /search
API endpoint.
GET
-
https://serpapi.com/search?output=json_with_pixel_position&engine=google&q=Coffee&api_key=SECRET_API_KEY
For archive searches:
Search Archive API allows you to fetch past searches. Add .json_with_pixel_position
to the API endpoint to perform Pixel Position on those searches.
GET
-
https://serpapi.com/searches/5b50d58a304bda2fca30bac9.json_with_pixel_position?api_key=SECRET_API_KEY
Results for: Coffee
in google

{
"pixel_position_information": {
"viewport_width": 1200,
"viewport_height": 600,
"time_taken": 1.23
},
...
"local_results": {
"places": [
{
"position": 1,
"rating": 4.6,
"reviews_original": "(967)",
"reviews": 967,
"description": "Cozy hangout for carefully sourced brews",
"place_id": "11265938073076301333",
"place_id_search": "https://serpapi.com/search.json?device=desktop&engine=google&gl=us&google_domain=google.com&hl=en&location=Austin%2C+Texas%2C+United+States&ludocid=11265938073076301333&q=Coffee",
"lsig": "AB86z5Vdw6C2pJpM0xQ6JUx2KONU",
"thumbnail": "https://serpapi.com/searches/66569b8cb68f8bb608ecf1d0/images/1da898cc867dbcb3d01977dd6a88324830a17bef6769367010e21458fda67be97c9c3f66ca35fbd3.jpeg",
"title": "Houndstooth Coffee",
"type": "Coffee shop",
"address": "401 Congress Ave. #100c",
"hours": "Closed ⋅ Opens 6:30 AM Wed",
"rectangle": {
"x": 66,
"y": 323,
"width": 550,
"height": 130
}
},
{
"position": 2,
"rating": 4.4,
"reviews_original": "(556)",
"reviews": 556,
"description": "Area institution with a theater upstairs",
"place_id": "15498522356495312950",
"place_id_search": "https://serpapi.com/search.json?device=desktop&engine=google&gl=us&google_domain=google.com&hl=en&location=Austin%2C+Texas%2C+United+States&ludocid=15498522356495312950&q=Coffee",
"lsig": "AB86z5WSxdnDKVF_iLXNN6Lg0UQ5",
"thumbnail": "https://serpapi.com/searches/66569b8cb68f8bb608ecf1d0/images/1da898cc867dbcb3d01977dd6a883248c09e12c31822db27da4d3f71793b876103709dcadd9705be.jpeg",
"title": "The Hideout Coffee House",
"type": "Coffee shop",
"address": "617 Congress Ave.",
"hours": "Closed ⋅ Opens 7 AM Wed",
"rectangle": {
"x": 66,
"y": 454,
"width": 550,
"height": 146
}
},
{
"position": 3,
"rating": 4.5,
"reviews_original": "(1.4K)",
"reviews": 1400,
"description": "Chill, eco-friendly cafe open 24/7",
"place_id": "16212840284195723418",
"place_id_search": "https://serpapi.com/search.json?device=desktop&engine=google&gl=us&google_domain=google.com&hl=en&location=Austin%2C+Texas%2C+United+States&ludocid=16212840284195723418&q=Coffee",
"lsig": "AB86z5ULyBs2TVBuZLquC243_dvm",
"thumbnail": "https://serpapi.com/searches/66569b8cb68f8bb608ecf1d0/images/1da898cc867dbcb3d01977dd6a88324886cadf9d168daae110c2dd1a08b2d23547f91a9442817f71.jpeg",
"title": "Bennu Coffee on Congress",
"type": "Coffee shop",
"address": "515 S Congress Ave",
"rectangle": {
"x": 66,
"y": 601,
"width": 550,
"height": 146
}
}
],
...
},
"organic_results": [
{
"position": 1,
"title": "Coffee",
"link": "https://en.wikipedia.org/wiki/Coffee",
"redirect_link": "https://www.google.com/url?sa=t&source=web&rct=j&opi=89978449&url=https://en.wikipedia.org/wiki/Coffee&ved=2ahUKEwjSpMO48LGGAxUzOUQIHQ58AFgQFnoECBoQAQ&usg=AOvVaw0s4rPyJBlEpp-AarY2Utn7",
"displayed_link": "https://en.wikipedia.org › wiki › Coffee",
"thumbnail": "https://serpapi.com/searches/66569b8cb68f8bb608ecf1d0/images/ed8bda76b255c4dc4634911fb134de5319e08af7e374d3ea998b50f738d9f3d2.jpeg",
"favicon": "https://serpapi.com/searches/66569b8cb68f8bb608ecf1d0/images/ed8bda76b255c4dc4634911fb134de530125d347caf8b107299403ee81b5a151.png",
"snippet": "Coffee is a beverage brewed from roasted coffee beans. Darkly colored, bitter, and slightly acidic, coffee has a stimulating effect on humans, primarily due ...",
"snippet_highlighted_words": [
"Coffee",
"coffee",
"coffee"
],
"sitelinks": {
"inline": [
{
"title": "Coffee bean",
"link": "https://en.wikipedia.org/wiki/Coffee_bean"
},
{
"title": "History",
"link": "https://en.wikipedia.org/wiki/History_of_coffee"
},
{
"title": "Coffee production",
"link": "https://en.wikipedia.org/wiki/Coffee_production"
},
{
"title": "Coffee preparation",
"link": "https://en.wikipedia.org/wiki/Coffee_preparation"
}
]
},
"source": "Wikipedia",
"rectangle": {
"x": 66,
"y": 833,
"width": 652,
"height": 138.859375
}
},
...
]
}
Results for: Iceland
in google
The popular_destinations.destinations
layout is arranged horizontally, with the rectangle.y
value remaining consistent across all results.

{
"pixel_position_information": {
"viewport_width": 1200,
"viewport_height": 600,
"time_taken": 1.11
},
...
"popular_destinations": {
"destinations": [
{
"title": "Reykjavík",
"link": "https://www.google.com/search?sca_esv=c34f1484862cc875&gl=us&hl=en&q=Reykjav%C3%ADk&si=APYL9bu1Sl4M4TWndGcDs6ZL5WJXWNYEL_kgEEwAe0iMZIocdUlGh1T7wdAT0kca_VHlugLwTFsJ5acwyzSvKMc912pwLSywfA%3D%3D&sa=X&ved=2ahUKEwiJ-Y-7xpqMAxVITTABHYfeKl8Qs4ILegQISRAD",
"description": "Viking history, nightlife & Blue Lagoon",
"flight_price": "$559",
"extracted_flight_price": 559,
"drive_duration": "1h",
"thumbnail": "https://serpapi.com/searches/67dd076b965622a1672f01d6/images/b9b947291fa606358f3b5cdd55b85a4eda147c7feaaa75184c497f8413f1bb2b643d582d55fd2b89255a528b513fd8d7.jpeg",
"rectangle": {
"x": 58,
"y": 1169,
"width": 148,
"height": 289
}
},
{
"title": "Jökulsárlón",
"link": "https://www.google.com/search?sca_esv=c34f1484862cc875&gl=us&hl=en&q=J%C3%B6kuls%C3%A1rl%C3%B3n&si=APYL9btMsmZl0P9CyeA1NmMZFYv4xkDb-_Q4WCJadY9pxozSRc5FuSMSGEv4ssQcdhTtwBWwVy_ejNMuCO5nlOeYIhTQ9XrgTQ%3D%3D&sa=X&ved=2ahUKEwiJ-Y-7xpqMAxVITTABHYfeKl8Qs4ILegQIRxAD",
"description": "Icebergs & Breiðamerkurjökull Glacier",
"flight_price": "$559",
"extracted_flight_price": 559,
"drive_duration": "6h",
"thumbnail": "https://serpapi.com/searches/67dd076b965622a1672f01d6/images/b9b947291fa606358f3b5cdd55b85a4eda147c7feaaa75184c497f8413f1bb2b9ff03c84a5f99335eba92bea28ba7563.jpeg",
"rectangle": {
"x": 226,
"y": 1169,
"width": 148,
"height": 289
}
},
{
"title": "Thingvellir National Park",
"link": "https://www.google.com/search?sca_esv=c34f1484862cc875&gl=us&hl=en&q=Thingvellir+National+Park&si=APYL9btMsmZl0P9CyeA1NmMZFYv4xkDb-_Q4WCJadY9pxozSRX2K4LL_fM1QU5OS-C8eHW0DWda3m_vApjZsOgvrXAsnfwllZA%3D%3D&sa=X&ved=2ahUKEwiJ-Y-7xpqMAxVITTABHYfeKl8Qs4ILegQIRRAD",
"description": "Þingvellir Church & Öxarárfoss waterfall",
"flight_price": "$559",
"extracted_flight_price": 559,
"drive_duration": "1h",
"thumbnail": "https://serpapi.com/searches/67dd076b965622a1672f01d6/images/b9b947291fa606358f3b5cdd55b85a4eda147c7feaaa75184c497f8413f1bb2bca2f4d2a2d752e95e3c66cd79ee0d8c5.jpeg",
"rectangle": {
"x": 394,
"y": 1169,
"width": 148,
"height": 289
}
},
...
],
"rectangle": {
"x": 58,
"y": 1169,
"width": 652,
"height": 309
}
},
"organic_results": [
...
{
"position": 2,
"title": "Visit Iceland | Official travel info for Iceland",
"link": "https://www.visiticeland.com/",
"redirect_link": "https://www.google.com/url?sa=t&source=web&rct=j&opi=89978449&url=https://www.visiticeland.com/&ved=2ahUKEwiJ-Y-7xpqMAxVITTABHYfeKl8QFnoECGwQAQ",
"displayed_link": "https://www.visiticeland.com",
"thumbnail": "https://serpapi.com/searches/67dd076b965622a1672f01d6/images/5474f1b3af63715d2b1d78ecfa4f297fb38cca7cce7463ff8761e63bdd1ded44.jpeg",
"favicon": "https://serpapi.com/searches/67dd076b965622a1672f01d6/images/5474f1b3af63715d2b1d78ecfa4f297f44d83aca28cc4ca707dd8d448f25c52d.png",
"snippet": "Expansive Glaciers. Shimmering Northern Lights. Hot springs and geysers. Vibrant culture and Viking history. Vast volcanic landscapes and black sand ...",
"snippet_highlighted_words": [
"Expansive Glaciers"
],
"source": "Visit Iceland",
"rectangle": {
"x": 58,
"y": 1522,
"width": 652,
"height": 156
}
},
...
]
}
Error handling
When using the Pixel Position API, you can detect errors by checking for the presence of the pixel_position_information.error
key in the response. If this key exists, it indicates that there was an issue retrieving pixel position, though your search results may still be valid.
JSON structure overview
{
...
"pixel_position_information": {
"viewport_width": "Integer - Width that the page was rendered in",
"viewport_height": "Integer - Height that the page was rendered in",
"time_taken": "Float - Time taken to retrieve the result",
// Present when there is an error
"error": "String - Error message"
},
...
"organic_results": [ // 'organic_results' is only an example, it will be applied on any appropriate X-Ray elements
{
...
"rectangle": {
"x": "Float",
"y": "Float",
"width": "Float",
"height": "Float"
}
}
]
}