Skip to content
Last updated

UpdateQuote

Updates an existing quote

Request Parameters

ParameterTypeDescriptionRequired
actionstring"UpdateQuote"Required
quoteidintThe ID of the quote to updateRequired
subjectstringThe subject of the quoteOptional
stagestringThe current stage of the quote ('Draft','Delivered','On Hold','Accepted','Lost','Dead')Optional
validuntilstringThe date the quote is valid until in localised format (eg DD/MM/YYYY)Optional
datecreatedstringThe date the quote was created in localised format (eg DD/MM/YYYY)Optional
lineitemsarrayA base64 encoded serialized array containing the following keys:Optional
lineitems[x][id]intFor $lineitems. The id of an existing line item. Omit for new linesOptional
lineitems[x][desc]stringFor $lineitems. The description of the line itemOptional
lineitems[x][qty]intFor $lineitems. The quantity of the line item being quoted forOptional
lineitems[x][up]floatFor $lineitems. The Unit Price of the line itemOptional
lineitems[x][discount]floatFor $lineitems. The amount of discount to provide on the line itemsOptional
lineitems[x][taxable]boolFor $lineitems. Is the line item taxableOptional
useridintIf the quote is for an existing client, the client ID the quote is forOptional
firstnamestringThe first name of the client the quote is for if no $useridOptional
lastnamestringThe last name of the client the quote is for if no $useridOptional
companynamestringThe company of the client the quote is for if no $useridOptional
emailstringThe email address of the client the quote is for if no $useridOptional
address1stringThe address1 of the client the quote is for if no $useridOptional
address2stringThe address2 of the client the quote is for if no $useridOptional
citystringThe city of the client the quote is for if no $useridOptional
statestringThe state of the client the quote is for if no $useridOptional
countrystringThe country of the client the quote is for if no $useridOptional
phonenumberstringThe phone number of the client (no country code) the quote is for if no $userid. Local format eg 4035551234Optional
tax_idstringThe tax id of the clientOptional
currencyintThe id of the currency for the quote is for if no $useridOptional
proposalstringThe proposal text displayed to the end userOptional
customernotesstringThe notes on the quote displayed to the end userOptional
adminnotesstringThe notes on the quote displayed to the staff onlyOptional

Response Parameters

ParameterTypeDescription
resultstringThe result of the operation: success or error

Example Request (CURL)

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
    http_build_query(
        array(
            'action' => 'UpdateQuote',
            // See https://developers.whmcs.com/api/authentication
            'username' => 'IDENTIFIER_OR_ADMIN_USERNAME',
            'password' => 'SECRET_OR_HASHED_PASSWORD',
            'subject' => 'Test Quote Subject',
            'stage' => 'Draft',
            'lineitems' => base64_encode(serialize(array(array("id"=>1,"desc"=>"Test Description 1","qty"=>1,"up"=>"10.00","discount"=>"10.00",
"taxable"=>true),array("desc"=>"Test Description 2","qty"=>4,"up"=>"15.00","discount"=>"0.00",
"taxable"=>false)))),
            'responsetype' => 'json',
        )
    )
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);

Example Request (Local API)

$command = 'UpdateQuote';
$postData = array(
    'subject' => 'Test Quote Subject',
    'stage' => 'Draft',
    'lineitems' => base64_encode(serialize(array(array("id"=>1,"desc"=>"Test Description 1","qty"=>1,"up"=>"10.00","discount"=>"10.00",
"taxable"=>true),array("desc"=>"Test Description 2","qty"=>4,"up"=>"15.00","discount"=>"0.00",
"taxable"=>false)))),
);
$adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later

$results = localAPI($command, $postData, $adminUsername);
print_r($results);

Example Response JSON

{
    "result": "success"
}

Error Responses

Possible error condition responses include:

  • Quote ID Not Found
  • Invalid Stage

Version History

VersionChangelog
1.0Initial Version
7.7Added tax_id parameter.