> ## Documentation Index
> Fetch the complete documentation index at: https://developers.leadwaycrm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Estimate Template

> Update an existing estimate template

Update an existing estimate template

```http theme={null}
PUT https://services.leadconnectorhq.com/invoices/estimate/template/{templateId}
```

## Autorización

<ParamField header="Authorization" type="string" required>
  Bearer token generado desde el portal Leadway. Ver [Autenticación](/authentication).
</ParamField>

<ParamField header="Version" type="string" required default="2021-07-28">
  Versión de la API.
</ParamField>

## Path parameters

<ParamField path="templateId" type="string" required default="5f9d6d8b1b2d2c001f2d9e4b">
  Template Id
</ParamField>

## Body

<ParamField body="altId" type="string" required default="6578278e879ad2646715ba9c">
  Account Id or Agency Id
</ParamField>

<ParamField body="altType" type="string" required>
  Posibles valores: 'account'
</ParamField>

<ParamField body="name" type="string" required default="Home Service Estimate Template">
  Estimate Name
</ParamField>

<ParamField body="businessDetails" type="object" required>
  <Expandable title="propiedades">
    <ParamField body="logoUrl" type="string" default="https://example.com/logo.png">
      Business Logo URL
    </ParamField>

    <ParamField body="name" type="string" default="ABC Corp.">
      Business Name
    </ParamField>

    <ParamField body="phoneNo" type="string" default="+1-214-559-6993">
      Business Phone Number
    </ParamField>

    <ParamField body="address" type="object" default="9931 Beechwood, TX">
      Business Address
    </ParamField>

    <ParamField body="website" type="string" default="wwww.example.com">
      Business Website Link
    </ParamField>

    <ParamField body="customValues" type="string[]">
      Custom Values
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="currency" type="string" required default="USD">
  Currency code
</ParamField>

<ParamField body="items" type="array[]" required>
  An array of items for the estimate.
</ParamField>

<ParamField body="liveMode" type="boolean" default="True">
  livemode for estimate
</ParamField>

<ParamField body="discount" type="object" required>
  <Expandable title="propiedades">
    <ParamField body="value" type="number" default="10">
      Discount Value
    </ParamField>

    <ParamField body="type" type="string" required default="percentage">
      Discount type Posibles valores: 'percentage', 'fixed'
    </ParamField>

    <ParamField body="validOnProductIds" type="string[]" default="[ '6579751d56f60276e5bd4154' ]">
      Product Ids on which discount is applicable
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="termsNotes" type="string" default="<p>This is a default terms.</p>">
  Terms notes, Also supports HTML markups
</ParamField>

<ParamField body="title" type="string" default="ESTIMATE">
  Title for the estimate
</ParamField>

<ParamField body="automaticTaxesEnabled" type="boolean" default="True">
  Automatic taxes enabled for the Estimate
</ParamField>

<ParamField body="meta" type="object">
  Meta data for the estimate
</ParamField>

<ParamField body="sendEstimateDetails" type="object">
  When sending estimate directly while saving
</ParamField>

<ParamField body="estimateNumberPrefix" type="string" default="EST-">
  Prefix for the estimate number
</ParamField>

<ParamField body="attachments" type="object[]">
  attachments for the invoice

  <Expandable title="cada item">
    <ParamField body="id" type="string" required default="6241712be68f7a98102ba272">
      Id of the file selected
    </ParamField>

    <ParamField body="name" type="string" required default="Electronics.pdf">
      Name of the file
    </ParamField>

    <ParamField body="url" type="string" required default="https://example.com/digital-delivery">
      URL of the file
    </ParamField>

    <ParamField body="type" type="string" required>
      Type of the file
    </ParamField>

    <ParamField body="size" type="number" required default="10000">
      Size of the file
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="miscellaneousCharges" type="object">
  miscellaneous charges for the estimate
</ParamField>

## Respuestas

<Accordion title="200 - Successfully updated">
  <ResponseField name="altId" type="string" required default="6578278e879ad2646715ba9c">
    Account Id or Agency Id
  </ResponseField>

  <ResponseField name="altType" type="string" required>
    Posibles valores: 'account'
  </ResponseField>

  <ResponseField name="_id" type="string" required default="67ac9a51106ee8311e911XXXX">
    Unique identifier
  </ResponseField>

  <ResponseField name="liveMode" type="boolean" required default="True">
    Indicates if it is in live mode
  </ResponseField>

  <ResponseField name="deleted" type="boolean" required default="False">
    Indicates if deleted
  </ResponseField>

  <ResponseField name="name" type="string" required default="Estimate Name">
    Name
  </ResponseField>

  <ResponseField name="currency" type="string" required default="USD">
    Currency code
  </ResponseField>

  <ResponseField name="businessDetails" type="object" required>
    Business details associated with the estimate
  </ResponseField>

  <ResponseField name="items" type="array[]" required>
    An array of items
  </ResponseField>

  <ResponseField name="discount" type="object" required>
    Discount details for the estimate template
  </ResponseField>

  <ResponseField name="title" type="string" default="ESTIMATE">
    Title
  </ResponseField>

  <ResponseField name="estimateNumberPrefix" type="string" default="EST-">
    Estimate number prefix
  </ResponseField>

  <ResponseField name="attachments" type="object[]">
    Attachments

    <Expandable title="cada item">
      <ResponseField name="id" type="string" required default="6241712be68f7a98102ba272">
        Id of the file selected
      </ResponseField>

      <ResponseField name="name" type="string" required default="Electronics.pdf">
        Name of the file
      </ResponseField>

      <ResponseField name="url" type="string" required default="https://example.com/digital-delivery">
        URL of the file
      </ResponseField>

      <ResponseField name="type" type="string" required>
        Type of the file
      </ResponseField>

      <ResponseField name="size" type="number" required default="10000">
        Size of the file
      </ResponseField>
    </Expandable>
  </ResponseField>

  <ResponseField name="updatedBy" type="string" default="3HIpOF9NIc5ltriQXXXX">
    User Id of who last updated
  </ResponseField>

  <ResponseField name="total" type="number" required default="1222.03">
    Total amount
  </ResponseField>

  <ResponseField name="createdAt" type="string" required default="2025-02-12T13:17:47.416Z">
    Timestamp when created
  </ResponseField>

  <ResponseField name="updatedAt" type="string" required default="2025-02-12T13:17:47.416Z">
    Timestamp when last updated
  </ResponseField>

  <ResponseField name="__v" type="number" required default="0">
    Version number
  </ResponseField>

  <ResponseField name="automaticTaxesEnabled" type="boolean" required default="False">
    Indicates if automatic taxes are enabled for this estimate
  </ResponseField>

  <ResponseField name="termsNotes" type="string" default="<p>All services are subject to availability.</p>">
    Terms and conditions for the estimate, supports HTML markup
  </ResponseField>

  ```json theme={null}
  {
    "altId": "6578278e879ad2646715ba9c",
    "altType": "account",
    "_id": "67ac9a51106ee8311e911XXXX",
    "liveMode": true,
    "deleted": false,
    "name": "Estimate Name",
    "currency": "USD",
    "businessDetails": {
      "logoUrl": "your_image-url",
      "name": "Business name",
      "address": {
        "addressLine1": "address line 1",
        "city": "Test City",
        "state": "State Name",
        "countryCode": "US",
        "postalCode": "12345"
      },
      "phoneNo": "+1 1234567890",
      "website": "www.example.com",
      "customValues": [
        {
          "name": "Test",
          "fieldKey": "{{custom_values.test}}",
          "id": "5DYTWoiQvWiIJZXX44XXX",
          "value": "Test's Custom Value"
        }
      ]
    },
    "items": [
      {
        "taxes": [],
        "taxInclusive": false,
        "_id": "67ac9a51106ee8311e911XXXX",
        "description": "<p>Futuristic anti-gravity racing</p>",
        "currency": "USD",
        "productId": "67ac9a51106ee8311e911XXXX",
        "priceId": "67ac9a51106ee8311e911XXXX",
        "amount": 9.99,
    // truncado: 48 lineas mas
  }
  ```
</Accordion>

<Accordion title="400 - Bad Request">
  ```json theme={null}
  {}
  ```
</Accordion>

<Accordion title="401 - Unauthorized">
  ```json theme={null}
  {}
  ```
</Accordion>

<Accordion title="422 - Unprocessable Entity">
  ```json theme={null}
  {}
  ```
</Accordion>

## Ejemplo

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PUT 'https://services.leadconnectorhq.com/invoices/estimate/template/YOUR_templateId' \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -H 'Version: 2021-07-28' \
    -H 'Content-Type: application/json' \
    -d '{
    "altId": "6578278e879ad2646715ba9c",
    "altType": "account",
    "name": "Home Service Estimate Template",
    "businessDetails": {
      "logoUrl": "https://example.com/logo.png",
      "name": "ABC Corp.",
      "phoneNo": "+1-214-559-6993",
      "address": "9931 Beechwood, TX",
      "website": "wwww.example.com",
      "customValues": [
        "string"
      ]
    },
    "currency": "USD",
    "items": [
      []
    ],
    "liveMode": true,
    "discount": {
      "value": 10,
      "type": "percentage",
      "validOnProductIds": "[ '6579751d56f60276e5bd4154' ]"
    },
    "termsNotes": "<p>This is a default terms.</p>",
    "title": "ESTIMATE",
    "automaticTaxesEnabled": true,
    "meta": {
      "key": "value"
    },
    "estimateNumberPrefix": "EST-",
    "attachments": [
      {
        "id": "6241712be68f7a98102ba272",
        "name": "Electronics.pdf",
        "url": "https://example.com/digital-delivery",
        "type": "string",
        "size": 10000
      }
    ]
  }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://services.leadconnectorhq.com/invoices/estimate/template/YOUR_templateId', {
    method: 'PUT',
    headers: {
      Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
      Version: '2021-07-28',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({"altId": "6578278e879ad2646715ba9c", "altType": "account", "name": "Home Service Estimate Template", "businessDetails": {"logoUrl": "https://example.com/logo.png", "name": "ABC Corp.", "phoneNo": "+1-214-559-6993", "address": "9931 Beechwood, TX", "website": "wwww.example.com", "customValues": ["string"]}, "currency": "USD", "items": [[]], "liveMode": true, "discount": {"value": 10, "type": "percentage", "validOnProductIds": "[ '6579751d56f60276e5bd4154' ]"}, "termsNotes": "<p>This is a default terms.</p>", "title": "ESTIMATE", "automaticTaxesEnabled": true, "meta": {"key": "value"}, "estimateNumberPrefix": "EST-", "attachments": [{"id": "6241712be68f7a98102ba272", "name": "Electronics.pdf", "url": "https://example.com/digital-delivery", "type": "string", "size": 10000}]}),
  });
  const data = await response.json();
  ```

  ```python Python theme={null}
  import os, requests
  response = requests.request(
      'PUT',
      'https://services.leadconnectorhq.com/invoices/estimate/template/YOUR_templateId',
      headers={
          'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
          'Version': '2021-07-28',
          'Content-Type': 'application/json',
      },
      json={"altId": "6578278e879ad2646715ba9c", "altType": "account", "name": "Home Service Estimate Template", "businessDetails": {"logoUrl": "https://example.com/logo.png", "name": "ABC Corp.", "phoneNo": "+1-214-559-6993", "address": "9931 Beechwood, TX", "website": "wwww.example.com", "customValues": ["string"]}, "currency": "USD", "items": [[]], "liveMode": true, "discount": {"value": 10, "type": "percentage", "validOnProductIds": "[ '6579751d56f60276e5bd4154' ]"}, "termsNotes": "<p>This is a default terms.</p>", "title": "ESTIMATE", "automaticTaxesEnabled": true, "meta": {"key": "value"}, "estimateNumberPrefix": "EST-", "attachments": [{"id": "6241712be68f7a98102ba272", "name": "Electronics.pdf", "url": "https://example.com/digital-delivery", "type": "string", "size": 10000}]},
  )
  data = response.json()
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init('https://services.leadconnectorhq.com/invoices/estimate/template/YOUR_templateId');
  curl_setopt_array($ch, [
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_CUSTOMREQUEST => 'PUT',
      CURLOPT_HTTPHEADER => [
          'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
          'Version: 2021-07-28',
          'Content-Type: application/json',
      ],
      CURLOPT_POSTFIELDS => json_encode({'altId': '6578278e879ad2646715ba9c', 'altType': 'account', 'name': 'Home Service Estimate Template', 'businessDetails': {'logoUrl': 'https://example.com/logo.png', 'name': 'ABC Corp.', 'phoneNo': '+1-214-559-6993', 'address': '9931 Beechwood, TX', 'website': 'wwww.example.com', 'customValues': ['string']}, 'currency': 'USD', 'items': [[]], 'liveMode': true, 'discount': {'value': 10, 'type': 'percentage', 'validOnProductIds': '[ '6579751d56f60276e5bd4154' ]'}, 'termsNotes': '<p>This is a default terms.</p>', 'title': 'ESTIMATE', 'automaticTaxesEnabled': true, 'meta': {'key': 'value'}, 'estimateNumberPrefix': 'EST-', 'attachments': [{'id': '6241712be68f7a98102ba272', 'name': 'Electronics.pdf', 'url': 'https://example.com/digital-delivery', 'type': 'string', 'size': 10000}]}),
  ]);
  $data = json_decode(curl_exec($ch), true);
  ```
</CodeGroup>
