Evaluate preview events
curl --request POST \
--url https://api.withorb.com/v1/prices/evaluate_preview_events \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"timeframe_start": "2023-11-07T05:31:56Z",
"timeframe_end": "2023-11-07T05:31:56Z",
"customer_id": "<string>",
"external_customer_id": "<string>",
"events": [],
"price_evaluations": []
}
'import requests
url = "https://api.withorb.com/v1/prices/evaluate_preview_events"
payload = {
"timeframe_start": "2023-11-07T05:31:56Z",
"timeframe_end": "2023-11-07T05:31:56Z",
"customer_id": "<string>",
"external_customer_id": "<string>",
"events": [],
"price_evaluations": []
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
timeframe_start: '2023-11-07T05:31:56Z',
timeframe_end: '2023-11-07T05:31:56Z',
customer_id: '<string>',
external_customer_id: '<string>',
events: [],
price_evaluations: []
})
};
fetch('https://api.withorb.com/v1/prices/evaluate_preview_events', 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.withorb.com/v1/prices/evaluate_preview_events",
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([
'timeframe_start' => '2023-11-07T05:31:56Z',
'timeframe_end' => '2023-11-07T05:31:56Z',
'customer_id' => '<string>',
'external_customer_id' => '<string>',
'events' => [
],
'price_evaluations' => [
]
]),
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.withorb.com/v1/prices/evaluate_preview_events"
payload := strings.NewReader("{\n \"timeframe_start\": \"2023-11-07T05:31:56Z\",\n \"timeframe_end\": \"2023-11-07T05:31:56Z\",\n \"customer_id\": \"<string>\",\n \"external_customer_id\": \"<string>\",\n \"events\": [],\n \"price_evaluations\": []\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.withorb.com/v1/prices/evaluate_preview_events")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"timeframe_start\": \"2023-11-07T05:31:56Z\",\n \"timeframe_end\": \"2023-11-07T05:31:56Z\",\n \"customer_id\": \"<string>\",\n \"external_customer_id\": \"<string>\",\n \"events\": [],\n \"price_evaluations\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.withorb.com/v1/prices/evaluate_preview_events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"timeframe_start\": \"2023-11-07T05:31:56Z\",\n \"timeframe_end\": \"2023-11-07T05:31:56Z\",\n \"customer_id\": \"<string>\",\n \"external_customer_id\": \"<string>\",\n \"events\": [],\n \"price_evaluations\": []\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"price_groups": [
{
"grouping_values": [
"<string>"
],
"quantity": 123,
"amount": "<string>"
}
],
"currency": "<string>",
"price_id": "<string>",
"external_price_id": "<string>",
"inline_price_index": 123
}
]
}{
"type": "https://docs.withorb.com/reference/error-responses#400-constraint-violation",
"status": 400,
"detail": "<string>",
"title": "<string>"
}{
"type": "https://docs.withorb.com/reference/error-responses#401-authentication-error",
"status": 401,
"detail": "<string>",
"title": "<string>"
}{
"type": "https://docs.withorb.com/reference/error-responses#404-feature-not-available",
"status": 400,
"detail": "<string>",
"title": "<string>"
}{
"type": "https://docs.withorb.com/reference/error-responses#409-resource-conflict",
"status": 409,
"detail": "<string>",
"title": "<string>"
}{
"type": "https://docs.withorb.com/reference/error-responses#413-request-too-large",
"status": 413,
"detail": "<string>",
"title": "<string>"
}{
"type": "https://docs.withorb.com/reference/error-responses#429-too-many-requests",
"status": 429,
"detail": "<string>",
"title": "<string>"
}{
"type": "https://docs.withorb.com/reference/error-responses#500-internal-server-error",
"status": 123,
"detail": "<string>",
"title": "<string>"
}Price
Evaluate preview events
This endpoint evaluates prices on preview events instead of actual usage, making it ideal for building price calculators and cost estimation tools. You can filter and group results using computed properties to analyze pricing across different dimensions.
Prices may either reference existing prices in your Orb account or be defined inline in the request body. The endpoint has the following limitations:
- Up to 100 prices can be evaluated in a single request.
- Up to 500 preview events can be provided in a single request.
A top-level customer_id is required to evaluate the preview events. Additionally, all events without a customer_id will have the top-level customer_id added.
Note that this is a POST endpoint rather than a GET endpoint because it employs a JSON body rather than query parameters.
POST
/
prices
/
evaluate_preview_events
Evaluate preview events
curl --request POST \
--url https://api.withorb.com/v1/prices/evaluate_preview_events \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"timeframe_start": "2023-11-07T05:31:56Z",
"timeframe_end": "2023-11-07T05:31:56Z",
"customer_id": "<string>",
"external_customer_id": "<string>",
"events": [],
"price_evaluations": []
}
'import requests
url = "https://api.withorb.com/v1/prices/evaluate_preview_events"
payload = {
"timeframe_start": "2023-11-07T05:31:56Z",
"timeframe_end": "2023-11-07T05:31:56Z",
"customer_id": "<string>",
"external_customer_id": "<string>",
"events": [],
"price_evaluations": []
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
timeframe_start: '2023-11-07T05:31:56Z',
timeframe_end: '2023-11-07T05:31:56Z',
customer_id: '<string>',
external_customer_id: '<string>',
events: [],
price_evaluations: []
})
};
fetch('https://api.withorb.com/v1/prices/evaluate_preview_events', 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.withorb.com/v1/prices/evaluate_preview_events",
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([
'timeframe_start' => '2023-11-07T05:31:56Z',
'timeframe_end' => '2023-11-07T05:31:56Z',
'customer_id' => '<string>',
'external_customer_id' => '<string>',
'events' => [
],
'price_evaluations' => [
]
]),
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.withorb.com/v1/prices/evaluate_preview_events"
payload := strings.NewReader("{\n \"timeframe_start\": \"2023-11-07T05:31:56Z\",\n \"timeframe_end\": \"2023-11-07T05:31:56Z\",\n \"customer_id\": \"<string>\",\n \"external_customer_id\": \"<string>\",\n \"events\": [],\n \"price_evaluations\": []\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.withorb.com/v1/prices/evaluate_preview_events")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"timeframe_start\": \"2023-11-07T05:31:56Z\",\n \"timeframe_end\": \"2023-11-07T05:31:56Z\",\n \"customer_id\": \"<string>\",\n \"external_customer_id\": \"<string>\",\n \"events\": [],\n \"price_evaluations\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.withorb.com/v1/prices/evaluate_preview_events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"timeframe_start\": \"2023-11-07T05:31:56Z\",\n \"timeframe_end\": \"2023-11-07T05:31:56Z\",\n \"customer_id\": \"<string>\",\n \"external_customer_id\": \"<string>\",\n \"events\": [],\n \"price_evaluations\": []\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"price_groups": [
{
"grouping_values": [
"<string>"
],
"quantity": 123,
"amount": "<string>"
}
],
"currency": "<string>",
"price_id": "<string>",
"external_price_id": "<string>",
"inline_price_index": 123
}
]
}{
"type": "https://docs.withorb.com/reference/error-responses#400-constraint-violation",
"status": 400,
"detail": "<string>",
"title": "<string>"
}{
"type": "https://docs.withorb.com/reference/error-responses#401-authentication-error",
"status": 401,
"detail": "<string>",
"title": "<string>"
}{
"type": "https://docs.withorb.com/reference/error-responses#404-feature-not-available",
"status": 400,
"detail": "<string>",
"title": "<string>"
}{
"type": "https://docs.withorb.com/reference/error-responses#409-resource-conflict",
"status": 409,
"detail": "<string>",
"title": "<string>"
}{
"type": "https://docs.withorb.com/reference/error-responses#413-request-too-large",
"status": 413,
"detail": "<string>",
"title": "<string>"
}{
"type": "https://docs.withorb.com/reference/error-responses#429-too-many-requests",
"status": 429,
"detail": "<string>",
"title": "<string>"
}{
"type": "https://docs.withorb.com/reference/error-responses#500-internal-server-error",
"status": 123,
"detail": "<string>",
"title": "<string>"
}Body
application/json
Was this page helpful?