Entitlements
Replace Plan Entitlements
Replace a plan’s full entitlement set. Feature keys absent from the request are removed.
PUT
/
v1
/
plans
/
{id}
/
entitlements
Replace a plan's entitlement set
curl --request PUT \
--url https://billing.example.com/v1/plans/{id}/entitlements \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
[
{
"feature_key": "<string>",
"bool_value": true,
"limit_value": 123
}
]
'import requests
url = "https://billing.example.com/v1/plans/{id}/entitlements"
payload = [
{
"feature_key": "<string>",
"bool_value": True,
"limit_value": 123
}
]
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify([{feature_key: '<string>', bool_value: true, limit_value: 123}])
};
fetch('https://billing.example.com/v1/plans/{id}/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://billing.example.com/v1/plans/{id}/entitlements",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
[
'feature_key' => '<string>',
'bool_value' => true,
'limit_value' => 123
]
]),
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://billing.example.com/v1/plans/{id}/entitlements"
payload := strings.NewReader("[\n {\n \"feature_key\": \"<string>\",\n \"bool_value\": true,\n \"limit_value\": 123\n }\n]")
req, _ := http.NewRequest("PUT", 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.put("https://billing.example.com/v1/plans/{id}/entitlements")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("[\n {\n \"feature_key\": \"<string>\",\n \"bool_value\": true,\n \"limit_value\": 123\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/v1/plans/{id}/entitlements")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"feature_key\": \"<string>\",\n \"bool_value\": true,\n \"limit_value\": 123\n }\n]"
response = http.request(request)
puts response.read_body{
"data": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"plan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"feature_key": "<string>",
"kind": "boolean",
"bool_value": true,
"limit_value": 123
}
]
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>"
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>"
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>"
}
}Request Body
The body is a JSON array of entitlement inputs. The plan’s stored set is fully replaced — any feature key not present in the array is removed from the plan.| Field | Type | Required | Description |
|---|---|---|---|
feature_key | string | Yes | Machine identifier, max 128 chars, matching ^[A-Za-z0-9][A-Za-z0-9._:-]*$. Must be unique within the request. |
kind | string | Yes | boolean or limit |
bool_value | boolean | For boolean | Required for kind: boolean; must be omitted for limit |
limit_value | integer | For limit | Required for kind: limit (>= 0); must be omitted for boolean |
Example Request
curl -X PUT https://api.recurso.dev/v1/plans/8f14e45f-ceea-467f-a1d6-8f2f3f9a1b2c/entitlements \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '[
{ "feature_key": "sso", "kind": "boolean", "bool_value": true },
{ "feature_key": "seats", "kind": "limit", "limit_value": 25 }
]'
Response
{
"data": [
{
"id": "e7c1a2d4-9b3f-4c6e-8a1d-2f3b4c5d6e7f",
"plan_id": "8f14e45f-ceea-467f-a1d6-8f2f3f9a1b2c",
"feature_key": "sso",
"kind": "boolean",
"bool_value": true,
"limit_value": null
},
{
"id": "a1b2c3d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
"plan_id": "8f14e45f-ceea-467f-a1d6-8f2f3f9a1b2c",
"feature_key": "seats",
"kind": "limit",
"bool_value": null,
"limit_value": 25
}
]
}
Errors
| Status | Code | When |
|---|---|---|
400 | validation_failed | Invalid plan id, malformed body, duplicate feature_key, or kind/value mismatch |
404 | not_found | Plan does not exist for this tenant |
Send the complete entitlement set every time. A request containing only the
feature you changed will delete every other grant on the plan.
See the Entitlements guide for how plan grants
resolve into a customer’s effective entitlements.
Authorizations
Tenant API key obtained from POST /auth/register or POST /v1/developer/keys.
Path Parameters
Body
application/json
Response
Updated entitlement set
Show child attributes
Show child attributes
⌘I
Replace a plan's entitlement set
curl --request PUT \
--url https://billing.example.com/v1/plans/{id}/entitlements \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
[
{
"feature_key": "<string>",
"bool_value": true,
"limit_value": 123
}
]
'import requests
url = "https://billing.example.com/v1/plans/{id}/entitlements"
payload = [
{
"feature_key": "<string>",
"bool_value": True,
"limit_value": 123
}
]
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify([{feature_key: '<string>', bool_value: true, limit_value: 123}])
};
fetch('https://billing.example.com/v1/plans/{id}/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://billing.example.com/v1/plans/{id}/entitlements",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
[
'feature_key' => '<string>',
'bool_value' => true,
'limit_value' => 123
]
]),
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://billing.example.com/v1/plans/{id}/entitlements"
payload := strings.NewReader("[\n {\n \"feature_key\": \"<string>\",\n \"bool_value\": true,\n \"limit_value\": 123\n }\n]")
req, _ := http.NewRequest("PUT", 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.put("https://billing.example.com/v1/plans/{id}/entitlements")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("[\n {\n \"feature_key\": \"<string>\",\n \"bool_value\": true,\n \"limit_value\": 123\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/v1/plans/{id}/entitlements")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"feature_key\": \"<string>\",\n \"bool_value\": true,\n \"limit_value\": 123\n }\n]"
response = http.request(request)
puts response.read_body{
"data": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"plan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"feature_key": "<string>",
"kind": "boolean",
"bool_value": true,
"limit_value": 123
}
]
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>"
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>"
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>"
}
}