> ## 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.

# Create New Estimate

> Create a new estimate with the provided details

Create a new estimate with the provided details

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

## 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>

## 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">
  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="object[]" required>
  An array of items for the estimate.

  <Expandable title="cada item">
    <ParamField body="name" type="string" required default="ABC Product">
      Invoice Item Name
    </ParamField>

    <ParamField body="description" type="string" default="ABC Corp.">
      Invoice descriptions
    </ParamField>

    <ParamField body="productId" type="string" default="6578278e879ad2646715ba9c">
      Product Id
    </ParamField>

    <ParamField body="priceId" type="string" default="6578278e879ad2646715ba9c">
      Price Id
    </ParamField>

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

    <ParamField body="amount" type="number" required default="999">
      Product amount
    </ParamField>

    <ParamField body="qty" type="number" required default="1">
      Product Quantity
    </ParamField>

    <ParamField body="taxes" type="object[]">
      Tax

      <Expandable title="cada item">
        <ParamField body="_id" type="string" required />

        <ParamField body="name" type="string" required />

        <ParamField body="rate" type="number" required />

        <ParamField body="calculation" type="string">
          Posibles valores: 'exclusive'
        </ParamField>

        <ParamField body="description" type="string" />

        <ParamField body="taxId" type="string" />
      </Expandable>
    </ParamField>

    <ParamField body="automaticTaxCategoryId" type="string" default="6578278e879ad2646715ba9c">
      Tax category id for calculating automatic tax
    </ParamField>

    <ParamField body="isSetupFeeItem" type="boolean">
      Setupfee item, only created when 1st invoice of recurring schedule is generated
    </ParamField>

    <ParamField body="type" type="string" default="one_time">
      Price type of the item Posibles valores: 'one\_time', 'recurring'
    </ParamField>

    <ParamField body="taxInclusive" type="boolean" default="True">
      true if item amount is tax inclusive
    </ParamField>

    <ParamField body="attachments" type="string[]">
      Attachments for the line item
    </ParamField>
  </Expandable>
</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="contactDetails" type="object" required>
  Contact information to send the estimate to
</ParamField>

<ParamField body="estimateNumber" type="number" default="1001">
  Estimate Number, if not specified will take in the next valid estimate number
</ParamField>

<ParamField body="issueDate" type="string" default="2024-08-07">
  issue date estimate
</ParamField>

<ParamField body="expiryDate" type="string" default="2024-08-10">
  expiry date estimate
</ParamField>

<ParamField body="sentTo" type="object">
  Email and sent to details 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="frequencySettings" type="object" required>
  frequency settings for the estimate
</ParamField>

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

<ParamField body="userId" type="string" default="6578278e879ad2646715ba9c">
  User Id
</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="autoInvoice" type="object">
  Auto invoice for the estimate
</ParamField>

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

<ParamField body="paymentScheduleConfig" type="object">
  Payment Schedule Config for the estimate
</ParamField>

## Respuestas

<Accordion title="201 - Created">
  <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>

  <ResponseField name="companyId" type="string" required default="COMP12345">
    Company identifier associated with the estimate
  </ResponseField>

  <ResponseField name="contactDetails" type="object" required>
    Contact details for the estimate
  </ResponseField>

  <ResponseField name="issueDate" type="string" required default="2023-06-15T00:00:00.000Z">
    Date when the estimate was issued
  </ResponseField>

  <ResponseField name="expiryDate" type="string" required default="2023-07-15T00:00:00.000Z">
    Date when the estimate expires
  </ResponseField>

  <ResponseField name="sentBy" type="string" default="user@example.com">
    User who sent the estimate
  </ResponseField>

  <ResponseField name="automaticTaxesCalculated" type="boolean" required default="True">
    Indicates if automatic taxes were calculated
  </ResponseField>

  <ResponseField name="meta" type="object" required>
    Additional metadata associated with the estimate
  </ResponseField>

  <ResponseField name="estimateActionHistory" type="string[]" required>
    History of actions taken on the estimate
  </ResponseField>

  <ResponseField name="sentTo" type="object" required>
    Recipient details for the estimate
  </ResponseField>

  <ResponseField name="frequencySettings" type="object" required>
    Frequency settings for recurring estimates
  </ResponseField>

  <ResponseField name="lastVisitedAt" type="string" required default="2023-06-20T08:30:00.000Z">
    Timestamp when the estimate was last visited
  </ResponseField>

  <ResponseField name="totalamountInUSD" type="number" required default="1500.75">
    Total amount in USD
  </ResponseField>

  <ResponseField name="autoInvoice" type="object">
    Auto-invoice settings for the estimate
  </ResponseField>

  <ResponseField name="traceId" type="string" required default="010c7a01-857f-4619-970d-xyxyxyxy">
    Trace ID for logging and debugging
  </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: 86 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 POST 'https://services.leadconnectorhq.com/invoices/estimate' \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -H 'Version: 2021-07-28' \
    -H 'Content-Type: application/json' \
    -d '{
    "altId": "6578278e879ad2646715ba9c",
    "altType": "account",
    "name": "Home Service Estimate",
    "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": [
      {
        "name": "ABC Product",
        "description": "ABC Corp.",
        "productId": "6578278e879ad2646715ba9c",
        "priceId": "6578278e879ad2646715ba9c",
        "currency": "USD",
        "amount": 999,
        "qty": 1,
        "taxes": [
          {}
        ],
        "automaticTaxCategoryId": "6578278e879ad2646715ba9c",
        "isSetupFeeItem": true,
        "type": "one_time",
        "taxInclusive": true,
        "attachments": [
          "https://example.com/file1.jpg",
          "https://example.com/file2.png"
        ]
      }
    ],
    "liveMode": true,
    "discount": {
      "value": 10,
      "type": "percentage",
      "validOnProductIds": "[ '6579751d56f60276e5bd4154' ]"
    },
    "termsNotes": "<p>This is a default terms.</p>",
    "title": "ESTIMATE",
    "estimateNumber": 1001,
    "issueDate": "2024-08-07",
    "expiryDate": "2024-08-10",
    "automaticTaxesEnabled": true,
    "meta": {
      "key": "value"
    },
    "estimateNumberPrefix": "EST-",
    "userId": "6578278e879ad2646715ba9c",
    "attachments": [
      {
        "id": "6241712be68f7a98102ba272",
        "name": "Electronics.pdf",
        "url": "https://example.com/digital-delivery",
        "type": "string",
        "size": 10000
      }
    ],
    "autoInvoice": {
      "enabled": true,
      "directPayments": true
    }
  }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://services.leadconnectorhq.com/invoices/estimate', {
    method: 'POST',
    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", "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": [{"name": "ABC Product", "description": "ABC Corp.", "productId": "6578278e879ad2646715ba9c", "priceId": "6578278e879ad2646715ba9c", "currency": "USD", "amount": 999, "qty": 1, "taxes": [{}], "automaticTaxCategoryId": "6578278e879ad2646715ba9c", "isSetupFeeItem": true, "type": "one_time", "taxInclusive": true, "attachments": ["https://example.com/file1.jpg", "https://example.com/file2.png"]}], "liveMode": true, "discount": {"value": 10, "type": "percentage", "validOnProductIds": "[ '6579751d56f60276e5bd4154' ]"}, "termsNotes": "<p>This is a default terms.</p>", "title": "ESTIMATE", "estimateNumber": 1001, "issueDate": "2024-08-07", "expiryDate": "2024-08-10", "automaticTaxesEnabled": true, "meta": {"key": "value"}, "estimateNumberPrefix": "EST-", "userId": "6578278e879ad2646715ba9c", "attachments": [{"id": "6241712be68f7a98102ba272", "name": "Electronics.pdf", "url": "https://example.com/digital-delivery", "type": "string", "size": 10000}], "autoInvoice": {"enabled": true, "directPayments": true}}),
  });
  const data = await response.json();
  ```

  ```python Python theme={null}
  import os, requests
  response = requests.request(
      'POST',
      'https://services.leadconnectorhq.com/invoices/estimate',
      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", "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": [{"name": "ABC Product", "description": "ABC Corp.", "productId": "6578278e879ad2646715ba9c", "priceId": "6578278e879ad2646715ba9c", "currency": "USD", "amount": 999, "qty": 1, "taxes": [{}], "automaticTaxCategoryId": "6578278e879ad2646715ba9c", "isSetupFeeItem": true, "type": "one_time", "taxInclusive": true, "attachments": ["https://example.com/file1.jpg", "https://example.com/file2.png"]}], "liveMode": true, "discount": {"value": 10, "type": "percentage", "validOnProductIds": "[ '6579751d56f60276e5bd4154' ]"}, "termsNotes": "<p>This is a default terms.</p>", "title": "ESTIMATE", "estimateNumber": 1001, "issueDate": "2024-08-07", "expiryDate": "2024-08-10", "automaticTaxesEnabled": true, "meta": {"key": "value"}, "estimateNumberPrefix": "EST-", "userId": "6578278e879ad2646715ba9c", "attachments": [{"id": "6241712be68f7a98102ba272", "name": "Electronics.pdf", "url": "https://example.com/digital-delivery", "type": "string", "size": 10000}], "autoInvoice": {"enabled": true, "directPayments": true}},
  )
  data = response.json()
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init('https://services.leadconnectorhq.com/invoices/estimate');
  curl_setopt_array($ch, [
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_CUSTOMREQUEST => 'POST',
      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', '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': [{'name': 'ABC Product', 'description': 'ABC Corp.', 'productId': '6578278e879ad2646715ba9c', 'priceId': '6578278e879ad2646715ba9c', 'currency': 'USD', 'amount': 999, 'qty': 1, 'taxes': [{}], 'automaticTaxCategoryId': '6578278e879ad2646715ba9c', 'isSetupFeeItem': true, 'type': 'one_time', 'taxInclusive': true, 'attachments': ['https://example.com/file1.jpg', 'https://example.com/file2.png']}], 'liveMode': true, 'discount': {'value': 10, 'type': 'percentage', 'validOnProductIds': '[ '6579751d56f60276e5bd4154' ]'}, 'termsNotes': '<p>This is a default terms.</p>', 'title': 'ESTIMATE', 'estimateNumber': 1001, 'issueDate': '2024-08-07', 'expiryDate': '2024-08-10', 'automaticTaxesEnabled': true, 'meta': {'key': 'value'}, 'estimateNumberPrefix': 'EST-', 'userId': '6578278e879ad2646715ba9c', 'attachments': [{'id': '6241712be68f7a98102ba272', 'name': 'Electronics.pdf', 'url': 'https://example.com/digital-delivery', 'type': 'string', 'size': 10000}], 'autoInvoice': {'enabled': true, 'directPayments': true}}),
  ]);
  $data = json_decode(curl_exec($ch), true);
  ```
</CodeGroup>
