curl --request POST \
--url https://api.salesbricks.com/api/v2/subscriptions/{subscription_id}/milestones/{milestone_id}/complete \
--header 'Content-Type: application/json' \
--header 'X-SALESBRICKS-KEY: <api-key>' \
--data '
{
"quantity": 2,
"issued_at": "2023-12-25",
"due_at": "2023-12-25",
"service_date": "2023-12-25"
}
'import requests
url = "https://api.salesbricks.com/api/v2/subscriptions/{subscription_id}/milestones/{milestone_id}/complete"
payload = {
"quantity": 2,
"issued_at": "2023-12-25",
"due_at": "2023-12-25",
"service_date": "2023-12-25"
}
headers = {
"X-SALESBRICKS-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-SALESBRICKS-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
quantity: 2,
issued_at: '2023-12-25',
due_at: '2023-12-25',
service_date: '2023-12-25'
})
};
fetch('https://api.salesbricks.com/api/v2/subscriptions/{subscription_id}/milestones/{milestone_id}/complete', 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.salesbricks.com/api/v2/subscriptions/{subscription_id}/milestones/{milestone_id}/complete",
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([
'quantity' => 2,
'issued_at' => '2023-12-25',
'due_at' => '2023-12-25',
'service_date' => '2023-12-25'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-SALESBRICKS-KEY: <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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.salesbricks.com/api/v2/subscriptions/{subscription_id}/milestones/{milestone_id}/complete"
payload := strings.NewReader("{\n \"quantity\": 2,\n \"issued_at\": \"2023-12-25\",\n \"due_at\": \"2023-12-25\",\n \"service_date\": \"2023-12-25\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-SALESBRICKS-KEY", "<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.post("https://api.salesbricks.com/api/v2/subscriptions/{subscription_id}/milestones/{milestone_id}/complete")
.header("X-SALESBRICKS-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"quantity\": 2,\n \"issued_at\": \"2023-12-25\",\n \"due_at\": \"2023-12-25\",\n \"service_date\": \"2023-12-25\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.salesbricks.com/api/v2/subscriptions/{subscription_id}/milestones/{milestone_id}/complete")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-SALESBRICKS-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"quantity\": 2,\n \"issued_at\": \"2023-12-25\",\n \"due_at\": \"2023-12-25\",\n \"service_date\": \"2023-12-25\"\n}"
response = http.request(request)
puts response.read_body{
"completion": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 123,
"invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"completed_at": "2023-11-07T05:31:56Z"
},
"milestone": {
"milestone_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"brick_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"brick_name": "<string>",
"order_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"phase_position": 123,
"phase_name": "<string>",
"total_quantity": 123,
"completed_quantity": 123,
"completions": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 123,
"invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"completed_at": "2023-11-07T05:31:56Z"
}
]
}
}{
"error": {
"code": "ERR_BAD_REQUEST",
"message": "Bad request — the input payload is malformed, missing required fields, or contains invalid data.",
"details": {
"fields": {
"quantity": [
"This field is required."
]
}
}
}
}{
"error": {
"code": "ERR_NOT_FOUND",
"message": "Milestone not found — no milestone matches the given `milestone_id` on this subscription."
}
}Complete a subscription milestone
Marks some or all of a milestone complete so that it bills. IMMEDIATELY raises a standalone invoice and issues it now; NEXT_INVOICE adds it to the subscription’s next scheduled invoice.
curl --request POST \
--url https://api.salesbricks.com/api/v2/subscriptions/{subscription_id}/milestones/{milestone_id}/complete \
--header 'Content-Type: application/json' \
--header 'X-SALESBRICKS-KEY: <api-key>' \
--data '
{
"quantity": 2,
"issued_at": "2023-12-25",
"due_at": "2023-12-25",
"service_date": "2023-12-25"
}
'import requests
url = "https://api.salesbricks.com/api/v2/subscriptions/{subscription_id}/milestones/{milestone_id}/complete"
payload = {
"quantity": 2,
"issued_at": "2023-12-25",
"due_at": "2023-12-25",
"service_date": "2023-12-25"
}
headers = {
"X-SALESBRICKS-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-SALESBRICKS-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
quantity: 2,
issued_at: '2023-12-25',
due_at: '2023-12-25',
service_date: '2023-12-25'
})
};
fetch('https://api.salesbricks.com/api/v2/subscriptions/{subscription_id}/milestones/{milestone_id}/complete', 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.salesbricks.com/api/v2/subscriptions/{subscription_id}/milestones/{milestone_id}/complete",
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([
'quantity' => 2,
'issued_at' => '2023-12-25',
'due_at' => '2023-12-25',
'service_date' => '2023-12-25'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-SALESBRICKS-KEY: <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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.salesbricks.com/api/v2/subscriptions/{subscription_id}/milestones/{milestone_id}/complete"
payload := strings.NewReader("{\n \"quantity\": 2,\n \"issued_at\": \"2023-12-25\",\n \"due_at\": \"2023-12-25\",\n \"service_date\": \"2023-12-25\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-SALESBRICKS-KEY", "<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.post("https://api.salesbricks.com/api/v2/subscriptions/{subscription_id}/milestones/{milestone_id}/complete")
.header("X-SALESBRICKS-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"quantity\": 2,\n \"issued_at\": \"2023-12-25\",\n \"due_at\": \"2023-12-25\",\n \"service_date\": \"2023-12-25\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.salesbricks.com/api/v2/subscriptions/{subscription_id}/milestones/{milestone_id}/complete")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-SALESBRICKS-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"quantity\": 2,\n \"issued_at\": \"2023-12-25\",\n \"due_at\": \"2023-12-25\",\n \"service_date\": \"2023-12-25\"\n}"
response = http.request(request)
puts response.read_body{
"completion": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 123,
"invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"completed_at": "2023-11-07T05:31:56Z"
},
"milestone": {
"milestone_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"brick_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"brick_name": "<string>",
"order_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"phase_position": 123,
"phase_name": "<string>",
"total_quantity": 123,
"completed_quantity": 123,
"completions": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 123,
"invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"completed_at": "2023-11-07T05:31:56Z"
}
]
}
}{
"error": {
"code": "ERR_BAD_REQUEST",
"message": "Bad request — the input payload is malformed, missing required fields, or contains invalid data.",
"details": {
"fields": {
"quantity": [
"This field is required."
]
}
}
}
}{
"error": {
"code": "ERR_NOT_FOUND",
"message": "Milestone not found — no milestone matches the given `milestone_id` on this subscription."
}
}Authorizations
API key for authentication
Path Parameters
^([a-zA-Z\d\-]+)$^([a-zA-Z\d\-]+)$Body
Input serializer for completing a milestone.
How much of the milestone to complete. May not take the completed total past the milestone's total_quantity.
x >= 1When the completion bills. IMMEDIATELY raises a standalone invoice for the milestone and issues it now. NEXT_INVOICE adds it to the subscription's next scheduled invoice, and is rejected when there is no invoice left to defer onto.
IMMEDIATELY- ImmediatelyNEXT_INVOICE- Next invoice
IMMEDIATELY, NEXT_INVOICE Issue date for the new invoice. Defaults to today; a future date leaves the invoice to be issued by the scheduled sweep. Only valid with bill_on: IMMEDIATELY.
Due date for the new invoice. Defaults to the order's payment terms, and may not precede issued_at. Only valid when bill_on is IMMEDIATELY.
The date the work was delivered. The new invoice's service period starts and ends on this day — it is a single date, not a range. Defaults to today, and may be backdated independently of issued_at. Only valid when bill_on is IMMEDIATELY.