Skip to main content
POST
/
prices
/
{price_id}
/
evaluate
Evaluate price
curl --request POST \
  --url https://api.withorb.com/v1/prices/{price_id}/evaluate \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data @- <<EOF
{
  "timeframe_start": "2023-11-07T05:31:56Z",
  "timeframe_end": "2023-11-07T05:31:56Z",
  "customer_id": "<string>",
  "external_customer_id": "<string>",
  "filter": "my_numeric_property > 100 AND my_other_property = 'bar'",
  "grouping_keys": [],
  "metric_parameter_overrides": {}
}
EOF
import requests

url = "https://api.withorb.com/v1/prices/{price_id}/evaluate"

payload = {
    "timeframe_start": "2023-11-07T05:31:56Z",
    "timeframe_end": "2023-11-07T05:31:56Z",
    "customer_id": "<string>",
    "external_customer_id": "<string>",
    "filter": "my_numeric_property > 100 AND my_other_property = 'bar'",
    "grouping_keys": [],
    "metric_parameter_overrides": {}
}
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>',
    filter: 'my_numeric_property > 100 AND my_other_property = \'bar\'',
    grouping_keys: [],
    metric_parameter_overrides: {}
  })
};

fetch('https://api.withorb.com/v1/prices/{price_id}/evaluate', 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/{price_id}/evaluate",
  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>',
    'filter' => 'my_numeric_property > 100 AND my_other_property = \'bar\'',
    'grouping_keys' => [
        
    ],
    'metric_parameter_overrides' => [
        
    ]
  ]),
  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/{price_id}/evaluate"

	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  \"filter\": \"my_numeric_property > 100 AND my_other_property = 'bar'\",\n  \"grouping_keys\": [],\n  \"metric_parameter_overrides\": {}\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/{price_id}/evaluate")
  .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  \"filter\": \"my_numeric_property > 100 AND my_other_property = 'bar'\",\n  \"grouping_keys\": [],\n  \"metric_parameter_overrides\": {}\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.withorb.com/v1/prices/{price_id}/evaluate")

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  \"filter\": \"my_numeric_property > 100 AND my_other_property = 'bar'\",\n  \"grouping_keys\": [],\n  \"metric_parameter_overrides\": {}\n}"

response = http.request(request)
puts response.read_body
{
  "data": [
    {
      "grouping_values": [
        "<string>"
      ],
      "quantity": 123,
      "amount": "<string>"
    }
  ]
}
{
  "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>"
}

Authorizations

Authorization
string
header
required

API Keys can be issued in the Orb's web application.

Path Parameters

price_id
string
required

Body

application/json
timeframe_start
string<date-time>
required

The inclusive lower bound for event timestamps

timeframe_end
string<date-time>
required

The exclusive upper bound for event timestamps

customer_id
string | null

The ID of the customer to which this evaluation is scoped.

external_customer_id
string | null

The external customer ID of the customer to which this evaluation is scoped.

filter
string | null

A boolean computed property used to filter the underlying billable metric

Example:

"my_numeric_property > 100 AND my_other_property = 'bar'"

grouping_keys
string[]

Properties (or computed properties) used to group the underlying billable metric

Examples:
[
  "case when my_event_type = 'foo' then true else false end"
]
[
  "hour_floor_timestamp_millis(timestamp_millis)",
  "my_property"
]
metric_parameter_overrides
Metric Parameter Overrides · object | null

Optional overrides for parameterized billable metric parameters. If the metric has parameter definitions and no overrides are provided, defaults will be used.

Response

OK

data
EvaluatePriceGroup · object[]
required