Skip to main content
POST
/
companies
/
{company_id}
/
entitlements
Create Entitlement
curl --request POST \
  --url https://api.getmeasure.com/api/v1/companies/{company_id}/entitlements \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "key": "<string>",
  "name": "<string>",
  "adjust_for_quantity": true,
  "possible_values": [
    "<string>"
  ]
}
'
import requests

url = "https://api.getmeasure.com/api/v1/companies/{company_id}/entitlements"

payload = {
"key": "<string>",
"name": "<string>",
"adjust_for_quantity": True,
"possible_values": ["<string>"]
}
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({
key: '<string>',
name: '<string>',
adjust_for_quantity: true,
possible_values: ['<string>']
})
};

fetch('https://api.getmeasure.com/api/v1/companies/{company_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://api.getmeasure.com/api/v1/companies/{company_id}/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([
'key' => '<string>',
'name' => '<string>',
'adjust_for_quantity' => true,
'possible_values' => [
'<string>'
]
]),
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.getmeasure.com/api/v1/companies/{company_id}/entitlements"

payload := strings.NewReader("{\n \"key\": \"<string>\",\n \"name\": \"<string>\",\n \"adjust_for_quantity\": true,\n \"possible_values\": [\n \"<string>\"\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.getmeasure.com/api/v1/companies/{company_id}/entitlements")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"key\": \"<string>\",\n \"name\": \"<string>\",\n \"adjust_for_quantity\": true,\n \"possible_values\": [\n \"<string>\"\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.getmeasure.com/api/v1/companies/{company_id}/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 \"key\": \"<string>\",\n \"name\": \"<string>\",\n \"adjust_for_quantity\": true,\n \"possible_values\": [\n \"<string>\"\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "aggregator_type": "<string>",
  "id": "<string>",
  "key": "<string>",
  "name": "<string>",
  "possible_values": [
    "<string>"
  ],
  "type": "<string>"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

Idempotency-Key
string

The idempotency key that will be used to ensure the request is only performed once

Path Parameters

company_id
string
required

The company ID with the prefix 'cmp_'.

Body

application/json
aggregator_type
enum<string>
required

The aggregator type of the entitlement in case a customer has different values for different subscriptions. This can be one of OR, AND (for BOOL), ADD, MINIMUM, MAXIMUM (for NUMBER), COALESCE (for TEXT, ENUM, or MULTI_ENUM)

Available options:
OR,
AND,
ADD,
MINIMUM,
MAXIMUM,
COALESCE
key
string
required

A unique key for the entitlement without spaces, unicode or special characters eg. test-feature-1

name
string
required

The name of the entitlement

type
enum<string>
required

The type of the entitlement that can be one of boolean, text, number, enum, or multi_enum.

Available options:
BOOL,
NUMBER,
TEXT,
ENUM,
MULTI_ENUM
adjust_for_quantity
null | boolean
possible_values
string[]

The possible values for the entitlement of enum or multi_enum type

Response

201 - application/json

Created

aggregator_type
string

The aggregator type of the entitlement

id
string

The ID of the entitlement

key
string

The key of the entitlement

name
string

The name of the entitlement

possible_values
string[]

The possible values of the entitlement if the type is ENUM or MULTI_ENUM

type
string

The type of the entitlement that can be BOOL, TEXT, NUMBER, ENUM, or MULTI_ENUM