> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# ScheduleDelivery

# Package: onlineOrders

# Namespace: RestaurantsDeliveryDispatcher

# Method link: https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/delivery-orders/schedule-delivery.md

## Permission Scopes:
Manage Orders: SCOPE.DC-RESTAURANTS.MANAGE-ORDERS

## Introduction

Schedules a courier delivery for a Wix Restaurants order with a delivery provider.

The delivery is built from the order: the pickup location is the order's business location, the drop-off address is the order's shipping address, and the order's delivery instructions are passed to the courier as pickup instructions. If the order has no instructions, the courier pickup instructions set on the restaurant's delivery fulfillment method may be used instead. Specify either a pickup time or a drop-off time, and the provider estimates the other.

Before you call this method, make sure that:
- The order is a delivery order whose fulfillment method uses the delivery provider.
- The provider is connected and active for the order's business location. To check, call [List Delivery Providers](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/delivery-orders/list-delivery-providers.md).
- The pickup or drop-off time is in the future.

Currently supports a single provider, DoorDash.

When the delivery is scheduled, the Delivery Created event is triggered.

The method returns these errors in addition to the ones listed below:
- `INVALID_ARGUMENT` when `providerAppDefId` isn't a supported delivery provider, or when the pickup or drop-off time has passed.
- `NOT_FOUND` when the order doesn't exist.

---

## REST API

### Schema

```
 Method: scheduleDelivery
 Description: Schedules a courier delivery for a Wix Restaurants order with a delivery provider.  The delivery is built from the order: the pickup location is the order's business location, the drop-off address is the order's shipping address, and the order's delivery instructions are passed to the courier as pickup instructions. If the order has no instructions, the courier pickup instructions set on the restaurant's delivery fulfillment method may be used instead. Specify either a pickup time or a drop-off time, and the provider estimates the other.  Before you call this method, make sure that: - The order is a delivery order whose fulfillment method uses the delivery provider. - The provider is connected and active for the order's business location. To check, call [List Delivery Providers](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/delivery-orders/list-delivery-providers.md). - The pickup or drop-off time is in the future.  Currently supports a single provider, DoorDash.  When the delivery is scheduled, the Delivery Created event is triggered.  The method returns these errors in addition to the ones listed below: - `INVALID_ARGUMENT` when `providerAppDefId` isn't a supported delivery provider, or when the pickup or drop-off time has passed. - `NOT_FOUND` when the order doesn't exist.
 URL: https://www.wixapis.com/restaurants/deliveries/v1/deliveries/schedule-delivery
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  wixOrderId, providerAppDefId
 Method parameters: 
    - ONE-OF: 
     - name: pickupTime | type: string | description: Date and time the courier should pick up the order from the restaurant. Must be in the future.  | validation: format date-time
     - name: dropOffTime | type: string | description: Date and time the order should be delivered to the customer. Must be in the future.  | validation: format date-time
   param name: providerAppDefId | type: providerAppDefId | description: App GUID of the delivery provider. To retrieve it, call [List Delivery Providers](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/delivery-orders/list-delivery-providers.md). | required: true | validation: format GUID
   param name: wixOrderId | type: wixOrderId | description: GUID of the eCommerce order to deliver ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/orders/introduction.md) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/orders/orders/introduction.md)). | required: true | validation: format GUID
 Return type: ScheduleDeliveryResponse
  - name: externalDeliveryId | type: string | description: GUID of the delivery with the delivery provider. Matches the Wix order GUID.  | validation: format GUID
  - name: pickupTime | type: string | description: Date and time the provider estimates the courier picks up the order. Can differ from the requested pickup time.  | validation: format date-time
  - name: dropOffTime | type: string | description: Date and time the provider estimates the order is delivered. Can differ from the requested drop-off time.  | validation: format date-time

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: DOORDASH_FIELD_VALIDATION_ERROR | Description: Not currently returned. When the delivery provider rejects a value from the order, such as the drop-off address, phone number, or tip, the method returns `DELIVERY_REJECTED` with the matching `INVALID_*` reason.
   HTTP Code: 409 | Status Code: ALREADY_EXISTS | Application Code: DUPLICATE_DELIVERY_ID | Description: Not currently returned. When a delivery already exists for the order, the method returns `DELIVERY_REJECTED` with the `DUPLICATE_DELIVERY_ID` reason.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: TEST_ORDER_CANNOT_BE_DISPATCHED | Description: The order is a test order and can't be sent to a delivery provider.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: DELIVERY_REJECTED | Description: The delivery provider rejected the delivery. The `reasons` array in the error details lists why, for example `DISTANCE_TOO_LONG`, `DUPLICATE_DELIVERY_ID`, or `INVALID_DROPOFF_ADDRESS`.


```

### Examples

### Schedule a delivery by pickup time
Schedules a DoorDash delivery for an order, with the courier picking up the order at the requested time.

```curl
curl -X POST \
'https://www.wixapis.com/restaurants/deliveries/v1/deliveries/schedule-delivery' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{
  "wixOrderId": "9b2e7c41-5d3a-4f86-b1e0-6a8c2f47d953",
  "providerAppDefId": "f16eb5e7-b8c3-46bf-adff-9fb154325c60",
  "pickupTime": "2026-12-01T18:30:00.000Z"
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.restaurants.deliveryOrders.scheduleDelivery(wixOrderId, options)
 Description: Schedules a courier delivery for a Wix Restaurants order with a delivery provider.  The delivery is built from the order: the pickup location is the order's business location, the drop-off address is the order's shipping address, and the order's delivery instructions are passed to the courier as pickup instructions. If the order has no instructions, the courier pickup instructions set on the restaurant's delivery fulfillment method may be used instead. Specify either a pickup time or a drop-off time, and the provider estimates the other.  Before you call this method, make sure that: - The order is a delivery order whose fulfillment method uses the delivery provider. - The provider is connected and active for the order's business location. To check, call [List Delivery Providers](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/delivery-orders/list-delivery-providers.md). - The pickup or drop-off time is in the future.  Currently supports a single provider, DoorDash.  When the delivery is scheduled, the Delivery Created event is triggered.  The method returns these errors in addition to the ones listed below: - `INVALID_ARGUMENT` when `providerAppDefId` isn't a supported delivery provider, or when the pickup or drop-off time has passed. - `NOT_FOUND` when the order doesn't exist.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  wixOrderId, options.providerAppDefId, options
 Method parameters: 
   param name: wixOrderId | type: string | description: GUID of the eCommerce order to deliver ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/orders/introduction.md) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/orders/orders/introduction.md)). | required: true | validation: format GUID
   param name: options | type: ScheduleDeliveryOptions  none | required: true 
    - ONE-OF: - required: true
     - name: pickupTime | type: Date | description: Date and time the courier should pick up the order from the restaurant. Must be in the future.  
     - name: dropOffTime | type: Date | description: Date and time the order should be delivered to the customer. Must be in the future.  
        - name: providerAppDefId | type: string | description: App GUID of the delivery provider. To retrieve it, call [List Delivery Providers](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/delivery-orders/list-delivery-providers.md). | required: true | validation: format GUID
 Return type: PROMISE<ScheduleDeliveryResponse>
  - name: externalDeliveryId | type: string | description: GUID of the delivery with the delivery provider. Matches the Wix order GUID.  | validation: format GUID
  - name: pickupTime | type: Date | description: Date and time the provider estimates the courier picks up the order. Can differ from the requested pickup time.  
  - name: dropOffTime | type: Date | description: Date and time the provider estimates the order is delivered. Can differ from the requested drop-off time.  

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: DOORDASH_FIELD_VALIDATION_ERROR | Description: Not currently returned. When the delivery provider rejects a value from the order, such as the drop-off address, phone number, or tip, the method returns `DELIVERY_REJECTED` with the matching `INVALID_*` reason.
   HTTP Code: 409 | Status Code: ALREADY_EXISTS | Application Code: DUPLICATE_DELIVERY_ID | Description: Not currently returned. When a delivery already exists for the order, the method returns `DELIVERY_REJECTED` with the `DUPLICATE_DELIVERY_ID` reason.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: TEST_ORDER_CANNOT_BE_DISPATCHED | Description: The order is a test order and can't be sent to a delivery provider.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: DELIVERY_REJECTED | Description: The delivery provider rejected the delivery. The `reasons` array in the error details lists why, for example `DISTANCE_TOO_LONG`, `DUPLICATE_DELIVERY_ID`, or `INVALID_DROPOFF_ADDRESS`.


```

### Examples

### Schedule a delivery by pickup time
Schedules a DoorDash delivery for an order, with the courier picking up the order at the requested time.

```javascript
import { deliveryOrders } from "@wix/restaurants";

async function scheduleDelivery() {
  const response = await deliveryOrders.scheduleDelivery(
    "9b2e7c41-5d3a-4f86-b1e0-6a8c2f47d953",
    {
      providerAppDefId: "f16eb5e7-b8c3-46bf-adff-9fb154325c60",
      pickupTime: new Date("2026-12-01T18:30:00.000Z"),
    },
  );
}

/* Promise resolves to:
 * {
 *   "externalDeliveryId": "9b2e7c41-5d3a-4f86-b1e0-6a8c2f47d953",
 *   "pickupTime": "2026-12-01T18:32:00.000Z",
 *   "dropOffTime": "2026-12-01T18:55:00.000Z"
 * }
 */

```

### scheduleDelivery (self-managed)
Self-managed SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { deliveryOrders } from '@wix/restaurants';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { deliveryOrders },
  // Include the auth strategy and host as relevant
});


async function scheduleDelivery(wixOrderId,options) {
  const response = await myWixClient.deliveryOrders.scheduleDelivery(wixOrderId,options);
};
```

---