curl --request POST \
--url https://api.tirdad.ai/v1/prices/units \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"base_currency": "<string>",
"code": "<string>",
"conversion_rate": "<string>",
"name": "<string>",
"symbol": "<string>",
"metadata": {}
}
'import requests
url = "https://api.tirdad.ai/v1/prices/units"
payload = {
"base_currency": "<string>",
"code": "<string>",
"conversion_rate": "<string>",
"name": "<string>",
"symbol": "<string>",
"metadata": {}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
base_currency: '<string>',
code: '<string>',
conversion_rate: '<string>',
name: '<string>',
symbol: '<string>',
metadata: {}
})
};
fetch('https://api.tirdad.ai/v1/prices/units', 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.tirdad.ai/v1/prices/units",
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([
'base_currency' => '<string>',
'code' => '<string>',
'conversion_rate' => '<string>',
'name' => '<string>',
'symbol' => '<string>',
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-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.tirdad.ai/v1/prices/units"
payload := strings.NewReader("{\n \"base_currency\": \"<string>\",\n \"code\": \"<string>\",\n \"conversion_rate\": \"<string>\",\n \"name\": \"<string>\",\n \"symbol\": \"<string>\",\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-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.tirdad.ai/v1/prices/units")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"base_currency\": \"<string>\",\n \"code\": \"<string>\",\n \"conversion_rate\": \"<string>\",\n \"name\": \"<string>\",\n \"symbol\": \"<string>\",\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tirdad.ai/v1/prices/units")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"base_currency\": \"<string>\",\n \"code\": \"<string>\",\n \"conversion_rate\": \"<string>\",\n \"name\": \"<string>\",\n \"symbol\": \"<string>\",\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"base_currency": "<string>",
"code": "<string>",
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"name": "<string>",
"symbol": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}{
"details": {},
"http_status_code": 123,
"message": "<string>"
}{
"details": {},
"http_status_code": 123,
"message": "<string>"
}Create price unit
Use when defining a new unit of measure for pricing (e.g. GB, API call, seat). Ideal for metered or usage-based prices.
curl --request POST \
--url https://api.tirdad.ai/v1/prices/units \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"base_currency": "<string>",
"code": "<string>",
"conversion_rate": "<string>",
"name": "<string>",
"symbol": "<string>",
"metadata": {}
}
'import requests
url = "https://api.tirdad.ai/v1/prices/units"
payload = {
"base_currency": "<string>",
"code": "<string>",
"conversion_rate": "<string>",
"name": "<string>",
"symbol": "<string>",
"metadata": {}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
base_currency: '<string>',
code: '<string>',
conversion_rate: '<string>',
name: '<string>',
symbol: '<string>',
metadata: {}
})
};
fetch('https://api.tirdad.ai/v1/prices/units', 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.tirdad.ai/v1/prices/units",
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([
'base_currency' => '<string>',
'code' => '<string>',
'conversion_rate' => '<string>',
'name' => '<string>',
'symbol' => '<string>',
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-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.tirdad.ai/v1/prices/units"
payload := strings.NewReader("{\n \"base_currency\": \"<string>\",\n \"code\": \"<string>\",\n \"conversion_rate\": \"<string>\",\n \"name\": \"<string>\",\n \"symbol\": \"<string>\",\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-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.tirdad.ai/v1/prices/units")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"base_currency\": \"<string>\",\n \"code\": \"<string>\",\n \"conversion_rate\": \"<string>\",\n \"name\": \"<string>\",\n \"symbol\": \"<string>\",\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tirdad.ai/v1/prices/units")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"base_currency\": \"<string>\",\n \"code\": \"<string>\",\n \"conversion_rate\": \"<string>\",\n \"name\": \"<string>\",\n \"symbol\": \"<string>\",\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"base_currency": "<string>",
"code": "<string>",
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"name": "<string>",
"symbol": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}{
"details": {},
"http_status_code": 123,
"message": "<string>"
}{
"details": {},
"http_status_code": 123,
"message": "<string>"
}Authorizations
Enter your API key in the format x-api-key <api-key>*
Body
Price unit details
base_currency is the currency that the price unit is based on
ConversionRate defines the exchange rate from this price unit to the base currency. This rate is used to convert amounts in the custom price unit to the base currency for storage and billing.
Conversion formula: price_unit_amount * conversion_rate = base_currency_amount
Example: If conversion_rate = "0.01" and base_currency = "usd": 100 price_unit tokens * 0.01 = 1.00 USD
Note: Rounding precision is determined by the base currency (e.g., USD uses 2 decimal places, JPY uses 0).
Show child attributes
Show child attributes
Response
Created
Show child attributes
Show child attributes
published, deleted, archived