Skip to main content
Version: development

Integration guide

This guide walks through the complete embedded dashboard flow, from onboarding a website to loading the dashboard in your platform.

Before you start

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​

EnvironmentBase URLUsage
Staginghttps://api.staging.lawwwing.com/Development and validation of the integration.
Productionhttps://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.

Store the site_id

Save 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..."
}
Always request a fresh token

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>
Presentation recommendations
  • Reserve a generous height (100vh or the container height) to avoid double scrollbars.
  • Generate the embed_url on 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:

SituationOperation
The customer wants to check the status of their serviceRetrieve the subscription
The customer cancels the renewalCancel the subscription
The customer wants to revert the cancellation before the end of the periodReactivate the subscription
Permanent termination of the serviceTerminate 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 401 responses, for credentials, and 400 responses, 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