Create an entitlement
curl --request POST \
--url https://api.getlago.com/api/v1/plans/{code}/entitlements \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"entitlements": {
"seats": {
"max": 20,
"max_admins": 10,
"root": false
},
"sso": {
"provider": "okta"
}
}
}
'import requests
url = "https://api.getlago.com/api/v1/plans/{code}/entitlements"
payload = { "entitlements": {
"seats": {
"max": 20,
"max_admins": 10,
"root": False
},
"sso": { "provider": "okta" }
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
entitlements: {seats: {max: 20, max_admins: 10, root: false}, sso: {provider: 'okta'}}
})
};
fetch('https://api.getlago.com/api/v1/plans/{code}/entitlements', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.getlago.com/api/v1/plans/{code}/entitlements",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'entitlements' => [
'seats' => [
'max' => 20,
'max_admins' => 10,
'root' => false
],
'sso' => [
'provider' => 'okta'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.getlago.com/api/v1/plans/{code}/entitlements"
payload := strings.NewReader("{\n \"entitlements\": {\n \"seats\": {\n \"max\": 20,\n \"max_admins\": 10,\n \"root\": false\n },\n \"sso\": {\n \"provider\": \"okta\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.getlago.com/api/v1/plans/{code}/entitlements")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"entitlements\": {\n \"seats\": {\n \"max\": 20,\n \"max_admins\": 10,\n \"root\": false\n },\n \"sso\": {\n \"provider\": \"okta\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getlago.com/api/v1/plans/{code}/entitlements")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"entitlements\": {\n \"seats\": {\n \"max\": 20,\n \"max_admins\": 10,\n \"root\": false\n },\n \"sso\": {\n \"provider\": \"okta\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"entitlements": [
{
"code": "seats",
"name": "Number of seats",
"description": "Number of users of the account",
"privileges": [
{
"code": "max",
"name": "Maximum",
"value_type": "integer",
"config": {},
"value": 10
},
{
"code": "max_admins",
"name": "Max Admins",
"value_type": "integer",
"config": {},
"value": 5
},
{
"code": "root",
"name": "Allow root user",
"value_type": "boolean",
"config": {},
"value": true
},
{
"code": "provider",
"name": "SSO Provider",
"value_type": "select",
"value": "google",
"config": {
"select_options": [
"google",
"okta"
]
}
}
]
}
]
}{
"status": 400,
"error": "Bad request"
}{
"status": 401,
"error": "Unauthorized"
}{
"status": 404,
"error": "Not Found",
"code": "object_not_found"
}{
"status": 422,
"error": "Unprocessable entity",
"code": "validation_errors",
"error_details": {}
}Entitlements
Create plan entitlements
This endpoint creates new entitlements by adding features to a plan. Note that all existing entitlements will be deleted and replaced by the ones provided. To add a new entitlement without removing the existing ones, use PATCH. The feature must exist and all privileges must be valid for the feature.
POST
/
plans
/
{code}
/
entitlements
Create an entitlement
curl --request POST \
--url https://api.getlago.com/api/v1/plans/{code}/entitlements \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"entitlements": {
"seats": {
"max": 20,
"max_admins": 10,
"root": false
},
"sso": {
"provider": "okta"
}
}
}
'import requests
url = "https://api.getlago.com/api/v1/plans/{code}/entitlements"
payload = { "entitlements": {
"seats": {
"max": 20,
"max_admins": 10,
"root": False
},
"sso": { "provider": "okta" }
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
entitlements: {seats: {max: 20, max_admins: 10, root: false}, sso: {provider: 'okta'}}
})
};
fetch('https://api.getlago.com/api/v1/plans/{code}/entitlements', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.getlago.com/api/v1/plans/{code}/entitlements",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'entitlements' => [
'seats' => [
'max' => 20,
'max_admins' => 10,
'root' => false
],
'sso' => [
'provider' => 'okta'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.getlago.com/api/v1/plans/{code}/entitlements"
payload := strings.NewReader("{\n \"entitlements\": {\n \"seats\": {\n \"max\": 20,\n \"max_admins\": 10,\n \"root\": false\n },\n \"sso\": {\n \"provider\": \"okta\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.getlago.com/api/v1/plans/{code}/entitlements")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"entitlements\": {\n \"seats\": {\n \"max\": 20,\n \"max_admins\": 10,\n \"root\": false\n },\n \"sso\": {\n \"provider\": \"okta\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getlago.com/api/v1/plans/{code}/entitlements")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"entitlements\": {\n \"seats\": {\n \"max\": 20,\n \"max_admins\": 10,\n \"root\": false\n },\n \"sso\": {\n \"provider\": \"okta\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"entitlements": [
{
"code": "seats",
"name": "Number of seats",
"description": "Number of users of the account",
"privileges": [
{
"code": "max",
"name": "Maximum",
"value_type": "integer",
"config": {},
"value": 10
},
{
"code": "max_admins",
"name": "Max Admins",
"value_type": "integer",
"config": {},
"value": 5
},
{
"code": "root",
"name": "Allow root user",
"value_type": "boolean",
"config": {},
"value": true
},
{
"code": "provider",
"name": "SSO Provider",
"value_type": "select",
"value": "google",
"config": {
"select_options": [
"google",
"okta"
]
}
}
]
}
]
}{
"status": 400,
"error": "Bad request"
}{
"status": 401,
"error": "Unauthorized"
}{
"status": 404,
"error": "Not Found",
"code": "object_not_found"
}{
"status": 422,
"error": "Unprocessable entity",
"code": "validation_errors",
"error_details": {}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Code of the existing plan.
Example:
"startup"
Body
application/json
Entitlement payload
Feature entitlements with their privilege values. Each key is a feature code, and the value is an object containing privilege codes with their associated values.
Show child attributes
Show child attributes
Example:
{
"seats": {
"max": 20,
"max_admins": 10,
"root": false
},
"sso": { "provider": "okta" }
}
Response
Entitlement created
Show child attributes
Show child attributes
⌘I