Create PlanTemplate - m3ter Documentation
Create PlanTemplate
cURL
curl --request POST \
--url https://api.m3ter.com/organizations/{orgId}/plantemplates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '\n{
"version": null,
"customFields": [],
"productId": "string",
"name": "string",
"currency": "USD",
"standingCharge": 0,
"standingChargeDescription": "string",
"standingChargeInterval": 1,
"standingChargeOffset": 364,
"billFrequencyInterval": 1,
"billFrequency": "DAILY",
"ordinal": 0,
"code": "string",
"minimumSpend": 0,
"minimumSpendDescription": "string",
"standingChargeBillInAdvance": true,
"minimumSpendBillInAdvance": true
}
'
Python
import requests
url = "https://api.m3ter.com/organizations/{orgId}/plantemplates"
payload = {
"version": None,
"customFields": [],
"productId": "string",
"name": "string",
"currency": "USD",
"standingCharge": 0,
"standingChargeDescription": "string",
"standingChargeInterval": 1,
"standingChargeOffset": 364,
"billFrequencyInterval": 1,
"billFrequency": "DAILY",
"ordinal": 0,
"code": "string",
"minimumSpend": 0,
"minimumSpendDescription": "string",
"standingChargeBillInAdvance": True,
"minimumSpendBillInAdvance": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
JavaScript
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
version: null,
customFields: [],
productId: 'string',
name: 'string',
currency: 'USD',
standingCharge: 0,
standingChargeDescription: 'string',
standingChargeInterval: 1,
standingChargeOffset: 364,
billFrequencyInterval: 1,
billFrequency: 'DAILY',
ordinal: 0,
code: 'string',
minimumSpend: 0,
minimumSpendDescription: 'string',
standingChargeBillInAdvance: true,
minimumSpendBillInAdvance: true
})
};
fetch('https://api.m3ter.com/organizations/{orgId}/plantemplates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, [\
CURLOPT_URL => "https://api.m3ter.com/organizations/{orgId}/plantemplates",\
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([\
'version' => null,\
'customFields' => [\
\
],\
'productId' => 'string',\
'name' => 'string',\
'currency' => 'USD',\
'standingCharge' => 0,\
'standingChargeDescription' => 'string',\
'standingChargeInterval' => 1,\
'standingChargeOffset' => 364,\
'billFrequencyInterval' => 1,\
'billFrequency' => 'DAILY',\
'ordinal' => 0,\
'code' => 'string',\
'minimumSpend' => 0,\
'minimumSpendDescription' => 'string',\
'standingChargeBillInAdvance' => true,\
'minimumSpendBillInAdvance' => true\
]),\
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;
}
?>
Response Example
{
"id": "string",
"version": 1,
"customFields": {
"example1": 123,
"example2": "string"
},
"productId": "string",
"name": "string",
"currency": "USD",
"standingCharge": 0,
"standingChargeDescription": "string",
"standingChargeInterval": 1,
"standingChargeOffset": 364,
"billFrequencyInterval": 1,
"billFrequency": "DAILY",
"ordinal": 0,
"code": "string",
"minimumSpend": 0,
"minimumSpendDescription": "string",
"standingChargeBillInAdvance": true,
"minimumSpendBillInAdvance": false
}
Authorization
Authorization: string (required) - OAuth2 machine to machine authentication
Path Parameters
orgId: string (required) - UUID of the organization.
Body Parameters
productId: string (required) - Unique identifier of the Product associated with this PlanTemplate.
name: string (required) - Descriptive name for the PlanTemplate.
currency: string (required) - ISO currency code (e.g., USD).
standingCharge: number (required) - Fixed charge applied to customer bills.
billFrequency: enum (required) - Frequency at which bills are generated (e.g., DAILY, WEEKLY).
- other parameters as per API documentation.