Ingest billable events
curl --request POST \
--url https://ingest.hyperline.co/v1/events/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
[
{
"customer_id": "cus_CrqwefTRWBWRT",
"event_type": "api_call",
"timestamp": "2024-12-20T16:04:11Z",
"record": {
"id": "D32NAA8",
"durationInMs": 32,
"isVerified": true
}
}
]
'import requests
url = "https://ingest.hyperline.co/v1/events/batch"
payload = [
{
"customer_id": "cus_CrqwefTRWBWRT",
"event_type": "api_call",
"timestamp": "2024-12-20T16:04:11Z",
"record": {
"id": "D32NAA8",
"durationInMs": 32,
"isVerified": True
}
}
]
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([
{
customer_id: 'cus_CrqwefTRWBWRT',
event_type: 'api_call',
timestamp: '2024-12-20T16:04:11Z',
record: {id: 'D32NAA8', durationInMs: 32, isVerified: true}
}
])
};
fetch('https://ingest.hyperline.co/v1/events/batch', 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://ingest.hyperline.co/v1/events/batch",
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([
[
'customer_id' => 'cus_CrqwefTRWBWRT',
'event_type' => 'api_call',
'timestamp' => '2024-12-20T16:04:11Z',
'record' => [
'id' => 'D32NAA8',
'durationInMs' => 32,
'isVerified' => true
]
]
]),
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://ingest.hyperline.co/v1/events/batch"
payload := strings.NewReader("[\n {\n \"customer_id\": \"cus_CrqwefTRWBWRT\",\n \"event_type\": \"api_call\",\n \"timestamp\": \"2024-12-20T16:04:11Z\",\n \"record\": {\n \"id\": \"D32NAA8\",\n \"durationInMs\": 32,\n \"isVerified\": true\n }\n }\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://ingest.hyperline.co/v1/events/batch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("[\n {\n \"customer_id\": \"cus_CrqwefTRWBWRT\",\n \"event_type\": \"api_call\",\n \"timestamp\": \"2024-12-20T16:04:11Z\",\n \"record\": {\n \"id\": \"D32NAA8\",\n \"durationInMs\": 32,\n \"isVerified\": true\n }\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://ingest.hyperline.co/v1/events/batch")
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 {\n \"customer_id\": \"cus_CrqwefTRWBWRT\",\n \"event_type\": \"api_call\",\n \"timestamp\": \"2024-12-20T16:04:11Z\",\n \"record\": {\n \"id\": \"D32NAA8\",\n \"durationInMs\": 32,\n \"isVerified\": true\n }\n }\n]"
response = http.request(request)
puts response.read_body{
"events_created": [
{
"customer_id": "cus_CrqwefTRWBWRT",
"event_type": "api_call",
"timestamp": "2024-12-20T16:04:11Z",
"record": {
"id": "D32NAA8",
"durationInMs": 32,
"isVerified": true
}
}
],
"events_failed": [
{
"customer_id": "cus_CrqwefTRWBWRT",
"event_type": "api_call",
"timestamp": "2024-12-20T16:04:11Z",
"record": {
"id": "D32NAA8",
"durationInMs": 32,
"isVerified": true
}
}
]
}{
"statusCode": 503,
"type": "ServiceUnavailable",
"message": "Event ingestion is temporarily overloaded, retry in 30 seconds",
"retryAfterSeconds": 30
}Billable events
Ingest billable events
Ingest several billable events in batch (limited to max 5000 events per request). This endpoint is idempotent, an event with the same id, will be updated if it already exists.
POST
/
v1
/
events
/
batch
Ingest billable events
curl --request POST \
--url https://ingest.hyperline.co/v1/events/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
[
{
"customer_id": "cus_CrqwefTRWBWRT",
"event_type": "api_call",
"timestamp": "2024-12-20T16:04:11Z",
"record": {
"id": "D32NAA8",
"durationInMs": 32,
"isVerified": true
}
}
]
'import requests
url = "https://ingest.hyperline.co/v1/events/batch"
payload = [
{
"customer_id": "cus_CrqwefTRWBWRT",
"event_type": "api_call",
"timestamp": "2024-12-20T16:04:11Z",
"record": {
"id": "D32NAA8",
"durationInMs": 32,
"isVerified": True
}
}
]
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([
{
customer_id: 'cus_CrqwefTRWBWRT',
event_type: 'api_call',
timestamp: '2024-12-20T16:04:11Z',
record: {id: 'D32NAA8', durationInMs: 32, isVerified: true}
}
])
};
fetch('https://ingest.hyperline.co/v1/events/batch', 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://ingest.hyperline.co/v1/events/batch",
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([
[
'customer_id' => 'cus_CrqwefTRWBWRT',
'event_type' => 'api_call',
'timestamp' => '2024-12-20T16:04:11Z',
'record' => [
'id' => 'D32NAA8',
'durationInMs' => 32,
'isVerified' => true
]
]
]),
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://ingest.hyperline.co/v1/events/batch"
payload := strings.NewReader("[\n {\n \"customer_id\": \"cus_CrqwefTRWBWRT\",\n \"event_type\": \"api_call\",\n \"timestamp\": \"2024-12-20T16:04:11Z\",\n \"record\": {\n \"id\": \"D32NAA8\",\n \"durationInMs\": 32,\n \"isVerified\": true\n }\n }\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://ingest.hyperline.co/v1/events/batch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("[\n {\n \"customer_id\": \"cus_CrqwefTRWBWRT\",\n \"event_type\": \"api_call\",\n \"timestamp\": \"2024-12-20T16:04:11Z\",\n \"record\": {\n \"id\": \"D32NAA8\",\n \"durationInMs\": 32,\n \"isVerified\": true\n }\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://ingest.hyperline.co/v1/events/batch")
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 {\n \"customer_id\": \"cus_CrqwefTRWBWRT\",\n \"event_type\": \"api_call\",\n \"timestamp\": \"2024-12-20T16:04:11Z\",\n \"record\": {\n \"id\": \"D32NAA8\",\n \"durationInMs\": 32,\n \"isVerified\": true\n }\n }\n]"
response = http.request(request)
puts response.read_body{
"events_created": [
{
"customer_id": "cus_CrqwefTRWBWRT",
"event_type": "api_call",
"timestamp": "2024-12-20T16:04:11Z",
"record": {
"id": "D32NAA8",
"durationInMs": 32,
"isVerified": true
}
}
],
"events_failed": [
{
"customer_id": "cus_CrqwefTRWBWRT",
"event_type": "api_call",
"timestamp": "2024-12-20T16:04:11Z",
"record": {
"id": "D32NAA8",
"durationInMs": 32,
"isVerified": true
}
}
]
}{
"statusCode": 503,
"type": "ServiceUnavailable",
"message": "Event ingestion is temporarily overloaded, retry in 30 seconds",
"retryAfterSeconds": 30
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Events payload
Required array length:
1 - 5000 elementsHyperline ID or external ID of the existing customer.
Example:
"cus_CrqwefTRWBWRT"
Type corresponding to the event. When creating a dynamic product, this type will be used to map the related events to specific prices.
Minimum string length:
1Example:
"api_call"
Payload of the event containing an ID and any additional metadata.
Show child attributes
Show child attributes
Example:
{
"id": "D32NAA8",
"durationInMs": 32,
"isVerified": true
}
Was this page helpful?
⌘I

