curl --request POST \
--url https://app.miget.com/api/v1/workspace/pay_per_use/start \
--header 'Authorization: <api-key>'import requests
url = "https://app.miget.com/api/v1/workspace/pay_per_use/start"
headers = {"Authorization": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: '<api-key>'}};
fetch('https://app.miget.com/api/v1/workspace/pay_per_use/start', 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/pay_per_use/start",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.miget.com/api/v1/workspace/pay_per_use/start"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.miget.com/api/v1/workspace/pay_per_use/start")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.miget.com/api/v1/workspace/pay_per_use/start")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
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>"
}
]
}Start Usage Billing
Adds the $5 monthly minimum to the subscription without creating anything, which is what a free-tier application’s workers wait for: free compute covers its web alone, and its workers are held at no replicas with an awaiting_checkout issue until the workspace starts Usage Billing. Once it does, each starts at one replica. A workspace with no subscription to add it to is answered with 422 and a checkout_url a person has to complete. Answers the usage, as GET /workspace/usage does, when it is already on Usage Billing or has just started it. Refused with 422 while Usage Billing is turned off, a payment is overdue, or on an enterprise contract.
curl --request POST \
--url https://app.miget.com/api/v1/workspace/pay_per_use/start \
--header 'Authorization: <api-key>'import requests
url = "https://app.miget.com/api/v1/workspace/pay_per_use/start"
headers = {"Authorization": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: '<api-key>'}};
fetch('https://app.miget.com/api/v1/workspace/pay_per_use/start', 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/pay_per_use/start",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.miget.com/api/v1/workspace/pay_per_use/start"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.miget.com/api/v1/workspace/pay_per_use/start")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.miget.com/api/v1/workspace/pay_per_use/start")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
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
Response
Start Usage Billing
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

