Skip to main content
POST
/
events
/
query
List raw events
curl --request POST \
  --url https://us.api.flexprice.io/v1/events/query \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "end_time": "2024-12-09T00:00:00Z",
  "event_id": "<string>",
  "event_name": "<string>",
  "external_customer_id": "<string>",
  "iter_first_key": "<string>",
  "iter_last_key": "<string>",
  "offset": 123,
  "order": "desc",
  "page_size": 123,
  "property_filters": {},
  "sort": "timestamp",
  "source": "<string>",
  "start_time": "2024-11-09T00:00:00Z"
}
'
import requests

url = "https://us.api.flexprice.io/v1/events/query"

payload = {
"end_time": "2024-12-09T00:00:00Z",
"event_id": "<string>",
"event_name": "<string>",
"external_customer_id": "<string>",
"iter_first_key": "<string>",
"iter_last_key": "<string>",
"offset": 123,
"order": "desc",
"page_size": 123,
"property_filters": {},
"sort": "timestamp",
"source": "<string>",
"start_time": "2024-11-09T00:00:00Z"
}
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({
end_time: '2024-12-09T00:00:00Z',
event_id: '<string>',
event_name: '<string>',
external_customer_id: '<string>',
iter_first_key: '<string>',
iter_last_key: '<string>',
offset: 123,
order: 'desc',
page_size: 123,
property_filters: {},
sort: 'timestamp',
source: '<string>',
start_time: '2024-11-09T00:00:00Z'
})
};

fetch('https://us.api.flexprice.io/v1/events/query', 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://us.api.flexprice.io/v1/events/query",
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([
'end_time' => '2024-12-09T00:00:00Z',
'event_id' => '<string>',
'event_name' => '<string>',
'external_customer_id' => '<string>',
'iter_first_key' => '<string>',
'iter_last_key' => '<string>',
'offset' => 123,
'order' => 'desc',
'page_size' => 123,
'property_filters' => [

],
'sort' => 'timestamp',
'source' => '<string>',
'start_time' => '2024-11-09T00:00:00Z'
]),
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://us.api.flexprice.io/v1/events/query"

payload := strings.NewReader("{\n \"end_time\": \"2024-12-09T00:00:00Z\",\n \"event_id\": \"<string>\",\n \"event_name\": \"<string>\",\n \"external_customer_id\": \"<string>\",\n \"iter_first_key\": \"<string>\",\n \"iter_last_key\": \"<string>\",\n \"offset\": 123,\n \"order\": \"desc\",\n \"page_size\": 123,\n \"property_filters\": {},\n \"sort\": \"timestamp\",\n \"source\": \"<string>\",\n \"start_time\": \"2024-11-09T00:00:00Z\"\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://us.api.flexprice.io/v1/events/query")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"end_time\": \"2024-12-09T00:00:00Z\",\n \"event_id\": \"<string>\",\n \"event_name\": \"<string>\",\n \"external_customer_id\": \"<string>\",\n \"iter_first_key\": \"<string>\",\n \"iter_last_key\": \"<string>\",\n \"offset\": 123,\n \"order\": \"desc\",\n \"page_size\": 123,\n \"property_filters\": {},\n \"sort\": \"timestamp\",\n \"source\": \"<string>\",\n \"start_time\": \"2024-11-09T00:00:00Z\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://us.api.flexprice.io/v1/events/query")

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 \"end_time\": \"2024-12-09T00:00:00Z\",\n \"event_id\": \"<string>\",\n \"event_name\": \"<string>\",\n \"external_customer_id\": \"<string>\",\n \"iter_first_key\": \"<string>\",\n \"iter_last_key\": \"<string>\",\n \"offset\": 123,\n \"order\": \"desc\",\n \"page_size\": 123,\n \"property_filters\": {},\n \"sort\": \"timestamp\",\n \"source\": \"<string>\",\n \"start_time\": \"2024-11-09T00:00:00Z\"\n}"

response = http.request(request)
puts response.read_body
{
  "events": [
    {
      "customer_id": "<string>",
      "environment_id": "<string>",
      "event_name": "<string>",
      "external_customer_id": "<string>",
      "id": "<string>",
      "properties": {},
      "source": "<string>",
      "timestamp": "<string>"
    }
  ],
  "has_more": true,
  "iter_first_key": "<string>",
  "iter_last_key": "<string>",
  "offset": 123,
  "total_count": 123
}
{
"http_status_code": 123,
"message": "<string>"
}
{
"http_status_code": 123,
"message": "<string>"
}

Authorizations

x-api-key
string
header
required

Enter your API key in the format x-api-key <api-key>*

Body

application/json

Request body

end_time
string<date-time>

End time of the events to be fetched in ISO 8601 format Defaults to now if not provided

Example:

"2024-12-09T00:00:00Z"

event_id
string

Event ID is the idempotency key for the event

event_name
string

Event name / Unique identifier for the event in your system

external_customer_id
string

Customer ID in your system that was sent with the event

iter_first_key
string

First key to iterate over the events

iter_last_key
string

Last key to iterate over the events

offset
integer

Offset to fetch the events and is set to 0 by default

order
string

Order by condition. Allowed values (case sensitive): asc, desc (default: desc)

Example:

"desc"

page_size
integer

Page size to fetch the events and is set to 50 by default

property_filters
object

Property filters to filter the events by the keys in properties field of the event

sort
string

Sort by the field. Allowed values (case sensitive): timestamp, event_name (default: timestamp)

Example:

"timestamp"

source
string

Source to filter the events by the source

start_time
string<date-time>

Start time of the events to be fetched in ISO 8601 format Defaults to last 7 days from now if not provided

Example:

"2024-11-09T00:00:00Z"

Response

OK

events
object[]
has_more
boolean
iter_first_key
string
iter_last_key
string
offset
integer
total_count
integer