Skip to main content
These endpoints are public — no authentication required. Use them from the quote builder SPA or any external integration.
All endpoints in this page are rate limited to 60 requests per minute.

POST /api/quotes/save-draft

Validates and persists a quote with status draft. Use this to save progress before the client finalises their selection. A unique reference number is generated automatically in the format COT-XXXXXX.

Request body

client
object
required
Client contact information.
blocks
object[]
required
Array of selected quote block objects. May be empty for drafts.
summary
object
required
Quote totals.

Response

success
boolean
required
true on success.
reference
string
required
Unique quote reference in the format COT-XXXXXX.
message
string
required
Human-readable confirmation message.

Example

cURL
curl --request POST \
  https://your-domain.com/api/quotes/save-draft \
  --header "Content-Type: application/json" \
  --data '{
    "client": {
      "name": "Ana García",
      "email": "ana@example.com",
      "company": "Acme Corp",
      "phone": "+1 555 0100"
    },
    "blocks": [
      {
        "id": 10,
        "name": "Landing Page",
        "description": "Single-page marketing site",
        "type": "fixed",
        "quantity": 1,
        "hours": 40,
        "base_price": 1500.00,
        "total_price": 1500.00
      }
    ],
    "summary": {
      "subtotal": 1500.00,
      "tax": 285.00,
      "total": 1785.00,
      "hours": 40
    }
  }'
{
  "success": true,
  "reference": "COT-64A3F2B1C9D",
  "message": "Cotización guardada como borrador"
}

POST /api/quotes/submit

Validates, persists, and finalises a quote. Sets status to sent and records sent_at. Generates a PDF and stores it at storage/app/public/quotes/{reference}.pdf. Returns a URL to the stored PDF.
Unlike save-draft, the blocks array must contain at least one item.

Request body

Same structure as POST /api/quotes/save-draft with one additional constraint:
blocks
object[]
required
Must contain at least one block (min:1).

Response

success
boolean
required
true on success.
reference
string
required
Unique quote reference in the format COT-XXXXXX.
pdf_url
string
required
Public URL to the generated PDF file (served from storage/).
message
string
required
Human-readable confirmation message.

Example

cURL
curl --request POST \
  https://your-domain.com/api/quotes/submit \
  --header "Content-Type: application/json" \
  --data '{
    "client": {
      "name": "Ana García",
      "email": "ana@example.com",
      "company": "Acme Corp",
      "phone": "+1 555 0100"
    },
    "blocks": [
      {
        "id": 10,
        "name": "Landing Page",
        "description": "Single-page marketing site",
        "type": "fixed",
        "quantity": 1,
        "hours": 40,
        "base_price": 1500.00,
        "total_price": 1500.00
      }
    ],
    "summary": {
      "subtotal": 1500.00,
      "tax": 285.00,
      "total": 1785.00,
      "hours": 40
    }
  }'
{
  "success": true,
  "reference": "COT-64A3F2B1C9D",
  "pdf_url": "/storage/quotes/COT-64A3F2B1C9D.pdf",
  "message": "Cotización enviada exitosamente"
}

POST /api/quotes/generate-pdf

Generates and streams a PDF for the provided quote data. The quote is not saved to the database. Use this to preview or download a PDF without creating a quote record.

Request body

Same structure as POST /api/quotes/save-draft.

Response

Returns the PDF file as a binary download.
HeaderValue
Content-Typeapplication/pdf
Content-Dispositionattachment; filename="cotizacion.pdf"
This endpoint returns a file, not JSON. Handle the response as a binary blob in your client.

Example

cURL
curl --request POST \
  https://your-domain.com/api/quotes/generate-pdf \
  --header "Content-Type: application/json" \
  --output cotizacion.pdf \
  --data '{
    "client": {
      "name": "Ana García",
      "email": "ana@example.com"
    },
    "blocks": [
      {
        "name": "Landing Page",
        "hours": 40,
        "base_price": 1500.00,
        "total_price": 1500.00
      }
    ],
    "summary": {
      "subtotal": 1500.00,
      "tax": 285.00,
      "total": 1785.00
    }
  }'

GET /api/health

Health check endpoint for monitoring and uptime checks. No authentication required and not subject to the standard rate limits.

Response

status
string
required
Always "healthy" when the application is running.
timestamp
string
required
Current server time in ISO 8601 format.

Example

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

Build docs developers (and LLMs) love