# Quotes

> Send a quote with a link: your customer views it, accepts it, asks for changes or rejects it, and the invoice is stamped with the same line items.

A **quote** carries an invoice's line items and payment terms. Your customer gets it with a link where they view it, download the PDF, **accept** it, **ask for changes** or **reject** it, and you find out through [webhooks](https://fiscalisto.com/en/docs/api/webhooks). Once accepted, the invoice comes from the same line items: on its own, with `auto_invoice`, or when you ask for it.

## Create one

```bash tab="cURL"
curl https://api.fiscalisto.com/v1/quotes \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "customer": {
      "tax_id": "ICV060329BY0",
      "legal_name": "INMOBILIARIA CVA",
      "tax_system": "601",
      "zip": "33826",
      "email": "compras@cva.example"
    },
    "payment_form": "03",
    "items": [
      { "description": "Desarrollo del sitio web", "product_key": "81112103", "unit_price": 45000 }
    ],
    "terms": "50% de anticipo, entrega en 4 semanas.",
    "valid_until": "2026-11-30"
  }'
```

```ts tab="TypeScript"
import { Fiscalisto } from "fiscalisto";

// The key comes from FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

const quote = await fiscalisto.quotes.create({
  customer: {
    tax_id: "ICV060329BY0",
    legal_name: "INMOBILIARIA CVA",
    tax_system: "601",
    zip: "33826",
    email: "compras@cva.example",
  },
  payment_form: "03",
  items: [
    {
      description: "Desarrollo del sitio web",
      product_key: "81112103",
      unit_price: 45000,
    },
  ],
  terms: "50% de anticipo, entrega en 4 semanas.",
  valid_until: "2026-11-30",
});
```

```python tab="Python"
from fiscalisto import Fiscalisto

# The key comes from FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

quote = fiscalisto.quotes.create({
    "customer": {
        "tax_id": "ICV060329BY0",
        "legal_name": "INMOBILIARIA CVA",
        "tax_system": "601",
        "zip": "33826",
        "email": "compras@cva.example",
    },
    "payment_form": "03",
    "items": [
        {
            "description": "Desarrollo del sitio web",
            "product_key": "81112103",
            "unit_price": 45000,
        },
    ],
    "terms": "50% de anticipo, entrega en 4 semanas.",
    "valid_until": "2026-11-30",
})
```

```php tab="PHP"
<?php

use Fiscalisto\Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

$quote = $fiscalisto->quotes->create([
    'customer' => [
        'tax_id' => 'ICV060329BY0',
        'legal_name' => 'INMOBILIARIA CVA',
        'tax_system' => '601',
        'zip' => '33826',
        'email' => 'compras@cva.example',
    ],
    'payment_form' => '03',
    'items' => [
        [
            'description' => 'Desarrollo del sitio web',
            'product_key' => '81112103',
            'unit_price' => 45000,
        ],
    ],
    'terms' => '50% de anticipo, entrega en 4 semanas.',
    'valid_until' => '2026-11-30',
]);
```

```go tab="Go"
package main

import (
	"context"
	"encoding/json"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// The key comes from FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	quote, err := client.Quotes.Create(ctx, &fiscalisto.CreateQuoteParams{
		Customer:    json.RawMessage(`{"tax_id":"ICV060329BY0","legal_name":"INMOBILIARIA CVA","tax_system":"601","zip":"33826","email":"compras@cva.example"}`),
		PaymentForm: fiscalisto.String("03"),
		Items: []fiscalisto.CreateQuoteParamsItem{
			{
				Description: fiscalisto.String("Desarrollo del sitio web"),
				ProductKey:  fiscalisto.String("81112103"),
				UnitPrice:   fiscalisto.Float64(45000),
			},
		},
		Terms:      fiscalisto.String("50% de anticipo, entrega en 4 semanas."),
		ValidUntil: fiscalisto.String("2026-11-30"),
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(quote.ID)
}
```

```java tab="Java"
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.model.CreateQuoteParams;
import com.fiscalisto.model.CreateQuoteParamsItem;
import java.util.List;
import java.util.Map;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var quote = fiscalisto.quotes().create(new CreateQuoteParams()
        .setCustomer(Map.of(
                "tax_id", "ICV060329BY0",
                "legal_name", "INMOBILIARIA CVA",
                "tax_system", "601",
                "zip", "33826",
                "email", "compras@cva.example"
        ))
        .setPaymentForm("03")
        .setItems(List.of(
                new CreateQuoteParamsItem()
                        .setDescription("Desarrollo del sitio web")
                        .setProductKey("81112103")
                        .setUnitPrice(45000)
        ))
        .setTerms("50% de anticipo, entrega en 4 semanas.")
        .setValidUntil("2026-11-30"));
System.out.println(quote.getId());
```

```csharp tab="C#"
using System.Text.Json;
using Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var quote = await fiscalisto.Quotes.CreateAsync(new CreateQuoteParams
{
    Customer = JsonDocument.Parse("{\"tax_id\":\"ICV060329BY0\",\"legal_name\":\"INMOBILIARIA CVA\",\"tax_system\":\"601\",\"zip\":\"33826\",\"email\":\"compras@cva.example\"}").RootElement,
    PaymentForm = "03",
    Items = new()
    {
        new()
        {
            Description = "Desarrollo del sitio web",
            ProductKey = "81112103",
            UnitPrice = 45000,
        },
    },
    Terms = "50% de anticipo, entrega en 4 semanas.",
    ValidUntil = "2026-11-30",
});
```

`items`, `payment_form`, `payment_method`, `use`, `currency` and `notes` are the same as in [POST /v1/invoices](https://fiscalisto.com/en/docs/api/facturas) and are checked with the same rules, so a quote can always be invoiced. `valid_until` is its last day (by default, the days of its customer, its group or the company, 15 if nobody changed them; up to a year) and `terms` its conditions, printed on the PDF.

`customer` can be:

- A customer from your catalog: `"customer": "cus_…"`.
- Their tax data, as on an invoice: they're added to your customers.
- Just `name` and `email`, if they haven't given you their tax data yet: `{ "name": "Juan Pérez", "email": "juan@correo.example" }`. You can add it later, or send it with `auto_invoice` so they give it when accepting.

Returns `201` with the quote (`quo_…`) as a draft: its number (`COT-12`), the total with taxes and `url: null` until you send it.

## Send it

```bash tab="cURL"
curl https://api.fiscalisto.com/v1/quotes/quo_OufpKqnrvx9p3Kd8wQm2XyT5uBcW8sKdLx/send \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "message": "Le comparto la cotización del sitio.", "auto_invoice": true }'
```

```ts tab="TypeScript"
import { Fiscalisto } from "fiscalisto";

// The key comes from FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

const quote = await fiscalisto.quotes.send("quo_OufpKqnrvx9p3Kd8wQm2XyT5uBcW8sKdLx", {
  message: "Le comparto la cotización del sitio.",
  auto_invoice: true,
});
```

```python tab="Python"
from fiscalisto import Fiscalisto

# The key comes from FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

quote = fiscalisto.quotes.send("quo_OufpKqnrvx9p3Kd8wQm2XyT5uBcW8sKdLx", {
    "message": "Le comparto la cotización del sitio.",
    "auto_invoice": True,
})
```

```php tab="PHP"
<?php

use Fiscalisto\Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

$quote = $fiscalisto->quotes->send('quo_OufpKqnrvx9p3Kd8wQm2XyT5uBcW8sKdLx', [
    'message' => 'Le comparto la cotización del sitio.',
    'auto_invoice' => true,
]);
```

```go tab="Go"
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// The key comes from FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	quote, err := client.Quotes.Send(ctx, "quo_OufpKqnrvx9p3Kd8wQm2XyT5uBcW8sKdLx", &fiscalisto.SendQuoteParams{
		Message:     fiscalisto.String("Le comparto la cotización del sitio."),
		AutoInvoice: fiscalisto.Bool(true),
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(quote.ID)
}
```

```java tab="Java"
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.model.SendQuoteParams;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var quote = fiscalisto.quotes().send("quo_OufpKqnrvx9p3Kd8wQm2XyT5uBcW8sKdLx", new SendQuoteParams()
        .setMessage("Le comparto la cotización del sitio.")
        .setAutoInvoice(true));
System.out.println(quote.getId());
```

```csharp tab="C#"
using Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var quote = await fiscalisto.Quotes.SendAsync("quo_OufpKqnrvx9p3Kd8wQm2XyT5uBcW8sKdLx", new SendQuoteParams
{
    Message = "Le comparto la cotización del sitio.",
    AutoInvoice = true,
});
```

It reaches the customer's email (or `to`, up to 5 addresses) with the PDF and the link, which also comes in `url`. With `"send_email": false` it's only marked as sent and returns `url`, so you can send it by WhatsApp or from your system. In test mode the email is only sent to people in your company, like an invoice's.

With `"remind": true`, if your customer hasn't answered, a reminder reaches the same addresses 3 days before the last day of `valid_until` (at 8 in the morning in the company's time zone), only once. `reminded_at` says when it was sent. It doesn't go out if they already asked for changes, accepted it, rejected it or you withdrew it.

With `auto_invoice: true`, on acceptance the invoice is stamped on its own with your account's timbres: right away if you already have the customer's tax data, or as soon as they give it on the same page if not. A quote in another currency isn't stamped on its own: that day's exchange rate may not be today's.

## What your customer does

| Event | When |
| --- | --- |
| `quote.viewed` | They open the link for the first time (`status: viewed`). |
| `quote.changes_requested` | They ask for changes; what they wrote comes in `customer_comment`. |
| `quote.accepted` | They accept it (`decided_by: customer`). With `auto_invoice`, `invoice.stamped` follows. |
| `quote.rejected` | They reject it, with their reason in `customer_comment` if they gave one. |

If they said yes over the phone, mark it with `POST /v1/quotes/{id}/accept` (`decided_by: user`).

## Close it

| Route | What for | Event |
| --- | --- | --- |
| `POST /v1/quotes/{id}/withdraw` | You no longer offer it. Its link says it was withdrawn and it can no longer be accepted (`status: withdrawn`). | `quote.withdrawn` |
| `POST /v1/quotes/{id}/reject` | Your customer said no some other way, or it expired and won't go on (`status: rejected`, `decided_by: user`). | `quote.rejected` |

Both accept `note`, which stays in `customer_comment` (your customer doesn't see it). One that was never sent isn't closed: delete it (`400 quote_not_sent`). To offer it again, change it: it becomes a new version you send with `/send`.

## Change it

`POST /v1/quotes/{id}` changes only what you send. A draft changes in place. One already sent becomes a **new version** as a draft, with the same number and the same id (`version` goes up); your customer keeps seeing the previous one until you send the new one with `/send`. An expired, rejected or withdrawn one also changes this way. An accepted or invoiced one no longer changes (`400 quote_invalid`).

An expired quote (`status: expired`) is revived by changing its `valid_until` and sending it again.

## Invoice it

```bash tab="cURL"
curl -X POST https://api.fiscalisto.com/v1/quotes/quo_OufpKqnrvx9p3Kd8wQm2XyT5uBcW8sKdLx/invoice \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -H "Idempotency-Key: cot-12-factura"
```

```ts tab="TypeScript"
import { Fiscalisto } from "fiscalisto";

// The key comes from FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

const invoice = await fiscalisto.quotes.invoice("quo_OufpKqnrvx9p3Kd8wQm2XyT5uBcW8sKdLx", { idempotencyKey: "cot-12-factura" });
```

```python tab="Python"
from fiscalisto import Fiscalisto

# The key comes from FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

invoice = fiscalisto.quotes.invoice("quo_OufpKqnrvx9p3Kd8wQm2XyT5uBcW8sKdLx", idempotency_key="cot-12-factura")
```

```php tab="PHP"
<?php

use Fiscalisto\Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

$invoice = $fiscalisto->quotes->invoice('quo_OufpKqnrvx9p3Kd8wQm2XyT5uBcW8sKdLx', ['idempotency_key' => 'cot-12-factura']);
```

```go tab="Go"
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// The key comes from FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	invoice, err := client.Quotes.Invoice(ctx, "quo_OufpKqnrvx9p3Kd8wQm2XyT5uBcW8sKdLx", fiscalisto.WithIdempotencyKey("cot-12-factura"))
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(invoice.ID)
}
```

```java tab="Java"
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.RequestOptions;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var invoice = fiscalisto.quotes().invoice("quo_OufpKqnrvx9p3Kd8wQm2XyT5uBcW8sKdLx", RequestOptions.idempotencyKey("cot-12-factura"));
System.out.println(invoice.getId());
```

```csharp tab="C#"
using Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var invoice = await fiscalisto.Quotes.InvoiceAsync("quo_OufpKqnrvx9p3Kd8wQm2XyT5uBcW8sKdLx", new RequestOptions { IdempotencyKey = "cot-12-factura" });
```

Stamps the invoice with its line items and the customer's tax data and returns the invoice (`201`). If it wasn't accepted, it marks it accepted; the quote becomes `invoiced` with the invoice in `invoice`. If it was already invoiced, it returns that same invoice: two are never stamped. Without the customer's tax data it returns `400 quote_customer_missing`; rejected or expired, `400 quote_not_invoiceable`.

## Validity and schedules

A new quote without `valid_until` lasts its customer's days (`quote_valid_days` in [/v1/customers](https://fiscalisto.com/en/docs/api/referencia/clientes/update-customer)), else its group's (`quote_valid_days` in `/v1/customer_groups`), else the company's. It expires when its last day ends in the company's time zone, or at the hour in `quote_expiry_hour`. The company's, like **Ajustes › Horarios** in the app, are read with `GET /v1/schedule_settings` and changed with [`POST /v1/schedule_settings`](https://fiscalisto.com/en/docs/api/referencia/emisores/update-schedule-settings); they also hold the hour of the «Cada mañana» rules (`rules_hour`), of the daily findings (`findings_hour`) and of the Monday weekly digest (`digest_hour`). They apply to the whole company, and whatever you don't send stays as it is:

```bash tab="cURL"
curl https://api.fiscalisto.com/v1/schedule_settings \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "quote_valid_days": 15, "quote_expiry_hour": 18, "findings_hour": 7 }'
```

```ts tab="TypeScript"
import { Fiscalisto } from "fiscalisto";

// The key comes from FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

const scheduleSettings = await fiscalisto.scheduleSettings.update({
  quote_valid_days: 15,
  quote_expiry_hour: 18,
  findings_hour: 7,
});
```

```python tab="Python"
from fiscalisto import Fiscalisto

# The key comes from FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

schedule_settings = fiscalisto.schedule_settings.update({
    "quote_valid_days": 15,
    "quote_expiry_hour": 18,
    "findings_hour": 7,
})
```

```php tab="PHP"
<?php

use Fiscalisto\Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

$scheduleSettings = $fiscalisto->scheduleSettings->update([
    'quote_valid_days' => 15,
    'quote_expiry_hour' => 18,
    'findings_hour' => 7,
]);
```

```go tab="Go"
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// The key comes from FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	scheduleSettings, err := client.ScheduleSettings.Update(ctx, &fiscalisto.UpdateScheduleSettingsParams{
		QuoteValidDays:  fiscalisto.Int64(15),
		QuoteExpiryHour: fiscalisto.Int64(18),
		FindingsHour:    fiscalisto.Int64(7),
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", *scheduleSettings)
}
```

```java tab="Java"
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.model.UpdateScheduleSettingsParams;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var scheduleSettings = fiscalisto.scheduleSettings().update(new UpdateScheduleSettingsParams()
        .setQuoteValidDays(15)
        .setQuoteExpiryHour(18)
        .setFindingsHour(7));
System.out.println(scheduleSettings);
```

```csharp tab="C#"
using Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var scheduleSettings = await fiscalisto.ScheduleSettings.UpdateAsync(new UpdateScheduleSettingsParams
{
    QuoteValidDays = 15,
    QuoteExpiryHour = 18,
    FindingsHour = 7,
});
```

## Everything else

- `GET /v1/quotes` lists them, newest first, each at its latest version; filter with `status` (`draft`, `sent`, `viewed`, `accepted`, `rejected`, `withdrawn`, `expired` or `invoiced`).
- `GET /v1/quotes/{id}/pdf` downloads the PDF, with the issuer's PDF design.
- `DELETE /v1/quotes/{id}` deletes the quote with all its versions; if it was sent, its `url` stops working. An accepted or invoiced one isn't deleted (`400 quote_not_deletable`).

An account creates up to 20,000 quotes a day in production and 200 in test mode ([Limits](https://fiscalisto.com/en/docs/api/limites)).
