A Quickstart#

Authentication

#

The Billing API uses OAuth2 client credentials flow. Create an API client in the FRAGMENT dashboard and use the client ID and secret to obtain an access token.

Token endpoint: https://auth.us-west-2.fragment.dev/oauth2/token

API base URL: https://api.us-west-2.fragment.dev

Include the token in requests with the Authorization: Bearer <access_token> header. Tokens expire in 1 hour.

Example: Get access token
curl -X POST "https://auth.us-west-2.fragment.dev/oauth2/token" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -H "Authorization: Basic $(echo -n 'client_id:client_secret' | base64)" \
  -d "grant_type=client_credentials&client_id=client_id"

SDKs

#

FRAGMENT provides official SDKs for the Billing API:

TypeScript / Node.js

Install
npm install @fragment-dev/ts-node

Package: @fragment-dev/ts-node · Source: fragment-dev/fragment-typescript

Python

Install
pip install fragment-py

Package: fragment-py · Source: fragment-dev/fragment-py

Both SDKs handle authentication and provide typed interfaces for all endpoints.

Resources

#