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

> API to create an invoice Schedule

API to create an invoice Schedule

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

## 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 / company Id based on altType
</ParamField>

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

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

<ParamField body="contactDetails" type="object" required>
  <Expandable title="propiedades">
    <ParamField body="id" type="string" required default="6578278e879ad2646715ba9c">
      Contact ID
    </ParamField>

    <ParamField body="name" type="string" required default="Alex">
      Contact Name
    </ParamField>

    <ParamField body="phoneNo" type="string" required default="+1234567890">
      Contact Phone Number
    </ParamField>

    <ParamField body="email" type="string" required default="alex@example.com">
      Contact Email
    </ParamField>

    <ParamField body="additionalEmails" type="object[]">
      Secondary email addresses for the contact to be saved

      <Expandable title="cada item">
        <ParamField body="email" type="string" required default="alex@example.com" />
      </Expandable>
    </ParamField>

    <ParamField body="companyName" type="string" default="ABC Corp.">
      Contact Company Name
    </ParamField>

    <ParamField body="address" type="object">
      <Expandable title="propiedades">
        <ParamField body="addressLine1" type="string" default="9931 Beechwood">
          Address Line 1
        </ParamField>

        <ParamField body="addressLine2" type="string" default="Beechwood">
          Address Line 2
        </ParamField>

        <ParamField body="city" type="string" default="St. Houston">
          City
        </ParamField>

        <ParamField body="state" type="string" default="TX">
          State
        </ParamField>

        <ParamField body="countryCode" type="string" default="US">
          Country Code
        </ParamField>

        <ParamField body="postalCode" type="string" default="559-6993">
          Postal Code
        </ParamField>
      </Expandable>
    </ParamField>

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

<ParamField body="schedule" type="object" required>
  <Expandable title="propiedades">
    <ParamField body="executeAt" type="string" />

    <ParamField body="rrule" type="object">
      <Expandable title="propiedades">
        <ParamField body="intervalType" type="string" required default="monthly">
          Posibles valores: 'yearly', 'monthly', 'weekly', 'daily', 'hourly', 'minutely', 'secondly'
        </ParamField>

        <ParamField body="interval" type="number" required default="2" />

        <ParamField body="startDate" type="string" required default="2023-01-01">
          Start date in YYYY-MM-DD format
        </ParamField>

        <ParamField body="startTime" type="string" default="20:45:00">
          Start time in HH:mm:ss format
        </ParamField>

        <ParamField body="endDate" type="string" default="2029-11-01">
          End date in YYYY-MM-DD format
        </ParamField>

        <ParamField body="endTime" type="string" default="18:45:00">
          End time in HH:mm:ss format
        </ParamField>

        <ParamField body="dayOfMonth" type="number" default="15">
          -1, 1, 2, 3, ..., 27, 28
        </ParamField>

        <ParamField body="dayOfWeek" type="string" default="mo">
          Posibles valores: 'mo', 'tu', 'we', 'th', 'fr', 'sa', 'su'
        </ParamField>

        <ParamField body="numOfWeek" type="number" default="-1">
          -1, 1, 2, 3, 4
        </ParamField>

        <ParamField body="monthOfYear" type="string" default="jan">
          Posibles valores: 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'
        </ParamField>

        <ParamField body="count" type="number" default="10">
          Max number of task executions
        </ParamField>

        <ParamField body="daysBefore" type="number" default="5">
          Execute task number of days before
        </ParamField>

        <ParamField body="useStartAsPrimaryUserAccepted" type="boolean" default="True">
          Start as primary user accepted date
        </ParamField>

        <ParamField body="endType" type="string" default="by">
          End type like after, by, count
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="liveMode" type="boolean" required />

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

<ParamField body="items" type="object[]" required>
  <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>
  </Expandable>
</ParamField>

<ParamField body="automaticTaxesEnabled" type="boolean" default="True">
  Automatic taxes enabled for the Invoice
</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" />

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

<ParamField body="tipsConfiguration" type="object">
  Configuration for tips on invoices
</ParamField>

<ParamField body="lateFeesConfiguration" type="object">
  Late fees configuration for the invoices
</ParamField>

<ParamField body="invoiceNumberPrefix" type="string" default="INV-">
  prefix for invoice number
</ParamField>

<ParamField body="paymentMethods" type="object">
  Payment Methods for Invoices
</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 invoice
</ParamField>

## Respuestas

<Accordion title="200 - Successful response">
  <ResponseField name="_id" type="string" required default="6578278e879ad2646715ba9c">
    Schedule Id
  </ResponseField>

  <ResponseField name="status" type="object" required default="draft">
    Schedule Status
  </ResponseField>

  <ResponseField name="liveMode" type="boolean" required default="False">
    Live Mode
  </ResponseField>

  <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="name" type="string" required default="New Invoice">
    Name of the invoice
  </ResponseField>

  <ResponseField name="schedule" type="object">
    <Expandable title="propiedades">
      <ResponseField name="executeAt" type="string" />

      <ResponseField name="rrule" type="object">
        <Expandable title="propiedades">
          <ResponseField name="intervalType" type="string" required default="monthly">
            Posibles valores: 'yearly', 'monthly', 'weekly', 'daily', 'hourly', 'minutely', 'secondly'
          </ResponseField>

          <ResponseField name="interval" type="number" required default="2" />

          <ResponseField name="startDate" type="string" required default="2023-01-01">
            Start date in YYYY-MM-DD format
          </ResponseField>

          <ResponseField name="startTime" type="string" default="20:45:00">
            Start time in HH:mm:ss format
          </ResponseField>

          <ResponseField name="endDate" type="string" default="2029-11-01">
            End date in YYYY-MM-DD format
          </ResponseField>

          <ResponseField name="endTime" type="string" default="18:45:00">
            End time in HH:mm:ss format
          </ResponseField>

          <ResponseField name="dayOfMonth" type="number" default="15">
            -1, 1, 2, 3, ..., 27, 28
          </ResponseField>

          <ResponseField name="dayOfWeek" type="string" default="mo">
            Posibles valores: 'mo', 'tu', 'we', 'th', 'fr', 'sa', 'su'
          </ResponseField>

          <ResponseField name="numOfWeek" type="number" default="-1">
            -1, 1, 2, 3, 4
          </ResponseField>

          <ResponseField name="monthOfYear" type="string" default="jan">
            Posibles valores: 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'
          </ResponseField>

          <ResponseField name="count" type="number" default="10">
            Max number of task executions
          </ResponseField>

          <ResponseField name="daysBefore" type="number" default="5">
            Execute task number of days before
          </ResponseField>

          <ResponseField name="useStartAsPrimaryUserAccepted" type="boolean" default="True">
            Start as primary user accepted date
          </ResponseField>

          <ResponseField name="endType" type="string" default="by">
            End type like after, by, count
          </ResponseField>
        </Expandable>
      </ResponseField>
    </Expandable>
  </ResponseField>

  <ResponseField name="invoices" type="object[]" required>
    List of invoices

    <Expandable title="cada item">
      <ResponseField name="_id" type="string" required default="6578278e879ad2646715ba9c">
        Invoice Id
      </ResponseField>

      <ResponseField name="status" type="string" required default="draft">
        Invoice Status Posibles valores: 'draft', 'sent', 'payment\_processing', 'paid', 'void', 'partially\_paid'
      </ResponseField>

      <ResponseField name="liveMode" type="boolean" required default="False">
        Live Mode
      </ResponseField>

      <ResponseField name="amountPaid" type="number" required default="0">
        Amount Paid
      </ResponseField>

      <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="name" type="string" required default="New Invoice">
        Name of the invoice
      </ResponseField>

      <ResponseField name="businessDetails" type="object" required>
        Business Details
      </ResponseField>

      <ResponseField name="invoiceNumber" type="number" required default="19">
        Invoice Number
      </ResponseField>

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

      <ResponseField name="contactDetails" type="object" required>
        Contact Details
      </ResponseField>

      <ResponseField name="issueDate" type="string" required default="2023-01-01">
        Issue date in YYYY-MM-DD format
      </ResponseField>

      <ResponseField name="dueDate" type="string" required default="2023-01-01">
        Due date in YYYY-MM-DD format
      </ResponseField>

      <ResponseField name="discount" type="object">
        Discount
      </ResponseField>

      <ResponseField name="invoiceItems" type="string[]" required>
        Invoice Items
      </ResponseField>

      <ResponseField name="total" type="number" required default="999">
        Total Amount
      </ResponseField>

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

      <ResponseField name="amountDue" type="number" required default="999">
        Total Amount Due
      </ResponseField>

      <ResponseField name="createdAt" type="string" required default="2023-12-12T09:27:42.355Z">
        created at
      </ResponseField>

      <ResponseField name="updatedAt" type="string" required default="2023-12-12T09:27:42.355Z">
        updated at
      </ResponseField>

      <ResponseField name="automaticTaxesEnabled" type="boolean" default="True">
        Automatic taxes enabled for the Invoice
      </ResponseField>

      <ResponseField name="automaticTaxesCalculated" type="boolean" default="True">
        Is Automatic taxes calculated for the Invoice items
      </ResponseField>

      <ResponseField name="paymentSchedule" type="object">
        split invoice into payment schedule summing up to full invoice amount
      </ResponseField>
    </Expandable>
  </ResponseField>

  <ResponseField name="businessDetails" type="object" required>
    Business Details
  </ResponseField>

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

  <ResponseField name="contactDetails" type="object" required>
    Contact Details
  </ResponseField>

  <ResponseField name="discount" type="object">
    Discount
  </ResponseField>

  <ResponseField name="items" type="string[]" required>
    Invoice Items
  </ResponseField>

  <ResponseField name="total" type="number" required default="999">
    Total Amount
  </ResponseField>

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

  <ResponseField name="termsNotes" type="string" required default="Confidential">
    Terms notes
  </ResponseField>

  <ResponseField name="compiledTermsNotes" type="string" required default="Confidential">
    Compiled terms notes
  </ResponseField>

  <ResponseField name="createdAt" type="string" required default="2023-12-12T09:27:42.355Z">
    created at
  </ResponseField>

  <ResponseField name="updatedAt" type="string" required default="2023-12-12T09:27:42.355Z">
    updated at
  </ResponseField>

  ```json theme={null}
  {
    "_id": "6578278e879ad2646715ba9c",
    "status": "draft",
    "liveMode": false,
    "altId": "6578278e879ad2646715ba9c",
    "altType": "account",
    "name": "New Invoice",
    "schedule": {
      "executeAt": "string",
      "rrule": {
        "intervalType": "monthly",
        "interval": 2,
        "startDate": "2023-01-01",
        "startTime": "20:45:00",
        "endDate": "2029-11-01",
        "endTime": "18:45:00",
        "dayOfMonth": 15,
        "dayOfWeek": "mo",
        "numOfWeek": -1,
        "monthOfYear": "jan",
        "count": 10,
        "daysBefore": 5,
        "useStartAsPrimaryUserAccepted": true,
        "endType": "by"
      }
    },
    "invoices": [
      {
        "_id": "6578278e879ad2646715ba9c",
        "status": "draft",
        "liveMode": false,
        "amountPaid": 0,
        "altId": "6578278e879ad2646715ba9c",
        "altType": "account",
        "name": "New Invoice",
        "businessDetails": {
          "name": "Alex",
          "address": {
            "addressLine1": "9931 Beechwood",
    // truncado: 94 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/schedule' \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -H 'Version: 2021-07-28' \
    -H 'Content-Type: application/json' \
    -d '{
    "altId": "6578278e879ad2646715ba9c",
    "altType": "account",
    "name": "string",
    "contactDetails": {
      "id": "6578278e879ad2646715ba9c",
      "name": "Alex",
      "phoneNo": "+1234567890",
      "email": "alex@example.com",
      "additionalEmails": [
        {
          "email": "alex@example.com"
        }
      ],
      "companyName": "ABC Corp.",
      "address": {
        "addressLine1": "9931 Beechwood",
        "addressLine2": "Beechwood",
        "city": "St. Houston",
        "state": "TX",
        "countryCode": "US",
        "postalCode": "559-6993"
      },
      "customFields": [
        "string"
      ]
    },
    "schedule": {
      "executeAt": "string",
      "rrule": {
        "intervalType": "monthly",
        "interval": 2,
        "startDate": "2023-01-01",
        "startTime": "20:45:00",
        "endDate": "2029-11-01",
        "endTime": "18:45:00",
        "dayOfMonth": 15,
        "dayOfWeek": "mo",
        "numOfWeek": -1,
        "monthOfYear": "jan",
        "count": 10,
        "daysBefore": 5,
        "useStartAsPrimaryUserAccepted": true,
        "endType": "by"
      }
    },
    "liveMode": true,
    "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": "string",
    "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
      }
    ],
    "automaticTaxesEnabled": true,
    "discount": {
      "value": 10,
      "type": "percentage",
      "validOnProductIds": "[ '6579751d56f60276e5bd4154' ]"
    },
    "termsNotes": "string",
    "title": "string",
    "invoiceNumberPrefix": "INV-",
    "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/schedule', {
    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": "string", "contactDetails": {"id": "6578278e879ad2646715ba9c", "name": "Alex", "phoneNo": "+1234567890", "email": "alex@example.com", "additionalEmails": [{"email": "alex@example.com"}], "companyName": "ABC Corp.", "address": {"addressLine1": "9931 Beechwood", "addressLine2": "Beechwood", "city": "St. Houston", "state": "TX", "countryCode": "US", "postalCode": "559-6993"}, "customFields": ["string"]}, "schedule": {"executeAt": "string", "rrule": {"intervalType": "monthly", "interval": 2, "startDate": "2023-01-01", "startTime": "20:45:00", "endDate": "2029-11-01", "endTime": "18:45:00", "dayOfMonth": 15, "dayOfWeek": "mo", "numOfWeek": -1, "monthOfYear": "jan", "count": 10, "daysBefore": 5, "useStartAsPrimaryUserAccepted": true, "endType": "by"}}, "liveMode": true, "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": "string", "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}], "automaticTaxesEnabled": true, "discount": {"value": 10, "type": "percentage", "validOnProductIds": "[ '6579751d56f60276e5bd4154' ]"}, "termsNotes": "string", "title": "string", "invoiceNumberPrefix": "INV-", "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(
      'POST',
      'https://services.leadconnectorhq.com/invoices/schedule',
      headers={
          'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
          'Version': '2021-07-28',
          'Content-Type': 'application/json',
      },
      json={"altId": "6578278e879ad2646715ba9c", "altType": "account", "name": "string", "contactDetails": {"id": "6578278e879ad2646715ba9c", "name": "Alex", "phoneNo": "+1234567890", "email": "alex@example.com", "additionalEmails": [{"email": "alex@example.com"}], "companyName": "ABC Corp.", "address": {"addressLine1": "9931 Beechwood", "addressLine2": "Beechwood", "city": "St. Houston", "state": "TX", "countryCode": "US", "postalCode": "559-6993"}, "customFields": ["string"]}, "schedule": {"executeAt": "string", "rrule": {"intervalType": "monthly", "interval": 2, "startDate": "2023-01-01", "startTime": "20:45:00", "endDate": "2029-11-01", "endTime": "18:45:00", "dayOfMonth": 15, "dayOfWeek": "mo", "numOfWeek": -1, "monthOfYear": "jan", "count": 10, "daysBefore": 5, "useStartAsPrimaryUserAccepted": true, "endType": "by"}}, "liveMode": true, "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": "string", "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}], "automaticTaxesEnabled": true, "discount": {"value": 10, "type": "percentage", "validOnProductIds": "[ '6579751d56f60276e5bd4154' ]"}, "termsNotes": "string", "title": "string", "invoiceNumberPrefix": "INV-", "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/schedule');
  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': 'string', 'contactDetails': {'id': '6578278e879ad2646715ba9c', 'name': 'Alex', 'phoneNo': '+1234567890', 'email': 'alex@example.com', 'additionalEmails': [{'email': 'alex@example.com'}], 'companyName': 'ABC Corp.', 'address': {'addressLine1': '9931 Beechwood', 'addressLine2': 'Beechwood', 'city': 'St. Houston', 'state': 'TX', 'countryCode': 'US', 'postalCode': '559-6993'}, 'customFields': ['string']}, 'schedule': {'executeAt': 'string', 'rrule': {'intervalType': 'monthly', 'interval': 2, 'startDate': '2023-01-01', 'startTime': '20:45:00', 'endDate': '2029-11-01', 'endTime': '18:45:00', 'dayOfMonth': 15, 'dayOfWeek': 'mo', 'numOfWeek': -1, 'monthOfYear': 'jan', 'count': 10, 'daysBefore': 5, 'useStartAsPrimaryUserAccepted': true, 'endType': 'by'}}, 'liveMode': true, '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': 'string', '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}], 'automaticTaxesEnabled': true, 'discount': {'value': 10, 'type': 'percentage', 'validOnProductIds': '[ '6579751d56f60276e5bd4154' ]'}, 'termsNotes': 'string', 'title': 'string', 'invoiceNumberPrefix': 'INV-', 'attachments': [{'id': '6241712be68f7a98102ba272', 'name': 'Electronics.pdf', 'url': 'https://example.com/digital-delivery', 'type': 'string', 'size': 10000}]}),
  ]);
  $data = json_decode(curl_exec($ch), true);
  ```
</CodeGroup>
