Events
Ingest Events
Core API
- Checkout
- Checkout Links
- Custom Checkout Fields
- Customers
- Subscriptions
- Orders
- Discounts
- Refunds
- Products
- Events
- Meters
- Benefits
- Customer Meters
- License Keys
- Files
- Organizations
- Metrics
Customer Portal API
- GETGet Customer
- GETGet Organization
- Sessions
- Subscriptions
- Orders
- License Keys
- File Downloads
Webhook Events
- Customer Events
- Billing Events
- Organization Events
OAuth 2.0 API
- Connect
- Clients
Events
Ingest Events
Ingest batch of events.
Scopes: events:write
POST
/
v1
/
events
/
ingest
package main
import(
"context"
"os"
polargo "github.com/polarsource/polar-go"
"github.com/polarsource/polar-go/models/components"
"log"
)
func main() {
ctx := context.Background()
s := polargo.New(
polargo.WithSecurity(os.Getenv("POLAR_ACCESS_TOKEN")),
)
res, err := s.Events.Ingest(ctx, components.EventsIngest{
Events: []components.Events{
components.CreateEventsEventCreateCustomer(
components.EventCreateCustomer{
Name: "<value>",
OrganizationID: polargo.String("1dbfc517-0bbf-4301-9ba8-555ca42b9737"),
CustomerID: "<value>",
},
),
components.CreateEventsEventCreateExternalCustomer(
components.EventCreateExternalCustomer{
Name: "<value>",
OrganizationID: polargo.String("1dbfc517-0bbf-4301-9ba8-555ca42b9737"),
ExternalCustomerID: "<id>",
},
),
},
})
if err != nil {
log.Fatal(err)
}
if res.EventsIngestResponse != nil {
// handle response
}
}
{
"inserted": 123
}
Authorizations
You can generate an Organization Access Token from your organization's settings.
Body
application/json
List of events to ingest.
The name of the event.
ID of the customer in your Polar organization associated with the event.
Key-value object allowing you to store additional information.
The key must be a string with a maximum length of 40 characters. The value must be either:
- A string with a maximum length of 500 characters
- An integer
- A floating-point number
- A boolean
You can store up to 50 key-value pairs.
Required string length:
1 - 500
The timestamp of the event.
The ID of the organization owning the event. Required unless you use an organization token.
Example:
"1dbfc517-0bbf-4301-9ba8-555ca42b9737"
Response
200
application/json
Successful Response
Number of events inserted.
Was this page helpful?
package main
import(
"context"
"os"
polargo "github.com/polarsource/polar-go"
"github.com/polarsource/polar-go/models/components"
"log"
)
func main() {
ctx := context.Background()
s := polargo.New(
polargo.WithSecurity(os.Getenv("POLAR_ACCESS_TOKEN")),
)
res, err := s.Events.Ingest(ctx, components.EventsIngest{
Events: []components.Events{
components.CreateEventsEventCreateCustomer(
components.EventCreateCustomer{
Name: "<value>",
OrganizationID: polargo.String("1dbfc517-0bbf-4301-9ba8-555ca42b9737"),
CustomerID: "<value>",
},
),
components.CreateEventsEventCreateExternalCustomer(
components.EventCreateExternalCustomer{
Name: "<value>",
OrganizationID: polargo.String("1dbfc517-0bbf-4301-9ba8-555ca42b9737"),
ExternalCustomerID: "<id>",
},
),
},
})
if err != nil {
log.Fatal(err)
}
if res.EventsIngestResponse != nil {
// handle response
}
}
{
"inserted": 123
}