Back to API docs

apicreateproposalfromcatalog JSON request body agent create

POST /api/createproposalfromcatalog creates a proposal from catalog product ids or SKUs. Line prices, VAT, and names come from the catalog unless you override price.

Scope

This is the simple quoting path for agents. It does not accept inline product objects, groups, or child trees. Use /api/createproposal for full editor JSON, or /api/createproposalfromtemplate to clone existing lines.

Optional template_id copies proposal settings and custom fields from that proposal. It does not copy template line items; items is the source of lines.

Top-level JSON fields

key
string, optional if a header is sent

API key. You may send Authorization: Bearer or X-Api-Key instead.

name
string, required

Proposal name. Also accepted as proposal.name.

items
array, required

Catalog lines. Each item needs product_ref, sku, or numeric id, plus optional ammount (alias amount, default 1). Optional price and discount override catalog values.

contact
integer or object, optional

Existing contact id or a contact object accepted by /api/createcontact.

template_id
integer, optional

Proposal whose settings and extra fields are copied after create. Line items are not copied.

Minimal request

{
  "key": "YOUR_API_KEY",
  "name": "Quote for Example UAB",
  "contact": {
    "name": "Example UAB",
    "email": "john@example.com"
  },
  "items": [
    { "sku": "TERRAX-40", "ammount": 2 },
    { "product_ref": 15, "ammount": 1 }
  ]
}

Response

{
  "status": "ok",
  "data": {
    "proposal": { "id": 456, "name": "Quote for Example UAB" },
    "entries": [],
    "url": "https://example.com/offer/generated-url"
  }
}

Error responses

Unknown products return field-level errors and a stable code. The proposal is not created if any item fails.

{
  "status": "error",
  "data": "unknown product",
  "code": "unknown_product",
  "errors": [
    { "field": "items.0.product_ref", "code": "unknown_product", "message": "Product not found: MISSING-SKU" }
  ]
}