Update applied rate card
curl --request PUT \
--url https://api.getlago.com/api/v2/contracts/{contract_external_id}/applied_rate_cards/{code} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"applied_rate_card": {
"units": "1.5",
"billing_anchor_date": "2022-04-29",
"billing_scope": "cycle"
}
}
'import requests
url = "https://api.getlago.com/api/v2/contracts/{contract_external_id}/applied_rate_cards/{code}"
payload = { "applied_rate_card": {
"units": "1.5",
"billing_anchor_date": "2022-04-29",
"billing_scope": "cycle"
} }
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({
applied_rate_card: {units: '1.5', billing_anchor_date: '2022-04-29', billing_scope: 'cycle'}
})
};
fetch('https://api.getlago.com/api/v2/contracts/{contract_external_id}/applied_rate_cards/{code}', 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/v2/contracts/{contract_external_id}/applied_rate_cards/{code}",
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([
'applied_rate_card' => [
'units' => '1.5',
'billing_anchor_date' => '2022-04-29',
'billing_scope' => 'cycle'
]
]),
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/v2/contracts/{contract_external_id}/applied_rate_cards/{code}"
payload := strings.NewReader("{\n \"applied_rate_card\": {\n \"units\": \"1.5\",\n \"billing_anchor_date\": \"2022-04-29\",\n \"billing_scope\": \"cycle\"\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://api.getlago.com/api/v2/contracts/{contract_external_id}/applied_rate_cards/{code}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"applied_rate_card\": {\n \"units\": \"1.5\",\n \"billing_anchor_date\": \"2022-04-29\",\n \"billing_scope\": \"cycle\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getlago.com/api/v2/contracts/{contract_external_id}/applied_rate_cards/{code}")
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 \"applied_rate_card\": {\n \"units\": \"1.5\",\n \"billing_anchor_date\": \"2022-04-29\",\n \"billing_scope\": \"cycle\"\n }\n}"
response = http.request(request)
puts response.read_body{
"applied_rate_card": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_contract_id": "contract_123",
"rate_card_code": "compute_usd",
"product_code": "api_requests",
"product_filter_code": "eu",
"units": "1.5",
"effective_date": "2022-04-29",
"billing_anchor_date": "2022-04-29",
"next_billing_at": null,
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"billing_scope": "cycle"
}
}{
"code": "invalid_expand",
"details": [
{
"code": "malformed",
"field": "expands",
"meta": {
"allowed_values": []
}
}
]
}{
"code": "unauthorized",
"details": []
}{
"code": "feature_unavailable",
"details": []
}{
"code": "resource_not_found",
"details": [
{
"code": "resource_not_found",
"field": "base",
"meta": {
"resource": "resource_name"
}
}
]
}{
"code": "validation_errors",
"details": [
{
"code": "value_is_mandatory",
"field": "name",
"meta": {}
}
]
}Applied rate cards
Update applied rate card
PUT and PATCH both accept partial updates.
PUT
/
contracts
/
{contract_external_id}
/
applied_rate_cards
/
{code}
Update applied rate card
curl --request PUT \
--url https://api.getlago.com/api/v2/contracts/{contract_external_id}/applied_rate_cards/{code} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"applied_rate_card": {
"units": "1.5",
"billing_anchor_date": "2022-04-29",
"billing_scope": "cycle"
}
}
'import requests
url = "https://api.getlago.com/api/v2/contracts/{contract_external_id}/applied_rate_cards/{code}"
payload = { "applied_rate_card": {
"units": "1.5",
"billing_anchor_date": "2022-04-29",
"billing_scope": "cycle"
} }
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({
applied_rate_card: {units: '1.5', billing_anchor_date: '2022-04-29', billing_scope: 'cycle'}
})
};
fetch('https://api.getlago.com/api/v2/contracts/{contract_external_id}/applied_rate_cards/{code}', 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/v2/contracts/{contract_external_id}/applied_rate_cards/{code}",
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([
'applied_rate_card' => [
'units' => '1.5',
'billing_anchor_date' => '2022-04-29',
'billing_scope' => 'cycle'
]
]),
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/v2/contracts/{contract_external_id}/applied_rate_cards/{code}"
payload := strings.NewReader("{\n \"applied_rate_card\": {\n \"units\": \"1.5\",\n \"billing_anchor_date\": \"2022-04-29\",\n \"billing_scope\": \"cycle\"\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://api.getlago.com/api/v2/contracts/{contract_external_id}/applied_rate_cards/{code}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"applied_rate_card\": {\n \"units\": \"1.5\",\n \"billing_anchor_date\": \"2022-04-29\",\n \"billing_scope\": \"cycle\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getlago.com/api/v2/contracts/{contract_external_id}/applied_rate_cards/{code}")
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 \"applied_rate_card\": {\n \"units\": \"1.5\",\n \"billing_anchor_date\": \"2022-04-29\",\n \"billing_scope\": \"cycle\"\n }\n}"
response = http.request(request)
puts response.read_body{
"applied_rate_card": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_contract_id": "contract_123",
"rate_card_code": "compute_usd",
"product_code": "api_requests",
"product_filter_code": "eu",
"units": "1.5",
"effective_date": "2022-04-29",
"billing_anchor_date": "2022-04-29",
"next_billing_at": null,
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"billing_scope": "cycle"
}
}{
"code": "invalid_expand",
"details": [
{
"code": "malformed",
"field": "expands",
"meta": {
"allowed_values": []
}
}
]
}{
"code": "unauthorized",
"details": []
}{
"code": "feature_unavailable",
"details": []
}{
"code": "resource_not_found",
"details": [
{
"code": "resource_not_found",
"field": "base",
"meta": {
"resource": "resource_name"
}
}
]
}{
"code": "validation_errors",
"details": [
{
"code": "value_is_mandatory",
"field": "name",
"meta": {}
}
]
}API v2 is in beta. Endpoints return the
X-Lago-Endpoint-Status: beta header.Authorizations
Path Parameters
Query Parameters
Code of the contract to select. Required when multiple contracts share the external ID, including canceled and terminated contracts. Otherwise, it can be omitted. Omitting it when the external ID is ambiguous returns 422 value_is_mandatory on contract_code; a blank value returns 422 value_is_invalid. Exact contract code.
Minimum string length:
1Example:
"initial"
Body
application/json
Request payload