Turnstile's API enables you to integrate billing and usage data with your existing systems to automate your Quote-to-Cash workflow. Use the API to ingest usage events for consumption-based pricing and receive webhooks for key lifecycle events like quote acceptance and invoice generation. This guide covers authentication, available endpoints, and payload formats.
Production vs Test Endpoints
All production API endpoints live at
https://api.tryturnstile.com/endpointWe also have test endpoints at
https://api.tryturnstile.com/test/endpointthat merely validate request shape (fields and types).Test endpoints accept any random value as the bearer token.
Authentication
All production API endpoints are authenticated using Bearer tokens. Please contact support for your API token.
"security": [
{
"bearerAuth": []
}
]
Usage Ingestion
Endpoint:
/usage/ingestAccepts:
POSTrequests withapplication/jsonencoding
Payload Body
All of the following fields are required.
customer_aliasturnstile_customer_id(string): The Turnstile customer ID associated with the customer.stripe_customer_id(string): The Stripe customer ID associated with the customer. May be accepted in certain cases. If bothturnstile_customer_idandstripe_customer_idare provided,stripe_customer_idwill be used.
timestamp(string): The timestamp when the event happened. This must be in RFC3339 format (UTC), such as2024-05-29T01:23:45Z.quantity(integer): Number of events. Negatives supported.event_type(string): The kind of event, used to associate the event with a billable metric in your Turnstile catalog. Examples:test_run,page_processed.
Provisioning (beta)
Turnstile can send you webhooks when certain events occur within the system. Please contact support for further details on getting access to this feature.
We support several quote and invoice lifecycle events. The most popular are shown below.
v1.quote.finalized
Occurs when a quote is accepted or signed and becomes a subscription.
Payload:
{
"changeCause": "PHASE_ACTIVE",
"crmCustomerId": "18688415805",
"effectiveEnd": "2025-02-20T22:07:07.427Z",
"effectiveStart": "2025-02-20T22:07:07.427Z",
"newEntitlements": [
{
"productName": "API Calls Processed",
"productUnitName": "api_calls",
"quantity": 100
}
],
"orderFlowType": "TURNSTILE_SIGN",
"publicAccountViewUrl": "https://app.tryturnstile.com/p/abc/def",
"quoteId": "b24fd8f6-4b90-48c1-b5b8-507dce6c3d6d",
"subscriptionUrl": "uri",
"tcv": "$3.14",
"turnstileCustomerId": "ef0a2a9e-1b30-4fe7-b985-5389721580dd",
"turnstileCustomerName": "Pepsi Co",
"turnstileSubscriptionId": "bb03c399-b627-47cb-83ff-3681bea36819",
"type": "QUOTE"
}