Skip to main content

Base URL

All API requests are made to:
https://your-domain.com
All responses are JSON with a top-level success boolean field unless otherwise noted (e.g., PDF downloads).

API groups

The platform exposes two API groups with different authentication requirements and rate limits.

Public API

No authentication required. Rate limited to 60 requests per minute. These endpoints power the public quote builder SPA and allow anonymous users to browse service blocks and submit quotes.
MethodPathDescription
GET/api/quote-blocksAll active categories and their blocks
GET/api/quote-blocks/category/{categoryId}Blocks for a specific category
POST/api/quote-blocks/calculateCalculate price for a block configuration
POST/api/quotes/save-draftSave a quote as a draft
POST/api/quotes/submitSubmit a quote and generate a PDF
POST/api/quotes/generate-pdfGenerate and download a PDF for arbitrary quote data
GET/api/healthHealth check

Protected API

Requires authentication via Laravel Sanctum. Rate limited to 30 requests per minute. These endpoints are intended for admin dashboards and integrations.
MethodPathDescription
GET/api/v1/quotes/statisticsAggregate quote statistics
GET/api/v1/quotes/recentRecent quotes with items
POST/api/v1/quotes/{id}/duplicateDuplicate an existing quote
GET/api/v1/quotes/exportExport quotes to CSV
GET/api/v1/admin/quote-blocksList all quote blocks (admin)
POST/api/v1/admin/quote-blocksCreate a quote block (admin)
GET/api/v1/admin/quote-blocks/{id}Get a single quote block (admin)
PUT/api/v1/admin/quote-blocks/{id}Update a quote block (admin)
DELETE/api/v1/admin/quote-blocks/{id}Delete a quote block (admin)
POST/api/v1/admin/quote-blocks/reorderReorder quote blocks (admin)

Authentication

The protected API uses Laravel Sanctum and supports two authentication strategies.

Bearer token

Include a Sanctum personal access token in the Authorization header:
curl https://your-domain.com/api/v1/quotes/statistics \
  --header "Authorization: Bearer YOUR_TOKEN"
For browser-based SPAs on the same domain, use cookie authentication. First, fetch the CSRF cookie, then include the X-XSRF-TOKEN header on subsequent requests.
1

Fetch the CSRF cookie

curl --cookie-jar cookies.txt \
  https://your-domain.com/sanctum/csrf-cookie
2

Authenticate

Log in via the standard web auth flow. The session cookie is set automatically.
3

Make authenticated API requests

Include the X-XSRF-TOKEN header extracted from the cookie jar on all subsequent requests.
The CSRF setup endpoint is GET /sanctum/csrf-cookie. It sets an XSRF-TOKEN cookie that must be reflected as an X-XSRF-TOKEN request header.

Rate limiting

API groupLimit
Public API60 requests / minute
Protected API30 requests / minute
When a limit is exceeded the server returns 429 Too Many Requests.

Response format

All JSON responses include a success field:
{
  "success": true,
  "...": "..."
}
Validation errors return HTTP 422 with an errors object:
{
  "success": false,
  "errors": {
    "client.email": ["The client.email field is required."]
  }
}
Server errors return HTTP 500:
{
  "success": false,
  "message": "Error al procesar la cotización. Por favor, intenta nuevamente."
}

Health check

curl https://your-domain.com/api/health
{
  "status": "healthy",
  "timestamp": "2024-01-15T10:30:00.000000Z"
}

Build docs developers (and LLMs) love