Ebay Search API: Structured Data in PHP
Scrape eBay search results into structured JSON/CSV with ScraperAPI in PHP. Filter by seller, condition, format, and price to power product research.
This endpoint will retrieve products for a specified search term from Ebay search page and transform it into usable JSON.
<?php
$url =
"https://api.scraperapi.com/structured/ebay/search?api_key=API_KEY&query=QUERY
&tld=TLD&country_code=COUNTRY_CODE&sort_by=SORT_BY&page=PAGE
&items_per_page=ITEMS_PER_PAGE&seller_id=SELLER_ID&condition=CONDITION
&buying_format=BUYING_FORMAT&show_only=SHOW_ONLY"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER,
TRUE); curl_setopt($ch, CURLOPT_HEADER,
FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,
0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,
0); $response = curl_exec($ch); curl_close($ch); print_r($response);
API_KEY
(required)
User's normal API Key
QUERY
(required)
Search query. Example: iPhone
TLD
Top-level Ebay domain to scrape. This is an optional argument and defaults to “com” (ebay.com). Valid values include:
com (ebay.com)
co.uk (ebay.co.uk)
com.au (ebay.com.au)
de (ebay.de)
ca (ebay.ca)
fr (ebay.fr)
it (ebay.it)
es (ebay.es)
at (ebay.at)
ch (ebay.ch)
com.sg (ebay.com.sg)
com.my (ebay.com.my)
ph (ebay.ph)
ie (ebay.ie)
pl (ebay.pl)
nl (ebay.nl)
COUNTRY
country_code
influences the language and the currency of the page. The TLD should be set to ‘com’ if you are using languages that are not used by the TLDs listed above.
SORT_BY
Instructs the API to sort the results. Supported values:
ending_soonest newly_listed price_lowest price_highest distance_nearest best_match
PAGE
Page number
ITEMS_PER_PAGE
Number of items returned. Supported values: 60, 120, 240
SELLER_ID
The ‘name’ of the seller. This is a textual id, for example ‘gadget-solutions’
Filter options
CONDITON
Condition of the products. Supported values:
'new', 'used', 'open_box', 'refurbished', 'for_parts', 'not_working’ Note: These categories don’t have the same name for all products.
For example open_box
is sometimes called ‘without tag’ on the eBay results page. Please ensure that you are always using the values from the supported list when sending request to the API.
Note2: Multiple options can be used here. So if you want to search for new and open_box products you can use the query param:
’used,open_box’ in an URL encoded form like
&condition=used%2Copen_box
BUYING_FORMAT
Buying format. Supported values:
buy_it_now
auction
accepts_offers
Note: You can specify multiple options just as with the condition
parameter.
SHOW_ONLY
Additional filters for search. Supported values:
returns_accepted authorized_seller completed_items sold_items sale_items listed_as_lots search_in_description benefits_charity authenticity_guarantee Note: Multiple options can be used here. So if you want to search for a product where returns are accepted and it’s from an authorized seller the query param: ’returns_accepted,authorized_seller’ in an URL encoded form like &show_only=returns_accepted%2Cauthorized_seller
Sample Response
[
{
"product_title": "Apple iPhone SE 2nd Gen (Great Cond) Unlocked AT&T TMobile Verizon 64 128 256 GBOpens in a new window or tab",
"image": "https://i.ebayimg.com/images/g/GJMAAOSw3bBmaHw2/s-l500.webp",
"product_url": "https://www.ebay.com/itm/226358814412",
"condition": "Pre-Owned",
"item_price": {
"from": {
"value": 147.99,
"currency": "USD"
},
"to": {
"value": 264.99,
"currency": "USD"
}
},
"extra_info": "Buy It Now",
"free_returns": "Free returns",
"watchers": 19,
"seller_name": "cocosprinkles",
"seller_rating_count": 32530,
"seller_rating": 99.8,
"seller_has_top_rated_plus": true
},
{
"product_title": "Apple iPhone 8 (Great Condition) Unlocked AT&T Verizon T-Mobile 64GB 128GB 256GBOpens in a new window or tab",
"image": "https://i.ebayimg.com/images/g/NXoAAOSwNIdmZw4e/s-l500.webp",
"product_url": "https://www.ebay.com/itm/226358808865",
"condition": "Pre-Owned",
"item_price": {
"from": {
"value": 134.99,
"currency": "USD"
},
"to": {
"value": 214.99,
"currency": "USD"
}
},
"extra_info": "Buy It Now",
"free_returns": "Free returns",
"items_sold": 59,
"seller_name": "cocosprinkles",
"seller_rating_count": 32530,
"seller_rating": 99.8,
"seller_has_top_rated_plus": true
},
{
"product_title": "Apple iPhone SE 2nd Gen 2020 64GB Unlocked Verizon At&t T-Mobile Fair ConditionOpens in a new window or tab",
"image": "https://i.ebayimg.com/images/g/gg4AAOSw735mRYIO/s-l140.webp",
"product_url": "https://www.ebay.com/itm/226378701013",
"condition": "Pre-Owned · Apple iPhone SE (2nd Generation) · 64 GB · Unlocked",
"item_price": {
"value": 90,
"currency": "USD"
},
"extra_info": "Buy It Now",
"shipping_cost": "Free shipping",
"watchers": 10,
"seller_name": "esupplytech",
"seller_rating_count": 4156,
"seller_rating": 97.8
},
{
"product_title": "Apple iPhone XR Black 128GB A1984 MT362LL/A Verizon Clean ESN Good (JF)Opens in a new window or tab",
"image": "https://i.ebayimg.com/images/g/GAgAAOSwxDRitG-z/s-l140.webp",
"product_url": "https://www.ebay.com/itm/195161489925",
"condition": "Good - Refurbished · Apple iPhone XR · 128 GB · Verizon",
"item_price": {
"value": 143.96,
"currency": "USD"
},
"extra_info": "Buy It Now",
"free_returns": "Free returns",
"seller_name": "auditmacstech",
"seller_rating_count": 12440,
"seller_rating": 99.2,
"seller_has_top_rated_plus": true
},
............................
]
Last updated
Was this helpful?