Skip to main content
POST
/
contracts
/
{contractId}
/
plans
Add plan to contract
curl --request POST \
  --url https://api.getenso.ai/contracts/{contractId}/plans \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "PlanId": "100",
  "startDate": "2026-04-01",
  "planId": "100",
  "name": "Annual Enterprise Subscription 2026",
  "endDate": "2027-03-31",
  "type": "standard",
  "orderIndex": 0,
  "ParentContractPlanId": "42",
  "parentContractPlanId": "42",
  "items": [
    {
      "SkuId": "sku_123",
      "CurrencyId": "2",
      "PlanTypeId": "3",
      "config": {
        "dayOfPeriod": 1,
        "amount": 999,
        "revenueRule": "immediate"
      },
      "id": "456",
      "orderIndex": 0,
      "description": "Per-user annual license",
      "milestones": [
        {
          "type": "invoice_trigger",
          "ContractMilestoneId": "123",
          "config": {
            "percentage_of_revenue": 25
          }
        }
      ]
    }
  ]
}
'
import requests

url = "https://api.getenso.ai/contracts/{contractId}/plans"

payload = {
"PlanId": "100",
"startDate": "2026-04-01",
"planId": "100",
"name": "Annual Enterprise Subscription 2026",
"endDate": "2027-03-31",
"type": "standard",
"orderIndex": 0,
"ParentContractPlanId": "42",
"parentContractPlanId": "42",
"items": [
{
"SkuId": "sku_123",
"CurrencyId": "2",
"PlanTypeId": "3",
"config": {
"dayOfPeriod": 1,
"amount": 999,
"revenueRule": "immediate"
},
"id": "456",
"orderIndex": 0,
"description": "Per-user annual license",
"milestones": [
{
"type": "invoice_trigger",
"ContractMilestoneId": "123",
"config": { "percentage_of_revenue": 25 }
}
]
}
]
}
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({
PlanId: '100',
startDate: '2026-04-01',
planId: '100',
name: 'Annual Enterprise Subscription 2026',
endDate: '2027-03-31',
type: 'standard',
orderIndex: 0,
ParentContractPlanId: '42',
parentContractPlanId: '42',
items: [
{
SkuId: 'sku_123',
CurrencyId: '2',
PlanTypeId: '3',
config: {dayOfPeriod: 1, amount: 999, revenueRule: 'immediate'},
id: '456',
orderIndex: 0,
description: 'Per-user annual license',
milestones: [
{
type: 'invoice_trigger',
ContractMilestoneId: '123',
config: {percentage_of_revenue: 25}
}
]
}
]
})
};

fetch('https://api.getenso.ai/contracts/{contractId}/plans', 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.getenso.ai/contracts/{contractId}/plans",
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([
'PlanId' => '100',
'startDate' => '2026-04-01',
'planId' => '100',
'name' => 'Annual Enterprise Subscription 2026',
'endDate' => '2027-03-31',
'type' => 'standard',
'orderIndex' => 0,
'ParentContractPlanId' => '42',
'parentContractPlanId' => '42',
'items' => [
[
'SkuId' => 'sku_123',
'CurrencyId' => '2',
'PlanTypeId' => '3',
'config' => [
'dayOfPeriod' => 1,
'amount' => 999,
'revenueRule' => 'immediate'
],
'id' => '456',
'orderIndex' => 0,
'description' => 'Per-user annual license',
'milestones' => [
[
'type' => 'invoice_trigger',
'ContractMilestoneId' => '123',
'config' => [
'percentage_of_revenue' => 25
]
]
]
]
]
]),
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.getenso.ai/contracts/{contractId}/plans"

payload := strings.NewReader("{\n \"PlanId\": \"100\",\n \"startDate\": \"2026-04-01\",\n \"planId\": \"100\",\n \"name\": \"Annual Enterprise Subscription 2026\",\n \"endDate\": \"2027-03-31\",\n \"type\": \"standard\",\n \"orderIndex\": 0,\n \"ParentContractPlanId\": \"42\",\n \"parentContractPlanId\": \"42\",\n \"items\": [\n {\n \"SkuId\": \"sku_123\",\n \"CurrencyId\": \"2\",\n \"PlanTypeId\": \"3\",\n \"config\": {\n \"dayOfPeriod\": 1,\n \"amount\": 999,\n \"revenueRule\": \"immediate\"\n },\n \"id\": \"456\",\n \"orderIndex\": 0,\n \"description\": \"Per-user annual license\",\n \"milestones\": [\n {\n \"type\": \"invoice_trigger\",\n \"ContractMilestoneId\": \"123\",\n \"config\": {\n \"percentage_of_revenue\": 25\n }\n }\n ]\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.getenso.ai/contracts/{contractId}/plans")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"PlanId\": \"100\",\n \"startDate\": \"2026-04-01\",\n \"planId\": \"100\",\n \"name\": \"Annual Enterprise Subscription 2026\",\n \"endDate\": \"2027-03-31\",\n \"type\": \"standard\",\n \"orderIndex\": 0,\n \"ParentContractPlanId\": \"42\",\n \"parentContractPlanId\": \"42\",\n \"items\": [\n {\n \"SkuId\": \"sku_123\",\n \"CurrencyId\": \"2\",\n \"PlanTypeId\": \"3\",\n \"config\": {\n \"dayOfPeriod\": 1,\n \"amount\": 999,\n \"revenueRule\": \"immediate\"\n },\n \"id\": \"456\",\n \"orderIndex\": 0,\n \"description\": \"Per-user annual license\",\n \"milestones\": [\n {\n \"type\": \"invoice_trigger\",\n \"ContractMilestoneId\": \"123\",\n \"config\": {\n \"percentage_of_revenue\": 25\n }\n }\n ]\n }\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.getenso.ai/contracts/{contractId}/plans")

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 \"PlanId\": \"100\",\n \"startDate\": \"2026-04-01\",\n \"planId\": \"100\",\n \"name\": \"Annual Enterprise Subscription 2026\",\n \"endDate\": \"2027-03-31\",\n \"type\": \"standard\",\n \"orderIndex\": 0,\n \"ParentContractPlanId\": \"42\",\n \"parentContractPlanId\": \"42\",\n \"items\": [\n {\n \"SkuId\": \"sku_123\",\n \"CurrencyId\": \"2\",\n \"PlanTypeId\": \"3\",\n \"config\": {\n \"dayOfPeriod\": 1,\n \"amount\": 999,\n \"revenueRule\": \"immediate\"\n },\n \"id\": \"456\",\n \"orderIndex\": 0,\n \"description\": \"Per-user annual license\",\n \"milestones\": [\n {\n \"type\": \"invoice_trigger\",\n \"ContractMilestoneId\": \"123\",\n \"config\": {\n \"percentage_of_revenue\": 25\n }\n }\n ]\n }\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "status": "success",
  "message": "Success",
  "data": {}
}
{
"status": "error",
"message": "Forbidden",
"errors": [
{}
]
}
Not accessible by SystemUser role. Requires Admin.

Authorizations

Authorization
string
header
required

JWT bearer token obtained from POST /auth/system-login using your client credentials.

Path Parameters

contractId
string
required

Contract ID

Body

application/json

Use PlanId or planId to reuse an existing billing plan. If neither is sent, the route creates a new plan and expects name, and typically items.

PlanId
string
required
Example:

"100"

startDate
string<date>
required
Example:

"2026-04-01"

planId
string
Example:

"100"

name
string
Example:

"Annual Enterprise Subscription 2026"

endDate
string<date>
Example:

"2027-03-31"

type
enum<string>
Available options:
standard,
extension,
renewal
Example:

"standard"

orderIndex
integer
Example:

0

renewalTerms
object
ParentContractPlanId
string
Example:

"42"

parentContractPlanId
string
Example:

"42"

items
object[]

When creating a new plan item, provide CurrencyId, PlanTypeId, config, and either SkuId or Sku. The route persists meter references from config.meter and config.quantityMeter.

Response

Success

status
string
Example:

"success"

message
string
Example:

"Success"

data
object | null

Endpoint-specific payload (object, array, or null)