---
title: "Quotes & Documents"
section: "CRM & Sales"
order: 123
excerpt: "Generate, send, and electronically sign commercial documents including quotes, proformas, and contracts."
---

Base URL: `/api/v1/quotes`

**Auth required:** Yes (`auth:api`) for all endpoints.

Quotes are commercial documents generated from customer files. Three document types are supported: `quote`, `proforma`, `contract`.

---

## GET /v1/quotes

Check if a customer file has quote documents, and list available types.

**Query parameters:**

| Parameter | Type | Required | Description |
|---|---|---|---|
| `customer_file_id` | integer | Yes | Customer file ID |

**Response 200:**
```json
{
  "has_quotes": true,
  "types": ["quote", "proforma", "contract"]
}
```

**Examples:**

```bash
curl -X GET "https://your-instance.bluerocktel.net/api/v1/quotes?customer_file_id=10" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Accept: application/json"
```

```python
import requests

response = requests.get(
    "https://your-instance.bluerocktel.net/api/v1/quotes",
    params={"customer_file_id": 10},
    headers={"Authorization": "Bearer YOUR_API_TOKEN"}
)
quotes_info = response.json()
```

```php
$response = Http::withToken('YOUR_API_TOKEN')
    ->get('https://your-instance.bluerocktel.net/api/v1/quotes', [
        'customer_file_id' => 10,
    ]);

$quotesInfo = $response->json();
```

```javascript
const response = await fetch(
  "https://your-instance.bluerocktel.net/api/v1/quotes?customer_file_id=10",
  {
    headers: {
      "Authorization": "Bearer YOUR_API_TOKEN",
      "Accept": "application/json"
    }
  }
);
const quotesInfo = await response.json();
```

---

## GET /v1/quotes/generate

Generate quote documents for a customer file. Runs the `generate_quote_documents` action.

**Query parameters:**

| Parameter | Type | Required | Description |
|---|---|---|---|
| `customer_file_id` | integer | Yes | Customer file ID |

**Response 201:**
```json
{
  "types": ["quote", "proforma", "contract"]
}
```
**Response 422/500:** Error during generation.

**Examples:**

```bash
curl -X GET "https://your-instance.bluerocktel.net/api/v1/quotes/generate?customer_file_id=10" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Accept: application/json"
```

```python
import requests

response = requests.get(
    "https://your-instance.bluerocktel.net/api/v1/quotes/generate",
    params={"customer_file_id": 10},
    headers={"Authorization": "Bearer YOUR_API_TOKEN"}
)
generated = response.json()
```

```php
$response = Http::withToken('YOUR_API_TOKEN')
    ->get('https://your-instance.bluerocktel.net/api/v1/quotes/generate', [
        'customer_file_id' => 10,
    ]);

$generated = $response->json();
```

```javascript
const response = await fetch(
  "https://your-instance.bluerocktel.net/api/v1/quotes/generate?customer_file_id=10",
  {
    headers: {
      "Authorization": "Bearer YOUR_API_TOKEN",
      "Accept": "application/json"
    }
  }
);
const generated = await response.json();
```

---

## GET /v1/quotes/show

Show (download) a specific quote document as a PDF.

**Query parameters:**

| Parameter | Type | Required | Description |
|---|---|---|---|
| `customer_file_id` | integer | Yes | Customer file ID |
| `type` | string | Yes | Document type: `quote`, `proforma`, or `contract` |

**Response 200:** PDF file (`Content-Type: application/pdf`).
**Response 404:** Document not found (no quotes generated).

**Examples:**

```bash
curl -X GET "https://your-instance.bluerocktel.net/api/v1/quotes/show?customer_file_id=10&type=quote" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -o quote.pdf
```

```python
import requests

response = requests.get(
    "https://your-instance.bluerocktel.net/api/v1/quotes/show",
    params={"customer_file_id": 10, "type": "quote"},
    headers={"Authorization": "Bearer YOUR_API_TOKEN"}
)
with open("quote.pdf", "wb") as f:
    f.write(response.content)
```

```php
$response = Http::withToken('YOUR_API_TOKEN')
    ->get('https://your-instance.bluerocktel.net/api/v1/quotes/show', [
        'customer_file_id' => 10,
        'type' => 'quote',
    ]);

Storage::put('quote.pdf', $response->body());
```

```javascript
const response = await fetch(
  "https://your-instance.bluerocktel.net/api/v1/quotes/show?customer_file_id=10&type=quote",
  {
    headers: {
      "Authorization": "Bearer YOUR_API_TOKEN"
    }
  }
);
const blob = await response.blob();
```

---

## POST /v1/quotes/send

Send a quote document by email to a recipient.

**Body (JSON):**

| Field | Type | Required | Description |
|---|---|---|---|
| `customer_file_id` | integer | Yes | Customer file ID |
| `email` | string | Yes | Recipient email address |
| `type` | string | Yes | Document type: `quote`, `proforma`, or `contract` |

**Response 200:** `{ "message": "success" }`
**Response 400:** Quotes not yet generated.
**Response 500:** Mail sending error.

**Examples:**

```bash
curl -X POST "https://your-instance.bluerocktel.net/api/v1/quotes/send" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"customer_file_id": 10, "email": "client@example.com", "type": "quote"}'
```

```python
import requests

response = requests.post(
    "https://your-instance.bluerocktel.net/api/v1/quotes/send",
    json={
        "customer_file_id": 10,
        "email": "client@example.com",
        "type": "quote"
    },
    headers={"Authorization": "Bearer YOUR_API_TOKEN"}
)
result = response.json()
```

```php
$response = Http::withToken('YOUR_API_TOKEN')
    ->post('https://your-instance.bluerocktel.net/api/v1/quotes/send', [
        'customer_file_id' => 10,
        'email' => 'client@example.com',
        'type' => 'quote',
    ]);

$result = $response->json();
```

```javascript
const response = await fetch(
  "https://your-instance.bluerocktel.net/api/v1/quotes/send",
  {
    method: "POST",
    headers: {
      "Authorization": "Bearer YOUR_API_TOKEN",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      customer_file_id: 10,
      email: "client@example.com",
      type: "quote"
    })
  }
);
const result = await response.json();
```

---

## POST /v1/quotes/docusign

Send a contract for electronic signature via DocuSign. Requires the DocuSign module to be enabled.

**Query parameters:**

| Parameter | Type | Required | Description |
|---|---|---|---|
| `customer_file_id` | integer | Yes | Customer file ID |
| `type` | string | Yes | Must be `contract` |

**Body (JSON):**

| Field | Type | Required | Description |
|---|---|---|---|
| `title` | string | Yes | Envelope title (max 255 chars) |
| `signers` | array | Yes | Array of signers (at least 1). Each: `email` (required), `name` (optional) |
| `cc` | array | No | Array of CC recipients. Each: `email` (required), `name` (optional) |
| `draft` | boolean | No | If true, creates envelope as draft |

**Response 200:** DocuSign envelope data.
**Response 400:** Module not enabled or validation error.
**Response 500:** DocuSign API error.

**Examples:**

```bash
curl -X POST "https://your-instance.bluerocktel.net/api/v1/quotes/docusign?customer_file_id=10&type=contract" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Service Contract - Acme Corp",
    "signers": [{"email": "signer@example.com", "name": "John Doe"}],
    "cc": [{"email": "manager@example.com", "name": "Jane Smith"}],
    "draft": false
  }'
```

```python
import requests

response = requests.post(
    "https://your-instance.bluerocktel.net/api/v1/quotes/docusign",
    params={"customer_file_id": 10, "type": "contract"},
    json={
        "title": "Service Contract - Acme Corp",
        "signers": [{"email": "signer@example.com", "name": "John Doe"}],
        "cc": [{"email": "manager@example.com", "name": "Jane Smith"}],
        "draft": False
    },
    headers={"Authorization": "Bearer YOUR_API_TOKEN"}
)
envelope = response.json()
```

```php
$response = Http::withToken('YOUR_API_TOKEN')
    ->post('https://your-instance.bluerocktel.net/api/v1/quotes/docusign?customer_file_id=10&type=contract', [
        'title' => 'Service Contract - Acme Corp',
        'signers' => [['email' => 'signer@example.com', 'name' => 'John Doe']],
        'cc' => [['email' => 'manager@example.com', 'name' => 'Jane Smith']],
        'draft' => false,
    ]);

$envelope = $response->json();
```

```javascript
const response = await fetch(
  "https://your-instance.bluerocktel.net/api/v1/quotes/docusign?customer_file_id=10&type=contract",
  {
    method: "POST",
    headers: {
      "Authorization": "Bearer YOUR_API_TOKEN",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      title: "Service Contract - Acme Corp",
      signers: [{ email: "signer@example.com", name: "John Doe" }],
      cc: [{ email: "manager@example.com", name: "Jane Smith" }],
      draft: false
    })
  }
);
const envelope = await response.json();
```
