Welcome to the FlexPrice API

The FlexPrice API enables you to programmatically manage pricing, subscriptions, and billing for your SaaS application. This documentation will help you integrate FlexPrice into your application.

Base URL

All API requests should be made to:

https://api.cloud.flexprice.io/v1

Authentication

All API endpoints require authentication using an API Key. These are the keys you get when you create a new API key in the FlexPrice Dashboard.

x-api-key: <your_api_key>

Drop us an email at support@flexprice.io if you need help getting an API key.

Response Format

All API responses follow a consistent JSON format:

{

    "status": "success",

    "data": { ... },

    "message": "Optional status message"

}

Core Resources

Plans

Plans represent your product’s pricing tiers. Each plan can contain multiple prices with different billing models.

Key Endpoints:

  • GET /plans - List all plans
  • GET /plans/{id} - Retrieve a specific plan
  • PUT /plans/{id} - Update a plan
  • DELETE /plans/{id} - Delete a plan

Plan Properties:

  • name - Name of the plan
  • description - Detailed description
  • lookup_key - Unique identifier for the plan
  • invoice_cadence - Billing frequency
  • trial_period - Trial period in days
  • prices - Array of associated prices

Prices

Prices define how you charge for your products/services, supporting various billing models and cadences.

Key Endpoints:

  • GET /prices - List all prices
  • POST /prices - Create a new price
  • GET /prices/{id} - Retrieve a specific price
  • PUT /prices/{id} - Update a price
  • DELETE /prices/{id} - Delete a price

Price Properties:

  • amount - Price amount in main currency units (e.g., dollars)
  • currency - 3-letter ISO currency code (e.g., “usd”)
  • billing_model - Pricing model (FLAT_FEE, PACKAGE, TIERED)
  • billing_cadence - Frequency (RECURRING, ONETIME)
  • billing_period - Period (month, year)
  • billing_period_count - Number of periods
  • display_amount - Formatted amount with currency symbol (e.g., “$12.50”)

Wallets

Wallets manage customer balances and payment methods.

Key Endpoints:

  • POST /wallets - Create a new wallet
  • GET /wallets/{id} - Retrieve wallet details

Users

Manage user accounts and authentication.

Key Endpoints:

  • GET /users/me - Get current user info
  • POST /auth/login - Authenticate user
  • POST /auth/signup - Create new user account

Error Handling

The API uses standard HTTP response codes:

  • 200 - Success
  • 201 - Created
  • 400 - Bad Request
  • 401 - Unauthorized
  • 404 - Not Found
  • 500 - Internal Server Error

Error responses include detailed information:

{

    "status": "error",

    "message": "Error description",

    "code": "ERROR_CODE"

}

Need Help?