curl --request POST \
--url https://api.bitgpt.xyz/products \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "ONE_TIME PRODUCT #2",
"description": "ONE_TIME PRODUCT DESCRIPTION #2",
"metadata": {
"id": "elrkghkrebdfhodnbkndksjbngkdnfvkjsdnbkjn",
"email": "test@test.tt",
"custom": "custom field"
},
"schemas": [
{
"name": "Basic Product",
"description": "Basic Product Schema 1234",
"currency": "GBP",
"type": "RECURRING",
"base_price": 104.04,
"interval_type": "MONTH",
"interval_count": 1,
"payment_type": "ARREARS",
"renew_type": "CALENDAR",
"billing_type": "FULL",
"configurations": [
{
"starts_at": 1,
"ends_at": 2,
"price_per_unit": 5,
"metric": {
"id": "metric_01978a62-4297-70fb-8bac-3c43e91e0d30",
"metric_key": "metric_key",
"name": "Metric",
"aggregation_type": "SUM"
}
}
]
}
]
}
'import requests
url = "https://api.bitgpt.xyz/products"
payload = {
"name": "ONE_TIME PRODUCT #2",
"description": "ONE_TIME PRODUCT DESCRIPTION #2",
"metadata": {
"id": "elrkghkrebdfhodnbkndksjbngkdnfvkjsdnbkjn",
"email": "test@test.tt",
"custom": "custom field"
},
"schemas": [
{
"name": "Basic Product",
"description": "Basic Product Schema 1234",
"currency": "GBP",
"type": "RECURRING",
"base_price": 104.04,
"interval_type": "MONTH",
"interval_count": 1,
"payment_type": "ARREARS",
"renew_type": "CALENDAR",
"billing_type": "FULL",
"configurations": [
{
"starts_at": 1,
"ends_at": 2,
"price_per_unit": 5,
"metric": {
"id": "metric_01978a62-4297-70fb-8bac-3c43e91e0d30",
"metric_key": "metric_key",
"name": "Metric",
"aggregation_type": "SUM"
}
}
]
}
]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'ONE_TIME PRODUCT #2',
description: 'ONE_TIME PRODUCT DESCRIPTION #2',
metadata: {
id: 'elrkghkrebdfhodnbkndksjbngkdnfvkjsdnbkjn',
email: 'test@test.tt',
custom: 'custom field'
},
schemas: [
{
name: 'Basic Product',
description: 'Basic Product Schema 1234',
currency: 'GBP',
type: 'RECURRING',
base_price: 104.04,
interval_type: 'MONTH',
interval_count: 1,
payment_type: 'ARREARS',
renew_type: 'CALENDAR',
billing_type: 'FULL',
configurations: [
{
starts_at: 1,
ends_at: 2,
price_per_unit: 5,
metric: {
id: 'metric_01978a62-4297-70fb-8bac-3c43e91e0d30',
metric_key: 'metric_key',
name: 'Metric',
aggregation_type: 'SUM'
}
}
]
}
]
})
};
fetch('https://api.bitgpt.xyz/products', 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.bitgpt.xyz/products",
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([
'name' => 'ONE_TIME PRODUCT #2',
'description' => 'ONE_TIME PRODUCT DESCRIPTION #2',
'metadata' => [
'id' => 'elrkghkrebdfhodnbkndksjbngkdnfvkjsdnbkjn',
'email' => 'test@test.tt',
'custom' => 'custom field'
],
'schemas' => [
[
'name' => 'Basic Product',
'description' => 'Basic Product Schema 1234',
'currency' => 'GBP',
'type' => 'RECURRING',
'base_price' => 104.04,
'interval_type' => 'MONTH',
'interval_count' => 1,
'payment_type' => 'ARREARS',
'renew_type' => 'CALENDAR',
'billing_type' => 'FULL',
'configurations' => [
[
'starts_at' => 1,
'ends_at' => 2,
'price_per_unit' => 5,
'metric' => [
'id' => 'metric_01978a62-4297-70fb-8bac-3c43e91e0d30',
'metric_key' => 'metric_key',
'name' => 'Metric',
'aggregation_type' => 'SUM'
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.bitgpt.xyz/products"
payload := strings.NewReader("{\n \"name\": \"ONE_TIME PRODUCT #2\",\n \"description\": \"ONE_TIME PRODUCT DESCRIPTION #2\",\n \"metadata\": {\n \"id\": \"elrkghkrebdfhodnbkndksjbngkdnfvkjsdnbkjn\",\n \"email\": \"test@test.tt\",\n \"custom\": \"custom field\"\n },\n \"schemas\": [\n {\n \"name\": \"Basic Product\",\n \"description\": \"Basic Product Schema 1234\",\n \"currency\": \"GBP\",\n \"type\": \"RECURRING\",\n \"base_price\": 104.04,\n \"interval_type\": \"MONTH\",\n \"interval_count\": 1,\n \"payment_type\": \"ARREARS\",\n \"renew_type\": \"CALENDAR\",\n \"billing_type\": \"FULL\",\n \"configurations\": [\n {\n \"starts_at\": 1,\n \"ends_at\": 2,\n \"price_per_unit\": 5,\n \"metric\": {\n \"id\": \"metric_01978a62-4297-70fb-8bac-3c43e91e0d30\",\n \"metric_key\": \"metric_key\",\n \"name\": \"Metric\",\n \"aggregation_type\": \"SUM\"\n }\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<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.bitgpt.xyz/products")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"ONE_TIME PRODUCT #2\",\n \"description\": \"ONE_TIME PRODUCT DESCRIPTION #2\",\n \"metadata\": {\n \"id\": \"elrkghkrebdfhodnbkndksjbngkdnfvkjsdnbkjn\",\n \"email\": \"test@test.tt\",\n \"custom\": \"custom field\"\n },\n \"schemas\": [\n {\n \"name\": \"Basic Product\",\n \"description\": \"Basic Product Schema 1234\",\n \"currency\": \"GBP\",\n \"type\": \"RECURRING\",\n \"base_price\": 104.04,\n \"interval_type\": \"MONTH\",\n \"interval_count\": 1,\n \"payment_type\": \"ARREARS\",\n \"renew_type\": \"CALENDAR\",\n \"billing_type\": \"FULL\",\n \"configurations\": [\n {\n \"starts_at\": 1,\n \"ends_at\": 2,\n \"price_per_unit\": 5,\n \"metric\": {\n \"id\": \"metric_01978a62-4297-70fb-8bac-3c43e91e0d30\",\n \"metric_key\": \"metric_key\",\n \"name\": \"Metric\",\n \"aggregation_type\": \"SUM\"\n }\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bitgpt.xyz/products")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"ONE_TIME PRODUCT #2\",\n \"description\": \"ONE_TIME PRODUCT DESCRIPTION #2\",\n \"metadata\": {\n \"id\": \"elrkghkrebdfhodnbkndksjbngkdnfvkjsdnbkjn\",\n \"email\": \"test@test.tt\",\n \"custom\": \"custom field\"\n },\n \"schemas\": [\n {\n \"name\": \"Basic Product\",\n \"description\": \"Basic Product Schema 1234\",\n \"currency\": \"GBP\",\n \"type\": \"RECURRING\",\n \"base_price\": 104.04,\n \"interval_type\": \"MONTH\",\n \"interval_count\": 1,\n \"payment_type\": \"ARREARS\",\n \"renew_type\": \"CALENDAR\",\n \"billing_type\": \"FULL\",\n \"configurations\": [\n {\n \"starts_at\": 1,\n \"ends_at\": 2,\n \"price_per_unit\": 5,\n \"metric\": {\n \"id\": \"metric_01978a62-4297-70fb-8bac-3c43e91e0d30\",\n \"metric_key\": \"metric_key\",\n \"name\": \"Metric\",\n \"aggregation_type\": \"SUM\"\n }\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"status": 200,
"data": {
"id": "product_0197ebcc-b7f9-79b6-8a92-569ea231fc4d"
},
"error": null,
"log": null,
"validator": null,
"support_id": null,
"message": "Resource created successfully",
"env": "development"
}{
"error": "<string>",
"message": null,
"log": "<string>",
"validator": {},
"support_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"data": {}
}{
"status": 401,
"error": "<string>",
"message": null,
"log": "<string>",
"validator": {},
"support_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"data": {}
}{
"status": 403,
"error": "<string>",
"message": null,
"log": "<string>",
"validator": {},
"support_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"data": {}
}Create a new product
Create a new product with billing schemas for the authenticated organization
curl --request POST \
--url https://api.bitgpt.xyz/products \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "ONE_TIME PRODUCT #2",
"description": "ONE_TIME PRODUCT DESCRIPTION #2",
"metadata": {
"id": "elrkghkrebdfhodnbkndksjbngkdnfvkjsdnbkjn",
"email": "test@test.tt",
"custom": "custom field"
},
"schemas": [
{
"name": "Basic Product",
"description": "Basic Product Schema 1234",
"currency": "GBP",
"type": "RECURRING",
"base_price": 104.04,
"interval_type": "MONTH",
"interval_count": 1,
"payment_type": "ARREARS",
"renew_type": "CALENDAR",
"billing_type": "FULL",
"configurations": [
{
"starts_at": 1,
"ends_at": 2,
"price_per_unit": 5,
"metric": {
"id": "metric_01978a62-4297-70fb-8bac-3c43e91e0d30",
"metric_key": "metric_key",
"name": "Metric",
"aggregation_type": "SUM"
}
}
]
}
]
}
'import requests
url = "https://api.bitgpt.xyz/products"
payload = {
"name": "ONE_TIME PRODUCT #2",
"description": "ONE_TIME PRODUCT DESCRIPTION #2",
"metadata": {
"id": "elrkghkrebdfhodnbkndksjbngkdnfvkjsdnbkjn",
"email": "test@test.tt",
"custom": "custom field"
},
"schemas": [
{
"name": "Basic Product",
"description": "Basic Product Schema 1234",
"currency": "GBP",
"type": "RECURRING",
"base_price": 104.04,
"interval_type": "MONTH",
"interval_count": 1,
"payment_type": "ARREARS",
"renew_type": "CALENDAR",
"billing_type": "FULL",
"configurations": [
{
"starts_at": 1,
"ends_at": 2,
"price_per_unit": 5,
"metric": {
"id": "metric_01978a62-4297-70fb-8bac-3c43e91e0d30",
"metric_key": "metric_key",
"name": "Metric",
"aggregation_type": "SUM"
}
}
]
}
]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'ONE_TIME PRODUCT #2',
description: 'ONE_TIME PRODUCT DESCRIPTION #2',
metadata: {
id: 'elrkghkrebdfhodnbkndksjbngkdnfvkjsdnbkjn',
email: 'test@test.tt',
custom: 'custom field'
},
schemas: [
{
name: 'Basic Product',
description: 'Basic Product Schema 1234',
currency: 'GBP',
type: 'RECURRING',
base_price: 104.04,
interval_type: 'MONTH',
interval_count: 1,
payment_type: 'ARREARS',
renew_type: 'CALENDAR',
billing_type: 'FULL',
configurations: [
{
starts_at: 1,
ends_at: 2,
price_per_unit: 5,
metric: {
id: 'metric_01978a62-4297-70fb-8bac-3c43e91e0d30',
metric_key: 'metric_key',
name: 'Metric',
aggregation_type: 'SUM'
}
}
]
}
]
})
};
fetch('https://api.bitgpt.xyz/products', 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.bitgpt.xyz/products",
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([
'name' => 'ONE_TIME PRODUCT #2',
'description' => 'ONE_TIME PRODUCT DESCRIPTION #2',
'metadata' => [
'id' => 'elrkghkrebdfhodnbkndksjbngkdnfvkjsdnbkjn',
'email' => 'test@test.tt',
'custom' => 'custom field'
],
'schemas' => [
[
'name' => 'Basic Product',
'description' => 'Basic Product Schema 1234',
'currency' => 'GBP',
'type' => 'RECURRING',
'base_price' => 104.04,
'interval_type' => 'MONTH',
'interval_count' => 1,
'payment_type' => 'ARREARS',
'renew_type' => 'CALENDAR',
'billing_type' => 'FULL',
'configurations' => [
[
'starts_at' => 1,
'ends_at' => 2,
'price_per_unit' => 5,
'metric' => [
'id' => 'metric_01978a62-4297-70fb-8bac-3c43e91e0d30',
'metric_key' => 'metric_key',
'name' => 'Metric',
'aggregation_type' => 'SUM'
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.bitgpt.xyz/products"
payload := strings.NewReader("{\n \"name\": \"ONE_TIME PRODUCT #2\",\n \"description\": \"ONE_TIME PRODUCT DESCRIPTION #2\",\n \"metadata\": {\n \"id\": \"elrkghkrebdfhodnbkndksjbngkdnfvkjsdnbkjn\",\n \"email\": \"test@test.tt\",\n \"custom\": \"custom field\"\n },\n \"schemas\": [\n {\n \"name\": \"Basic Product\",\n \"description\": \"Basic Product Schema 1234\",\n \"currency\": \"GBP\",\n \"type\": \"RECURRING\",\n \"base_price\": 104.04,\n \"interval_type\": \"MONTH\",\n \"interval_count\": 1,\n \"payment_type\": \"ARREARS\",\n \"renew_type\": \"CALENDAR\",\n \"billing_type\": \"FULL\",\n \"configurations\": [\n {\n \"starts_at\": 1,\n \"ends_at\": 2,\n \"price_per_unit\": 5,\n \"metric\": {\n \"id\": \"metric_01978a62-4297-70fb-8bac-3c43e91e0d30\",\n \"metric_key\": \"metric_key\",\n \"name\": \"Metric\",\n \"aggregation_type\": \"SUM\"\n }\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<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.bitgpt.xyz/products")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"ONE_TIME PRODUCT #2\",\n \"description\": \"ONE_TIME PRODUCT DESCRIPTION #2\",\n \"metadata\": {\n \"id\": \"elrkghkrebdfhodnbkndksjbngkdnfvkjsdnbkjn\",\n \"email\": \"test@test.tt\",\n \"custom\": \"custom field\"\n },\n \"schemas\": [\n {\n \"name\": \"Basic Product\",\n \"description\": \"Basic Product Schema 1234\",\n \"currency\": \"GBP\",\n \"type\": \"RECURRING\",\n \"base_price\": 104.04,\n \"interval_type\": \"MONTH\",\n \"interval_count\": 1,\n \"payment_type\": \"ARREARS\",\n \"renew_type\": \"CALENDAR\",\n \"billing_type\": \"FULL\",\n \"configurations\": [\n {\n \"starts_at\": 1,\n \"ends_at\": 2,\n \"price_per_unit\": 5,\n \"metric\": {\n \"id\": \"metric_01978a62-4297-70fb-8bac-3c43e91e0d30\",\n \"metric_key\": \"metric_key\",\n \"name\": \"Metric\",\n \"aggregation_type\": \"SUM\"\n }\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bitgpt.xyz/products")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"ONE_TIME PRODUCT #2\",\n \"description\": \"ONE_TIME PRODUCT DESCRIPTION #2\",\n \"metadata\": {\n \"id\": \"elrkghkrebdfhodnbkndksjbngkdnfvkjsdnbkjn\",\n \"email\": \"test@test.tt\",\n \"custom\": \"custom field\"\n },\n \"schemas\": [\n {\n \"name\": \"Basic Product\",\n \"description\": \"Basic Product Schema 1234\",\n \"currency\": \"GBP\",\n \"type\": \"RECURRING\",\n \"base_price\": 104.04,\n \"interval_type\": \"MONTH\",\n \"interval_count\": 1,\n \"payment_type\": \"ARREARS\",\n \"renew_type\": \"CALENDAR\",\n \"billing_type\": \"FULL\",\n \"configurations\": [\n {\n \"starts_at\": 1,\n \"ends_at\": 2,\n \"price_per_unit\": 5,\n \"metric\": {\n \"id\": \"metric_01978a62-4297-70fb-8bac-3c43e91e0d30\",\n \"metric_key\": \"metric_key\",\n \"name\": \"Metric\",\n \"aggregation_type\": \"SUM\"\n }\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"status": 200,
"data": {
"id": "product_0197ebcc-b7f9-79b6-8a92-569ea231fc4d"
},
"error": null,
"log": null,
"validator": null,
"support_id": null,
"message": "Resource created successfully",
"env": "development"
}{
"error": "<string>",
"message": null,
"log": "<string>",
"validator": {},
"support_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"data": {}
}{
"status": 401,
"error": "<string>",
"message": null,
"log": "<string>",
"validator": {},
"support_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"data": {}
}{
"status": 403,
"error": "<string>",
"message": null,
"log": "<string>",
"validator": {},
"support_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"data": {}
}Authorizations
Send your access token as header Authorization: Bearer {accessToken}
Your API key that starts with sk_live or sk_test. You can create yours at go.bitgpt.xyz/api-keys.
Body
Response
Product created successfully
Response for successful product creation
Status code of the response
200, 201, 202 Response data containing the requested object
Show child attributes
Show child attributes
Message of the response, human readable
"Resource created successfully"
API environment
development, production Error message of the response, human readable
"Invalid email address"
Useful informaiton, not always present, to debug the response
{ "request_id": "req_1234567890" }
"Some pertinent log message"
Validator response object, each key is the field name and value is the error message
{
"email": "Invalid email address",
"password": "Password is required"
}
Support ID linked to the response, used to identify it when talking with our team
"support_uuidv7-something-else"

