cURL
curl --request POST \
--url https://us.api.flexprice.io/v1/events \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"event_name": "api_request",
"external_customer_id": "customer456",
"customer_id": "customer456",
"event_id": "event123",
"properties": {
"\"response_status\"": "200}",
"{\"request_size\"": "100"
},
"source": "api",
"timestamp": "2024-03-20T15:04:05Z"
}
'from flexprice import Flexprice
with Flexprice(
api_key_auth="<YOUR_API_KEY_HERE>",
) as f_client:
res = f_client.events.ingest_event(event_name="api_request", external_customer_id="customer456", customer_id="customer456", event_id="event123", properties={
""response_status"": "200}",
"{"request_size"": "100",
}, source="api", timestamp="2024-03-20T15:04:05Z")
# Handle response
print(res)import { Flexprice } from "@flexprice/sdk";
const flexprice = new Flexprice({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await flexprice.events.ingestEvent({
customerId: "customer456",
eventId: "event123",
eventName: "api_request",
externalCustomerId: "customer456",
properties: {
""response_status"": "200}",
"{"request_size"": "100",
},
source: "api",
timestamp: "2024-03-20T15:04:05Z",
});
console.log(result);
}
run();package main
import(
"context"
flexprice "github.com/flexprice/go-sdk/v2"
"github.com/flexprice/go-sdk/v2/models/types"
"log"
)
func main() {
ctx := context.Background()
s := flexprice.New(
flexprice.WithSecurity("<YOUR_API_KEY_HERE>"),
)
res, err := s.Events.IngestEvent(ctx, types.IngestEventRequest{
CustomerID: flexprice.Pointer("customer456"),
EventID: flexprice.Pointer("event123"),
EventName: "api_request",
ExternalCustomerID: "customer456",
Properties: map[string]string{
""response_status"": "200}",
"{"request_size"": "100",
},
Source: flexprice.Pointer("api"),
Timestamp: flexprice.Pointer("2024-03-20T15:04:05Z"),
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}{}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}Events
Ingest event
Use when sending a single usage event from your app (e.g. one API call or one GB stored). Events are processed asynchronously; returns 202 with event_id.
POST
/
events
cURL
curl --request POST \
--url https://us.api.flexprice.io/v1/events \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"event_name": "api_request",
"external_customer_id": "customer456",
"customer_id": "customer456",
"event_id": "event123",
"properties": {
"\"response_status\"": "200}",
"{\"request_size\"": "100"
},
"source": "api",
"timestamp": "2024-03-20T15:04:05Z"
}
'from flexprice import Flexprice
with Flexprice(
api_key_auth="<YOUR_API_KEY_HERE>",
) as f_client:
res = f_client.events.ingest_event(event_name="api_request", external_customer_id="customer456", customer_id="customer456", event_id="event123", properties={
""response_status"": "200}",
"{"request_size"": "100",
}, source="api", timestamp="2024-03-20T15:04:05Z")
# Handle response
print(res)import { Flexprice } from "@flexprice/sdk";
const flexprice = new Flexprice({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await flexprice.events.ingestEvent({
customerId: "customer456",
eventId: "event123",
eventName: "api_request",
externalCustomerId: "customer456",
properties: {
""response_status"": "200}",
"{"request_size"": "100",
},
source: "api",
timestamp: "2024-03-20T15:04:05Z",
});
console.log(result);
}
run();package main
import(
"context"
flexprice "github.com/flexprice/go-sdk/v2"
"github.com/flexprice/go-sdk/v2/models/types"
"log"
)
func main() {
ctx := context.Background()
s := flexprice.New(
flexprice.WithSecurity("<YOUR_API_KEY_HERE>"),
)
res, err := s.Events.IngestEvent(ctx, types.IngestEventRequest{
CustomerID: flexprice.Pointer("customer456"),
EventID: flexprice.Pointer("event123"),
EventName: "api_request",
ExternalCustomerID: "customer456",
Properties: map[string]string{
""response_status"": "200}",
"{"request_size"": "100",
},
Source: flexprice.Pointer("api"),
Timestamp: flexprice.Pointer("2024-03-20T15:04:05Z"),
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}{}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}Authorizations
Enter your API key in the format x-api-key <api-key>*
Body
application/json
Event data
Example:
"api_request"
Example:
"customer456"
Example:
"customer456"
Example:
"event123"
Handled separately for dynamic columns
Show child attributes
Show child attributes
Example:
{
"\"response_status\"": "200}",
"{\"request_size\"": "100"
}
Example:
"api"
Handled separately due to parsing
Example:
"2024-03-20T15:04:05Z"
Response
message:Event accepted for processing

