Facebook Marketplace location search API
  1. Docs
  2. Facebook
  3. Facebook Marketplace location search API

Facebook Marketplace location search API

Marketplace cities and areas matching a name, with the coordinates to pass to `marketplace/search` as `lat` and `lng`.

GET /v1/facebook/marketplace/location/search

GET /v1/facebook/marketplace/location/search

Marketplace cities and areas matching a name, with the coordinates to pass to marketplace/search as lat and lng.

  • Cost: 1 credit
  • Cache: Results are kept up to 30 days; send max_age_days to reuse them for free.
  • Timeout: A request still running after about 25 seconds answers 202 with a job to poll (Batch and jobs).

Parameters#

NameTypeRequiredDescription
querystringyesCity or area name. Also accepted as keyword, q.

Every request also accepts:

  • cursor: the cursor from the previous page (Pagination).
  • trim: true for a smaller response without null fields and extra.
  • raw: true to also get the platform's original object as raw.
  • max_age_days: accept a cached result up to this many days old, for 0 credits (Caching).

Example request#

Set your key in the environment first (see Authentication).

1curl -G "https://api.socialscrape.dev/v1/facebook/marketplace/location/search" \2  -H "x-api-key: $SOCIALSCRAPE_API_KEY" \3  --data-urlencode "query=Austin"

Example response#

This is a sample from a recorded response. Status 200.

200 OKSample response
1{2  "ok": true,3  "credits_charged": 1,4  "credits_remaining": 4999,5  "cached": false,6  "cached_at": null,7  "request_id": "req_be660eba9b12c2ed37caba2e",8  "data": {9    "object": "list",10    "items": [11      {12        "object": "location",13        "platform": "facebook",14        "id": "106224666074625",15        "name": "Austin, Texas",16        "region": "Texas",17        "country": null,18        "latitude": 30.2677,19        "longitude": -97.7475,20        "extra": {21          "slug": "austin",22          "source": "logged_out_public_view"23        }24      }25    ],26    "cursor": null,27    "has_more": false,28    "parent": null29  },30  "cursor": null,31  "has_more": false32}

Response#

A list of Location objects in data.items, with data.cursor and data.has_more.

See Data models for every field. The envelope around data is described in Responses.

Errors#

Failures are free: credits_charged is 0. Branch on error.code, never on the message.

CodeHTTPRetryMeaning
invalid_params400noA parameter is missing, unknown or has the wrong type.
not_found404noThe platform says this profile, post or item does not exist.

Every request can also fail with the account and platform errors listed on the Errors page.