CPQ.core API
REST API for configuration, pricing and quoting of configurable products. Easily integrate with your e-commerce platform.
Authentication
All API calls (except /health) require authentication via an API Key in the request header.
Get API Key
API Keys are managed in the backoffice under Stores > API Keys. Each key is associated with a tenant and has specific permissions.
X-API-Key: your-api-key-here
Authorization: Bearer your-api-key
Rate Limits
Request limits depend on your plan:
| Plan | Requests/minute | Requests/day |
|---|---|---|
| Free | 60 | 1,000 |
| Pro | 300 | 10,000 |
| Enterprise | Unlimited | Unlimited |
Rate Limit Headers
Each response includes rate limit information:
| Header | Description |
|---|---|
X-RateLimit-Limit |
Maximum request limit |
X-RateLimit-Remaining |
Remaining requests in the period |
X-RateLimit-Reset |
Unix timestamp when the limit resets |
Error Handling
The API uses standard HTTP codes to indicate success or failure of requests.
| Code | Meaning | Recommended Action |
|---|---|---|
200 |
Success | Process response normally |
400 |
Bad Request | Check JSON structure |
401 |
Unauthorized | Check API Key |
403 |
Forbidden | API Key lacks access to tenant |
404 |
Not Found | Check product_id |
422 |
Validation Failed | Show errors to user |
429 |
Rate Limited | Wait and retry |
500 |
Internal Error | Contact support |
Error Format
{
"error": "Missing or invalid API key",
"code": "UNAUTHORIZED"
}
Endpoints
Returns the service health status. No authentication required.
Exemplo
curl -X GET https://cpq.peopleware.pt/api/health
{
"status": "healthy",
"version": "1.9"
}
Returns the form structure for a product configurator, including fields, validations and visibility conditions.
Parametros
| Parametro | Tipo | Obrigatorio | Descricao |
|---|---|---|---|
product_id |
path | Sim | ID do produto (external_id) |
tenant_id |
query | Sim | ID do tenant |
lang |
query | Nao | Codigo de idioma (default: en) |
Exemplo
curl -X GET "https://cpq.peopleware.pt/api/v1/products/janela-aluminio/form?tenant_id=demo&lang=pt-PT" \
-H "X-API-Key: YOUR_API_KEY"
{
"product_id": "janela-aluminio",
"layout": "sections",
"groups": [
{
"id": "dimensoes",
"label": "Dimensoes",
"fields": [
{
"id": "largura",
"type": "number",
"label": "Largura",
"validation": { "min": 400, "max": 2400 },
"unit": "mm"
}
]
}
],
"quantity": {
"min": 1,
"max": 100,
"step": 1
}
}
Codigos de Resposta
Calculates the price and outputs (including production BOM) based on the provided configuration.
output_groups: ["*"] para obter todos os grupos de output,
incluindo dados de producao (BOM).
Body
| Campo | Tipo | Obrigatorio | Descricao |
|---|---|---|---|
tenant_id |
string | Sim | ID do tenant |
product_id |
string | Sim | ID do produto |
configuration |
object | Sim | Valores dos campos do formulario |
quantity |
integer | Nao | Quantidade (default: 1) |
lang |
string | Nao | Codigo de idioma (default: en) |
output_groups |
array | Nao | Grupos de output a incluir (["*"] para todos) |
Exemplo
curl -X POST https://cpq.peopleware.pt/api/v1/calculate \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"tenant_id": "demo",
"product_id": "janela-aluminio",
"configuration": {
"largura": 1200,
"altura": 1000,
"vidro": "temperado",
"cor": "branco"
},
"quantity": 1,
"lang": "pt-PT",
"output_groups": ["*"]
}'
{
"product_id": "janela-aluminio",
"configuration": {
"largura": 1200,
"altura": 1000,
"vidro": "temperado",
"cor": "branco"
},
"result": {
"totals": {
"price": 287.00
},
"groups": {
"production": {
"vidro_m2": 1.20,
"perfil_m": 4.40,
"kit_ferragens": 1,
"parafusos": 20
}
}
},
"quantity": { "min": 1, "max": 100 },
"warnings": [],
"errors": []
}
Codigos de Resposta
Validates a DSL schema without saving it. Useful for checking syntax before saving or testing schemas in development.
Body
| Campo | Tipo | Obrigatorio | Descricao |
|---|---|---|---|
schema |
string | Sim | Schema DSL a validar |
Exemplo
curl -X POST https://cpq.peopleware.pt/api/v1/validate \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"schema": "let base = 100\nadd price: base * 1.23"
}'
{
"valid": true,
"errors": [],
"warnings": []
}
{
"valid": false,
"errors": [
{
"line": 3,
"column": 5,
"message": "undefined variable 'y'"
}
],
"warnings": []
}