Seller docs·Buyer docs·API reference

API Reference

Integrate LayerBuzz into your own tools and workflows. Use the API to validate licence keys, trigger checkouts, and more.

Overview

The LayerBuzz API is a REST API. All requests should be made over HTTPS. Responses are returned as JSON.

Base URL

url
https://layerbuzz.ayteelabs.com

Example request

bash
curl -X GET "https://layerbuzz.ayteelabs.com/api/licences/validate?key=MYAPP-XXXX-XXXX-XXXX-XXXX"

Authentication

Public endpoints (licence validation, free checkout, discount validation) do not require authentication. They are designed to be called from your application or CLI tools on behalf of your users.

⚠️ Do not expose your Supabase service role key or any internal secrets in client-side code. The public API endpoints are designed to be used without authentication.

Licence Keys

Use these endpoints to validate and activate licence keys in your software. This is the core integration point for CLI tools and desktop apps sold through LayerBuzz.

Example — CLI activation

typescript
// Activate a licence key (call once, on first use)
const res = await fetch('https://layerbuzz.ayteelabs.com/api/licences/validate', {
  method: 'POST',
  headers: { 'content-type': 'application/json' },
  body: JSON.stringify({
    key: userEnteredKey,
    increment_activation: true,
  }),
})

const data = await res.json()

if (data.valid) {
  // Save key locally and mark as activated
  saveKeyLocally(data.licence.key)
} else {
  console.error('Invalid key:', data.error)
}

// Validate on subsequent launches (no increment)
const res = await fetch(
  `https://layerbuzz.ayteelabs.com/api/licences/validate?key=${savedKey}`
)
const data = await res.json()
// data.valid === true means key is still active

Checkout

Use the free checkout endpoint to programmatically trigger a free product delivery — useful for giveaways, lead magnets, or automated workflows.

Discounts

Validate discount codes before applying them to a checkout. This endpoint is called client-side when a buyer enters a discount code on the product page.

Errors

The API uses standard HTTP status codes. Errors return a JSON object with an error field describing what went wrong.

StatusMeaning
200Success
400Bad request — missing or invalid parameters
401Unauthorised — authentication required
403Forbidden — download limit reached or key revoked
404Not found — product, order, or key does not exist
500Server error — something went wrong on our end

Error response format

json
{
  "error": "Invalid licence key"
}

Handling errors in code

typescript
const res = await fetch('https://layerbuzz.ayteelabs.com/api/licences/validate', {
  method: 'POST',
  headers: { 'content-type': 'application/json' },
  body: JSON.stringify({ key, increment_activation: true }),
})

if (!res.ok) {
  const err = await res.json()
  console.error('API error:', err.error)
  return
}

const data = await res.json()
if (!data.valid) {
  console.error('Invalid key:', data.error)
}