Embed the search box with a publishable key
For front-end developers at a franchisor or a broker. Load /embed.js with a pub_ key for a public search box, 50 results a page, and keep every other operation on your server.
What is the problem?
Visitors to a public page, such as prospective franchisees, should search commercial premises there, and no secret key may reach the browser.
How does it work, step by step?
- Load the box from
/embed.jswith a publishablepub_key. The key works only from the origins it was issued for. - The box calls
POST /v1/embed/searchandPOST /v1/embed/premiseswith thepub_key in the request body and Content-Typetext/plain; a page is at most 50 results. These two operations have no reference page on the hub, and apub_key does not work on any other operation. - Anything beyond the box (a detail page with up to 8 thumbnails from get_premises, compare_premises, market_snapshot, explain_location, your store list) runs on your server with the platform key (connect). The
pm_ids are the same tokens on every door.
# server side, after a click in the box
curl https://platform.casafari.com/v1/claro/premises/$PREMISES_ID \
-H "Authorization: Bearer $CASAFARI_API_KEY"What do you get?
A search box on your page with up to 50 results a page, pm_ ids you can pass to your server, and a server-side path for everything else (REST).
What are the limits?
50 results a page with a publishable key (up to 200 server side). How an organisation on the platform gets a pub_ key, and whether the box is served through the platform, is not published yet. The page follows the content terms: name the agency and link only its page, show excerpts rather than full descriptions, Casafari thumbnails only, never a private seller, never a portal (content terms, /legal/platform-terms). Keep the platform key out of the browser, URLs and repositories.