curl --request PUT \
--url https://app.miget.com/api/v1/workspace/spend_limit \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"spend_limit_in_cents": 123
}
'import requests
url = "https://app.miget.com/api/v1/workspace/spend_limit"
payload = { "spend_limit_in_cents": 123 }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({spend_limit_in_cents: 123})
};
fetch('https://app.miget.com/api/v1/workspace/spend_limit', 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://app.miget.com/api/v1/workspace/spend_limit",
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([
'spend_limit_in_cents' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://app.miget.com/api/v1/workspace/spend_limit"
payload := strings.NewReader("{\n \"spend_limit_in_cents\": 123\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "<api-key>")
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://app.miget.com/api/v1/workspace/spend_limit")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"spend_limit_in_cents\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.miget.com/api/v1/workspace/spend_limit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"spend_limit_in_cents\": 123\n}"
response = http.request(request)
puts response.read_body{
"billed_in_cents": 123,
"pending_in_cents": 123,
"total_in_cents": 123,
"minimum_in_cents": 123,
"projected_in_cents": 123,
"limit_reached_on": "2023-12-25",
"spend_limit_in_cents": 123,
"spend_limit_floor_in_cents": 123,
"pay_per_use_enabled": true,
"charge_threshold_in_cents": 123,
"charged_early_in_cents": 123,
"credits_applied_in_cents": 123,
"due_after_first_payment_in_cents": 123,
"cycle_start": "<string>",
"cycle_end": "<string>",
"billed_through": "<string>",
"workloads": [
{
"workload_type": "<string>",
"workload_id": 123,
"name": "<string>",
"amount_in_cents": 123,
"resources": {}
}
],
"adjustments": [
{
"amount_in_cents": 123,
"note": "<string>",
"made_at": "<string>"
}
]
}Set the usage spend limit
Caps what the workspace’s usage may reach this cycle. At the limit every application, database and service on Usage Billing is stopped, nothing on a resource, and raising it again starts exactly those back up. The limit cannot be set below spend_limit_floor_in_cents: the monthly minimum, or what storage alone costs for a cycle when that is more. Send null to remove it.
curl --request PUT \
--url https://app.miget.com/api/v1/workspace/spend_limit \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"spend_limit_in_cents": 123
}
'import requests
url = "https://app.miget.com/api/v1/workspace/spend_limit"
payload = { "spend_limit_in_cents": 123 }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({spend_limit_in_cents: 123})
};
fetch('https://app.miget.com/api/v1/workspace/spend_limit', 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://app.miget.com/api/v1/workspace/spend_limit",
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([
'spend_limit_in_cents' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://app.miget.com/api/v1/workspace/spend_limit"
payload := strings.NewReader("{\n \"spend_limit_in_cents\": 123\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "<api-key>")
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://app.miget.com/api/v1/workspace/spend_limit")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"spend_limit_in_cents\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.miget.com/api/v1/workspace/spend_limit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"spend_limit_in_cents\": 123\n}"
response = http.request(request)
puts response.read_body{
"billed_in_cents": 123,
"pending_in_cents": 123,
"total_in_cents": 123,
"minimum_in_cents": 123,
"projected_in_cents": 123,
"limit_reached_on": "2023-12-25",
"spend_limit_in_cents": 123,
"spend_limit_floor_in_cents": 123,
"pay_per_use_enabled": true,
"charge_threshold_in_cents": 123,
"charged_early_in_cents": 123,
"credits_applied_in_cents": 123,
"due_after_first_payment_in_cents": 123,
"cycle_start": "<string>",
"cycle_end": "<string>",
"billed_through": "<string>",
"workloads": [
{
"workload_type": "<string>",
"workload_id": 123,
"name": "<string>",
"amount_in_cents": 123,
"resources": {}
}
],
"adjustments": [
{
"amount_in_cents": 123,
"note": "<string>",
"made_at": "<string>"
}
]
}Authorizations
Body
Response
Set the usage spend limit
Api_V1_Entities_WorkspaceUsage model
Unbilled usage beyond the minimum is charged to the card whenever it reaches this amount, rather than waiting for the renewal. It starts at 2500 and each paid renewal raises it a step (5000, 25000, 100000, 400000); during a free trial, until a charge in it is paid, it is 500. A value Miget set for the workspace, on an approved limit increase or otherwise, replaces the ladder; null once usage is charged with the renewal alone, and before the subscription's first payment, when nothing is charged. A refused charge stops the workspace's workloads on Usage Billing until it is paid
What the workspace's credits pay of this cycle's usage beyond the minimum, before the card: what they paid of the hours already sent to billing, plus what the balance left covers of the rest, the hour in progress included. The renewal and the threshold bill only the usage beyond the minimum and these credits
Usage that ran before the subscription's first payment, as during an onboarding Miget set up, and is not billed yet: all of it, with no monthly minimum taken off, is charged to the card right after that payment, the workspace's credits paying first. 0 once the subscription is paid

