Site Builder
API Key
Your site API key tells ArrayQ which business a request belongs to. One key powers everything on your website: the service list, bookings, the tracker and the Orca chatbot.
Create a key
Open Site Builder
Sign in to your dashboard and open Site Builder from the sidebar.
Go to the API key tab
Click API key.
Generate the key
Click Generate key, then use the copy button to copy it.
New keys start with pk_. The key is safe to put in your website's JavaScript. It only identifies your business, it does not give anyone access to your dashboard.
Turning on the tracker or the Orca chatbot creates a key for you if you do not have one yet.
Use the key
Send the key in the x-provider-id header on every API request:
const CONFIG = Object.freeze({
API_BASE_URL: "https://api.getwecycle.com",
SITE_KEY: "YOUR_SITE_KEY",
});
async function request(path, options = {}) {
const response = await fetch(`${CONFIG.API_BASE_URL}/api${path}`, {
...options,
headers: {
Accept: "application/json",
"x-provider-id": CONFIG.SITE_KEY,
...options.headers,
},
});
if (!response.ok) {
throw new Error(`Request failed (${response.status})`);
}
return response.json();
}
The tracker and Orca scripts take the same key in a data-site-key attribute instead:
<script
async
src="https://api.getwecycle.com/tracker/tracker.js"
data-site-key="YOUR_SITE_KEY"
></script>
Check the key before you use it. A valid key only contains letters, numbers, dashes and underscores, so a quick /^[A-Za-z0-9_-]+$/ test catches copy and paste mistakes early.
Regenerate a key
If a key leaks or you want a fresh one, click Regenerate key and confirm. The old key stops working, so right after you regenerate:
- Replace the key in your site's JavaScript.
- Replace it in any tracker or Orca snippets on sites hosted elsewhere.
- Publish your site again.
Until you publish the new key, your site cannot load services or take bookings. The tracker and Orca scripts that ArrayQ adds to your hosted site pick up the new key automatically.