Skip to main content
This document provides the complete API reference for sending events to Flexprice. It includes all endpoints, request/response formats, error codes, and examples.

Base URL

Authentication

All requests require authentication using an API key in the request header:
Security Note: Keep your API key secure and never expose it in client-side code or public repositories.

Endpoints

Single Event

Send a single event to Flexprice. Endpoint: POST /events Headers:
Request Body:
Response:
  • Status: 202 Accepted
  • Body:

Bulk Events

Send multiple events in a single request for better performance. Endpoint: POST /events/bulk Headers:
Request Body:
Response:
  • Status: 202 Accepted
  • Body:

Request Fields

Required Fields

Conditional Fields

Optional Fields

Data Types

Property Values

  • Numbers: Use for Sum, Max aggregations
  • Strings: Use for Unique Count, Latest aggregations

Timestamps

  • Format: ISO 8601 UTC
  • Example: "2025-08-22T07:05:49.441Z"
  • Default: Server time if omitted

Examples

Basic Event (Count Aggregation)

Event with Properties (Sum Aggregation)

Complete Event

Bulk Events

Language Examples

JavaScript (Node.js)

Python

Go

PHP

Error Responses

HTTP Status Codes

Error Response Format

Common Error Messages

Missing Required Field

Invalid Event Name

Invalid Customer

Invalid JSON

Rate Limit Exceeded

Rate Limits

  • Single events: 1000 requests per minute
  • Bulk events: 100 requests per minute (up to 1000 events per request)
  • Response: 429 status code when exceeded

Rate Limit Headers

When approaching rate limits, responses include headers:

Best Practices

1. Error Handling

Implement proper error handling with retries:

2. Bulk Events for High Volume

Use bulk events when sending many events:

3. Idempotency

Use event_id for idempotency:

4. Timestamps

Include timestamps for historical events:

Validation

Event Name Validation

  • Must match a feature’s Event Name exactly
  • Case-sensitive
  • Cannot be changed after feature creation

Customer Validation

  • external_customer_id must exist in Flexprice
  • Customer must be active

Property Validation

  • Aggregation field must exist for Sum, Max, Latest, Unique Count
  • Data types must match aggregation function requirements

Testing

Test Endpoint

For testing purposes, you can use the same endpoints with test data:

Validation Checklist

Before sending production events:
  • Feature exists and is active
  • Event Name matches exactly
  • Customer exists in Flexprice
  • Required properties are included
  • Data types are correct
  • API key has proper permissions

Support

For API-related issues:
  1. Check error messages for specific details
  2. Verify your request format matches the examples
  3. Test with a simple event first
  4. Contact support with specific error details and examples