API Documentation
Integrate Grula's powerful pricing engine into your applications with our comprehensive REST API. Calculate prices, manage pricing policies, and configure dynamic adjustments programmatically.
Quick Start
Get started with the Grula API in minutes. All you need is an API token to begin making requests.
Authentication
All API requests require authentication using a Bearer token. You can generate your API token from the Grula dashboard.
Authorization: Bearer YOUR_API_TOKEN
Base URL
https://api.grula.net
Key Concepts
Pricing Policies (Price Lists)
Pricing policies define your base prices for products or services. Think of them as your price lists that contain the fundamental pricing rules for your business.
Price Adjustment Policies (Discounts & Fees)
Price adjustment policies modify your base prices by applying discounts, fees, or other adjustments based on specific conditions like customer type, volume, or seasonal factors.
Get PricePOST
Calculate a single price based on price drivers, currency, and optional pricing date. This is the core endpoint for real-time pricing calculations.
Endpoint
POST /api/v1/price
curl -X POST "https://api.grula.net/api/v1/price" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"environmentId": "123e4567-e89b-12d3-a456-426614174000",
"priceDrivers": [
{
"name": "product",
"value": "laptop"
},
{
"name": "customer_tier",
"value": "premium"
}
],
"currencyThreeLetterCode": "USD",
"pricingDate": "2024-01-15T10:00:00Z"
}'
Get Multiple PricesPOST
Calculate multiple prices in a single request. Efficient for bulk pricing operations with a maximum of 100 price requests per call.
Endpoint
POST /api/v1/prices
curl -X POST "https://api.grula.net/api/v1/prices" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"environmentId": "123e4567-e89b-12d3-a456-426614174000",
"priceRequests": [
{
"priceDrivers": [
{"name": "product", "value": "laptop"},
{"name": "customer_tier", "value": "premium"}
],
"currencyThreeLetterCode": "USD",
"pricingDate": "2024-01-15T10:00:00Z"
},
{
"priceDrivers": [
{"name": "product", "value": "desktop"},
{"name": "customer_tier", "value": "standard"}
],
"currencyThreeLetterCode": "EUR",
"pricingDate": "2024-01-15T10:00:00Z"
}
]
}'
Response Examples
Understanding the structure of API responses helps you integrate pricing data effectively into your applications.
Price Response
{
"amount": {
"amount": 1299.99,
"currencyThreeLetterCode": "USD"
},
"priceComponents": [
{
"pricingPolicyId": "123e4567-e89b-12d3-a456-426614174000",
"amount": {
"amount": 1499.99,
"currencyThreeLetterCode": "USD"
}
},
{
"priceAdjustmentPolicyId": "456e7890-e89b-12d3-a456-426614174001",
"amount": {
"amount": -200.00,
"currencyThreeLetterCode": "USD"
},
"priceAdjustmentPolicyActionName": "Premium Customer Discount",
"priceAdjustmentPolicyValue": 0.15
}
]
}
Error Handling
The API uses standard HTTP status codes to indicate the success or failure of requests. Here are the most common status codes you'll encounter.