Integration guide
This guide walks through the complete embedded dashboard flow, from onboarding a website to loading the dashboard in your platform.
You need active integrator credentials. If you do not have them yet, request access and we will support you during onboarding.
Prerequisitesβ
Before you start, make sure you have:
- An integrator API key for the environment you are going to work in, staging or production.
- A backend from which to make the calls. The key must never travel to the browser.
- A space in your interface where you can render a full-screen iframe.
Environmentsβ
| Environment | Base URL | Usage |
|---|---|---|
| Staging | https://api.staging.lawwwing.com/ | Development and validation of the integration. |
| Production | https://api.lawwwing.com/ | Live operation, once the integration has been validated. |
Each environment has its own API key and they are not interchangeable.
Step 0. Check connectivityβ
First of all, confirm that your credentials work:
curl -X GET "https://api.lawwwing.com/api/integrator/ping/" \
-H "Authorization: Integrator-Key ${TOKEN}" \
-H "Content-Type: application/json"
A {"message": "pong"} response confirms that authentication is correct.
Step 1. Onboard your customer's websiteβ
curl -X POST "https://api.lawwwing.com/api/integrators/sites/" \
-H "Authorization: Integrator-Key ${TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"url": "client.example.com"
}'
The response includes the site field, the unique identifier of the website.
site_idSave the site_id alongside the customer record in your database. You will need it in every subsequent operation.
Step 2. Activate the subscriptionβ
Assign the website the plan and modules matching what your customer has purchased:
curl -X POST "https://api.lawwwing.com/api/integrators/sites/{site_id}/subscription/" \
-H "Authorization: Integrator-Key ${TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"tier": "growth",
"interval": "monthly",
"modules": [
{"name": "extra_language", "quantity": 2}
]
}'
Check the accepted values for tier, interval and modules in the API reference, including the module catalogue and how quantity is interpreted for each one.
Step 3. Generate the dashboard sessionβ
Every time your customer opens their dashboard, request a new session URL:
curl -X GET "https://api.lawwwing.com/api/integrators/sites/{site_id}/embed/" \
-H "Authorization: Integrator-Key ${TOKEN}" \
-H "Content-Type: application/json"
{
"site": "61e21ed7-2770-4fa8-baad-53564ee7651d",
"embed_url": "https://app.lawwwing.com/d/61e21ed7-2770-4fa8-baad-53564ee7651d/?embed=1&token=cd99d2...",
"embed_token": "cd99d2..."
}
Session tokens have a limited validity for security reasons. Do not store or reuse them: request a new embed_url on every dashboard load.
Step 4. Render the dashboardβ
Use the embed_url value as the src of the iframe:
<iframe
src="https://app.lawwwing.com/d/61e21ed7-2770-4fa8-baad-53564ee7651d/?embed=1&token=cd99d2..."
style="width: 100%; height: 100vh; border: none;"
></iframe>
- Reserve a generous height (
100vhor the container height) to avoid double scrollbars. - Generate the
embed_urlon the server and pass it to your frontend just before mounting the iframe. - If your customer closes and reopens the dashboard, repeat Step 3.
Lifecycle managementβ
Once the website is live, you control the rest of the lifecycle from your own flows:
| Situation | Operation |
|---|---|
| The customer wants to check the status of their service | Retrieve the subscription |
| The customer cancels the renewal | Cancel the subscription |
| The customer wants to revert the cancellation before the end of the period | Reactivate the subscription |
| Permanent termination of the service | Terminate the subscription |
Best practicesβ
- Protect the API key - Store it in your secrets manager and always make the calls from the server.
- Check before creating - Before onboarding a website or a subscription, verify whether it already exists in your own records.
- Handle errors - Manage
401responses, for credentials, and400responses, for validation, so you can show clear messages to your customers. - Validate in staging - Reproduce every scenario (onboarding, plan change, cancellation and termination) before moving to production.
Need help?β
During the integration you have a direct channel with our technical team.
π¬ Talk to the team