# OfferUp Geocode API Documentation

Scrappa's `GET /api/offerup/geocode` endpoint resolves a zip code or place name to the latitude and longitude OfferUp uses for radius searches.

## Do this before searching

OfferUp's search resolver requires a location, and when it does not get one it silently falls back to the proxy server's own geography. Results then differ per request and per proxy, which is the most common cause of "the same query returns different cities" reports. Resolve the location here, then pass `lat` and `lon` to [Search](/docs/offerup-api/offerup_search).

## Only two inputs are accepted

OfferUp's geocode schema accepts `zipcode` or `query` and rejects `zip`, `postalCode`, `city`, `state`, `lat`, and `lon`. Sending a rejected field returns a validation error rather than being ignored.

`zipcode` must be a 5-digit US zip code. `query` accepts a free-form place name such as "Carmichael, CA".

- **Documentation:** [https://scrappa.co/docs/offerup-api/offerup_geocode](https://scrappa.co/docs/offerup-api/offerup_geocode)
- **API group:** OfferUp API
- **Endpoint:** `GET https://scrappa.co/api/offerup/geocode`

## Authentication

Send your Scrappa API key in the `X-API-KEY` request header. Paid endpoints also support accountless x402 payments when called without an API key.

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `zipcode` | string | No | 5-digit US zip code. |
| `query` | string | No | Free-form place name, e.g. "Carmichael, CA". |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/offerup/geocode?zipcode=95608"
```

## Example response

```json
{
    "success": true,
    "location": {
        "latitude": 38.6371002,
        "longitude": -121.2950796,
        "zipcode": "95608",
        "city": "Carmichael",
        "state": "CA"
    }
}
```

## More Scrappa resources

- [API documentation](https://scrappa.co/docs)
- [Full LLM-readable API reference](https://scrappa.co/llms-full.txt)
- [OpenAPI specification](https://scrappa.co/docs/api.json)
- [Pricing](https://scrappa.co/pricing)
