apidata.one docs Get a key

Quickstart

Ten minutes with a sandbox key. The sandbox is a made-up world that answers exactly like live, so everything below works unchanged on live once you swap the keys.

Get your keys: sign up in the portal with your email address. Your sandbox account is ready at once, with a test key pair: sk_test_… for your server and pk_test_… for the browser. Each key is shown once, so copy it then; a key you lose is revoked and replaced on the account's keys page. Every call goes to https://api.apidata.one/v1 with Authorization: Bearer <key>.

export SK_TEST="sk_test_…"   # your secret test key: on your server only, never in a page
curl -H "Authorization: Bearer $SK_TEST" "https://api.apidata.one/v1/listings?status=active&price.max=500000&limit=3"

The answer holds data (the listings), meta (paging and dataLastUpdatedAt) and compliance (the notices your pages must show). See listings.

2. One listing

curl -H "Authorization: Bearer $SK_TEST" "https://api.apidata.one/v1/listings/SBX900000009"

SBX900000009 is one of the sandbox's listings that never change: it always has 150 photos. Try SBX900000001 to see how a hidden address looks.

3. A consumer's favorite

Your server speaks for one of your site's users with X-Client-Id, an ID of your own for that user (never an email address):

curl -X POST -H "Authorization: Bearer $SK_TEST" -H "X-Client-Id: user-42" -H "Content-Type: application/json" \
  -d '{"listingKey":"SBX900000009"}' "https://api.apidata.one/v1/favorites"

In the browser, use the pk_test_… key with a client token instead. See authentication.

4. A saved search, and an alert on demand

curl -X POST -H "Authorization: Bearer $SK_TEST" -H "X-Client-Id: user-42" -H "Content-Type: application/json" \
  -d '{"criteria":{"status":["active"],"price":{"max":500000}},"alertFrequency":"instant"}' \
  "https://api.apidata.one/v1/saved-searches"

The sandbox changes by itself every 5 minutes, so this search will alert before long. To see it now, send a sandbox trigger with the id you just got:

curl -X POST -H "Authorization: Bearer $SK_TEST" -H "X-Client-Id: user-42" -H "Content-Type: application/json" \
  -d '{"event":"saved_search.matches","savedSearchId":"<the id>"}' "https://api.apidata.one/v1/sandbox/triggers"

5. Read the notice

curl -H "Authorization: Bearer $SK_TEST" "https://api.apidata.one/v1/events"

Within about 10 seconds the list holds a saved_search.matches notice naming the new listing.

While you build on your own computer, this list is how you get notices. Read it every minute: it carries everything a webhook would, listing.removed among them, and it needs nothing from your side but the secret key. A webhook endpoint needs a public https address, which a site on localhost does not have. Once your site is deployed, register a webhook endpoint to get the same notices within seconds (webhooks, step by step), and keep reading the list as the way to catch up after an outage. apidata.one never emails your visitors: your site sends its own (saved searches and alerts).

Where next

Going live

Swap the _test_ keys for _live_ keys. Nothing else changes. Going live says how an account gets its live keys.

This page as Markdown