curl "https://api.genlook.app/storefront/v1/availability" \
-H "Authorization: Bearer pk_your_key_here" \
-H "X-Genlook-Anonymous-Id: anon_..."
const response = await fetch('https://api.genlook.app/storefront/v1/availability', {
headers: {
'Authorization': `Bearer ${PUBLISHABLE_KEY}`,
'X-Genlook-Anonymous-Id': anonymousId,
},
});
const { allowed, storeId } = await response.json();
{
"allowed": true,
"storeId": "store_abc123"
}
{
"allowed": false,
"storeId": "store_abc123"
}
Widget API Reference
Availability
Check whether the store can run try-ons before opening the widget.
GET
/
storefront
/
v1
/
availability
curl "https://api.genlook.app/storefront/v1/availability" \
-H "Authorization: Bearer pk_your_key_here" \
-H "X-Genlook-Anonymous-Id: anon_..."
const response = await fetch('https://api.genlook.app/storefront/v1/availability', {
headers: {
'Authorization': `Bearer ${PUBLISHABLE_KEY}`,
'X-Genlook-Anonymous-Id': anonymousId,
},
});
const { allowed, storeId } = await response.json();
{
"allowed": true,
"storeId": "store_abc123"
}
{
"allowed": false,
"storeId": "store_abc123"
}
Check whether your shop can run try-ons right now. Cached for 2 minutes on both client and server.
With the SDK:
Return the shop’s current billing plan name. The shop is identified by the publishable key. Cached for 1 hour on the server.
On JavaScript, the
@genlook/storefront SDK is the recommended integration: it calls this endpoint for you, along with the rest of the try-on flow.SDK
const { allowed } = await genlook.checkCredits();
Request
No parameters. The shop is identified by the publishable key.curl "https://api.genlook.app/storefront/v1/availability" \
-H "Authorization: Bearer pk_your_key_here" \
-H "X-Genlook-Anonymous-Id: anon_..."
const response = await fetch('https://api.genlook.app/storefront/v1/availability', {
headers: {
'Authorization': `Bearer ${PUBLISHABLE_KEY}`,
'X-Genlook-Anonymous-Id': anonymousId,
},
});
const { allowed, storeId } = await response.json();
Response
boolean
required
true if try-ons are available, false if quota is exhausted.string
required
The Genlook store ID for the shop.
{
"allowed": true,
"storeId": "store_abc123"
}
{
"allowed": false,
"storeId": "store_abc123"
}
This endpoint fails closed. If the check errors, or if no billing plan can be resolved for the shop, it returns
allowed: false. Treat allowed: false as “do not offer a try-on”. The Create Try-On endpoint performs the definitive quota check and will return QUOTA_EXCEEDED if needed.Current plan
GET /storefront/v1/plan
string
required
The plan name for the shop. Defaults to
free when no paid plan is resolved.{
"plan": "free"
}
Was this page helpful?

