Provision after a sale
When a customer buys or renews, your server tells LaaSio. Two calls cover it: assign a SKU to a client, and renew the client’s term.
The provisioning key
Section titled “The provisioning key”Your organization has one provisioning key (lzk_…), shown in LaaSio → Settings. Send it as the
X-API-Key header. It acts for your organization and can only call these two endpoints, plus the
activation key calls for keys you sell.
Assign a SKU
Section titled “Assign a SKU”POST /api/v1/clients/assign gives a client a SKU with a fresh term.
| Field | Required | Description |
|---|---|---|
client_id |
yes | Your ID for the client. Created if it doesn’t exist yet. |
sku |
yes | The SKU’s code. |
name |
no | A label for the client, used only when the client is created. |
start |
no | Term start. Defaults to now. |
end |
no | Term end. Defaults to start plus the SKU’s duration. Must be in the future and after start. Not allowed for a perpetual SKU. |
If the client already holds a SKU of the same application, it is replaced with the new SKU and a fresh term.
The response is the client with all its assignments: 201 when the client was created, 200 otherwise.
curl -X POST 'https://laasio.functual.com/api/v1/clients/assign' \ -H "X-API-Key: $LAASIO_PROVISIONING_KEY" \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -d '{"client_id":"PC-123","sku":"AV-ANNUAL-25","name":"Acme HQ"}'// Node.js 18+ (built-in fetch)const response = await fetch("https://laasio.functual.com/api/v1/clients/assign", { method: "POST", headers: { "X-API-Key": process.env.LAASIO_PROVISIONING_KEY, "Accept": "application/json", "Content-Type": "application/json", }, body: JSON.stringify({"client_id":"PC-123","sku":"AV-ANNUAL-25","name":"Acme HQ"}),});if (!response.ok) throw new Error(`LaaSio ${response.status}: ${await response.text()}`);
const { data: client } = await response.json();console.log(client.assignments);# pip install requestsimport osimport requests
response = requests.post( "https://laasio.functual.com/api/v1/clients/assign", headers={"X-API-Key": os.environ["LAASIO_PROVISIONING_KEY"], "Accept": "application/json"}, json={"client_id": "PC-123", "sku": "AV-ANNUAL-25", "name": "Acme HQ"}, timeout=10,)response.raise_for_status()
client = response.json()["data"]print(client["assignments"])// .NET 6+using System.Net.Http.Json;
using var http = new HttpClient();http.DefaultRequestHeaders.Add("X-API-Key", Environment.GetEnvironmentVariable("LAASIO_PROVISIONING_KEY"));http.DefaultRequestHeaders.Add("Accept", "application/json");
var response = await http.PostAsJsonAsync("https://laasio.functual.com/api/v1/clients/assign", new { client_id = "PC-123", sku = "AV-ANNUAL-25", name = "Acme HQ" });var body = await response.Content.ReadAsStringAsync();if (!response.IsSuccessStatusCode) throw new Exception($"LaaSio {(int)response.StatusCode}: {body}");
Console.WriteLine(body);package main
import ( "bytes" "encoding/json" "fmt" "io" "net/http" "os")
func main() { payload, _ := json.Marshal(map[string]string{"client_id": "PC-123", "sku": "AV-ANNUAL-25", "name": "Acme HQ"})
req, _ := http.NewRequest("POST", "https://laasio.functual.com/api/v1/clients/assign", bytes.NewReader(payload)) req.Header.Set("X-API-Key", os.Getenv("LAASIO_PROVISIONING_KEY")) req.Header.Set("Accept", "application/json") req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body) if resp.StatusCode >= 300 { panic(fmt.Sprintf("LaaSio %d: %s", resp.StatusCode, body)) } fmt.Println(string(body))}<?php// PHP 8+ with the curl extension$ch = curl_init("https://laasio.functual.com/api/v1/clients/assign");curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "X-API-Key: " . getenv("LAASIO_PROVISIONING_KEY"), "Accept: application/json", "Content-Type: application/json", ], CURLOPT_POSTFIELDS => json_encode(["client_id" => "PC-123", "sku" => "AV-ANNUAL-25", "name" => "Acme HQ"]),]);$body = curl_exec($ch);$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);if ($status >= 300) { throw new RuntimeException("LaaSio $status: $body");}
$client = json_decode($body, true)["data"];print_r($client["assignments"]);Renew a term
Section titled “Renew a term”POST /api/v1/clients/renew extends the client’s current term for a SKU it holds.
| Field | Required | Description |
|---|---|---|
client_id |
yes | Your ID for the client. |
sku |
yes | The code of the SKU the client holds. |
end |
no | The new end. Must be later than the current end. Without it, the end moves forward by one SKU duration, even if the term has lapsed. |
Renewing a client that doesn’t hold the SKU, or a perpetual SKU, returns 422. To start over after a long lapse,
call assign instead.
curl -X POST 'https://laasio.functual.com/api/v1/clients/renew' \ -H "X-API-Key: $LAASIO_PROVISIONING_KEY" \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -d '{"client_id":"PC-123","sku":"AV-ANNUAL-25"}'// Node.js 18+ (built-in fetch)const response = await fetch("https://laasio.functual.com/api/v1/clients/renew", { method: "POST", headers: { "X-API-Key": process.env.LAASIO_PROVISIONING_KEY, "Accept": "application/json", "Content-Type": "application/json", }, body: JSON.stringify({"client_id":"PC-123","sku":"AV-ANNUAL-25"}),});if (!response.ok) throw new Error(`LaaSio ${response.status}: ${await response.text()}`);
const { data: client } = await response.json();console.log(client.assignments);# pip install requestsimport osimport requests
response = requests.post( "https://laasio.functual.com/api/v1/clients/renew", headers={"X-API-Key": os.environ["LAASIO_PROVISIONING_KEY"], "Accept": "application/json"}, json={"client_id": "PC-123", "sku": "AV-ANNUAL-25"}, timeout=10,)response.raise_for_status()
client = response.json()["data"]print(client["assignments"])// .NET 6+using System.Net.Http.Json;
using var http = new HttpClient();http.DefaultRequestHeaders.Add("X-API-Key", Environment.GetEnvironmentVariable("LAASIO_PROVISIONING_KEY"));http.DefaultRequestHeaders.Add("Accept", "application/json");
var response = await http.PostAsJsonAsync("https://laasio.functual.com/api/v1/clients/renew", new { client_id = "PC-123", sku = "AV-ANNUAL-25" });var body = await response.Content.ReadAsStringAsync();if (!response.IsSuccessStatusCode) throw new Exception($"LaaSio {(int)response.StatusCode}: {body}");
Console.WriteLine(body);package main
import ( "bytes" "encoding/json" "fmt" "io" "net/http" "os")
func main() { payload, _ := json.Marshal(map[string]string{"client_id": "PC-123", "sku": "AV-ANNUAL-25"})
req, _ := http.NewRequest("POST", "https://laasio.functual.com/api/v1/clients/renew", bytes.NewReader(payload)) req.Header.Set("X-API-Key", os.Getenv("LAASIO_PROVISIONING_KEY")) req.Header.Set("Accept", "application/json") req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body) if resp.StatusCode >= 300 { panic(fmt.Sprintf("LaaSio %d: %s", resp.StatusCode, body)) } fmt.Println(string(body))}<?php// PHP 8+ with the curl extension$ch = curl_init("https://laasio.functual.com/api/v1/clients/renew");curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "X-API-Key: " . getenv("LAASIO_PROVISIONING_KEY"), "Accept: application/json", "Content-Type: application/json", ], CURLOPT_POSTFIELDS => json_encode(["client_id" => "PC-123", "sku" => "AV-ANNUAL-25"]),]);$body = curl_exec($ch);$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);if ($status >= 300) { throw new RuntimeException("LaaSio $status: $body");}
$client = json_decode($body, true)["data"];print_r($client["assignments"]);Billing by calendar month or year
Section titled “Billing by calendar month or year”If you bill by calendar period (Stripe, Paddle and most stores do), pass the billing period’s end as end
on both assign and renew. Fixed-day durations drift from calendar periods: a 31-day SKU outlasts February and a
30-day one lapses in 31-day months. An explicit end always matches what the customer paid for.
A common pattern with a subscription billing system:
- Checkout completed: assign the SKU with
end= the period end. - Renewal paid: renew with
end= the new period end. - Plan changed: assign the new SKU with
end= the period end. - Cancelled: do nothing; the term ends on its own.
Errors
Section titled “Errors”| Status | Meaning |
|---|---|
401 |
Missing or invalid X-API-Key. |
404 |
No SKU with that code in your organization. |
422 |
Invalid fields, a renewal for a SKU the client doesn’t hold, or an end that isn’t later. The body lists each problem. |
403 plan_limit |
Your organization’s growth is frozen after going over the plan, and this call would add an active client. See Plans and limits. Renewing or changing clients that are already active still works. |