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

# Transport & Delivery

> Learn how to use Transport & Delivery workflows.

export const HeroContent = ({children, withGrid}) => <div>
    <div className="not-prose relative bg-gray-50/50 rounded-xl overflow-hidden dark:bg-gray-800/25">
      {withGrid && <div className="absolute grid content-center inset-0 bg-grid-neutral-200/20 [mask-image:linear-gradient(0deg,#fff,rgba(255,255,255,0.6))] dark:bg-grid-white/5 dark:[mask-image:linear-gradient(0deg,rgba(255,255,255,0.1),rgba(255,255,255,0.5))]" style={{
  backgroundPosition: '10px 10px',
  color: '#070712'
}}></div>}
      <div className="relative rounded-xl overflow-hidden flex justify-center">{children}</div>
      <div className="absolute inset-0 pointer-events-none border border-black/5 rounded-xl dark:border-white/5"></div>
    </div>
  </div>;

## Overview

Drivly's Transport & Delivery API simplifies the complex process of managing vehicle transport
and delivery services, offering a straightforward solution for obtaining quotes and placing
orders.

It's designed to enhance operational efficiency, reduce costs, and ensure high-quality
service. With customizable UI components, businesses can seamlessly integrate transportation capabilities into their products and gain access to a network of professional service providers, ensuring prompt and exceptional care for their vehicles.

## Types of Transportation

<Tabs>
  <Tab title="Long Haul">
    <br />

    ```mermaid theme={null}
      flowchart LR
        id1([Miami, FL 33132]) --->|1791 mi| id2([Minneapolis, MN 55435])
          style id1 stroke:#121212,stroke-width:1px
          style id2 stroke:#121212,stroke-width:1px
    ```

    Transport vehicles over long distances, typically between cities or states.
  </Tab>

  <Tab title="Last Mile">
    <br />

    ```mermaid theme={null}
      flowchart LR
        id1([Auction]) -.-> id2([Service Center]) --> id3([Customer])
          style id1 stroke:#121212,stroke-width:1px
          style id2 stroke:#121212,stroke-width:1px
          style id3 stroke:#121212,stroke-width:1px
    ```

    Deliver vehicles from a local hub to their final destination.
  </Tab>

  <Tab title="Valet">
    <br />

    ```mermaid theme={null}
      flowchart LR
        id1([Pick up]) --> id2([Delivery])
          style id1 stroke:#121212,stroke-width:1px
          style id2 stroke:#121212,stroke-width:1px
    ```

    Provide door-to-door vehicle transport services with personalized care.
  </Tab>

  <Tab title="Tow">
    <br />

    ```mermaid theme={null}
    flowchart LR
      id1([372 Wayside Dr, 94601]) --> id2([Mechanical Repair])
        style id1 stroke:#121212,stroke-width:1px
        style id2 stroke:#121212,stroke-width:1px
    ```

    Move vehicles short distances, often for emergency or vehicle breakdown situations.
  </Tab>
</Tabs>

***

## Workflows

The Transport & Delivery API facilitates two primary types of transportation and delivery services: `Quote` and `Order` vehicle transportation services.

### Quote Transport & Delivery

Retrieve instant cost estimates for transporting and delivering vehicles over any distances.

<Accordion title="Create Quote">
  You can obtain a quote for a Wash & Detail service, including all of our different tiers of service.
  The quote will return with a checkout link, which you should redirect the customer towards.
  Once the customer has paid, a service order will be created with the details of the quote.

  <Info>
    Attaching a deal to a quote will allow you to track all services related to that specific deal.
    The final invoice for the deal will include this quote, but will state that it was paid for
    separately.
  </Info>

  ```json Create Quote theme={null}
  {
    "type": "transport-&-delivery",
    "vin": "WP0AF2A99KS165242",
    "fromZip": "60695",
    "toZip": "55379",
    "deal": "deal_9f8Y7c" // Optional, but recommended
  }
  ```

  ```json Example Response theme={null}
  {
    "id": "quote_af87Yd",
    "deal": "deal_9f8Y7c",
    "status": "awaiting-payment",
    "estimatedTime": "2024-01-01T12:00:00Z",
    "checkoutLink": "https://checkout.driv.ly/quote_af87Yd",
    "paid": false,
    "total": 796.5,
    "items": [
      {
        "service": "transport-&-delivery",
        "price": 796.5,
        "name": "Transport & Delivery",
        "description": "Transport and delivery for WP0AF2A99KS165242",
        "fromZip": "60695",
        "toZip": "55379",
        "distance": 429,
        "eta": {
          "min": 2,
          "max": 3
        },
        "expiration": "2024-05-03T20:21:08.8439704+00:00"
      }
    ]
  }
  ```

  Upon payment, a service order will be generated with all pertinent details and an estimated completion time. Progress of the service order can be monitored using [webhooks](#webhooks), ensuring timely updates throughout the transport and delivery process.
</Accordion>

### Order Transport & Delivery

Easily order transportation and delivery to meet precise delivery standards and deadlines.

<Accordion title="Place Order">
  Creating a service order for transport and delivery services allows you to schedule, and pay for the service directly. This will create a service order which can be used to track progress of your vehicle's transport and delivery.

  <Info>
    For service orders, attaching a deal is highly recommended as this will allow you to keep all
    pending invoices in one place. The final invoice for the deal will include this order, but is
    rolled up into the total cost of the deal.
  </Info>

  To place an order, you can submit a request with the following information:

  ```json Create Order theme={null}
  {
    "type": "transport-&-delivery",
    "vin": "WP0AF2A99KS165242",
    "deal": "deal_9f8Y7c"
  }
  ```

  ```json Example Response theme={null}
  {
    "id": "order_fcx8YdY2lM2zjR",
    "deal": "deal_9f8Y7c",
    "status": "pending",
    "estimatedTime": "2024-01-01T12:00:00Z",
    "receiptLink": "https://checkout.driv.ly/order_fcx8YdY2lM2zjR",
    "paid": true,
    "total": 796.5,
    "items": [
      {
        "service": "transport-&-delivery",
        "price": 796.5,
        "name": "Transport & Delivery",
        "description": "Transport and delivery for WP0AF2A99KS165242",
        "fromZip": "60695",
        "toZip": "55379",
        "distance": 429,
        "eta": {
          "min": 2,
          "max": 3
        }
      }
    ]
  }
  ```

  You'll be notified of the service order's status via [webhooks](#webhooks), ensuring you're always up-to-date on the progress of your vehicle's transport and delivery.
</Accordion>

***

## Webhooks

`service.created` - This event is triggered when a service order is created, providing you with the details of the order:

```json theme={null}
{
  "event": "service.created",
  "type": "transport-&-delivery",
  "data": {
    "id": "order_fcx8YdY2lM2zjR",
    "deal": "deal_9f8Y7c",
    "status": "pending", // pending, in-progress, completed, delayed, canceled
    "estimatedTime": "2024-01-01T12:00:00Z",
    "receiptLink": "https://checkout.driv.ly/order_fcx8YdY2lM2zjR",
    "paid": true,
    "total": 796.5,
    "items": [
      {
        "service": "transport-&-delivery",
        "price": 796.5,
        "name": "Transport & Delivery",
        "description": "Transport and delivery for WP0AF2A99KS165242",
        "fromZip": "60695",
        "toZip": "55379",
        "distance": 429,
        "eta": {
          "min": 2,
          "max": 3
        }
      }
    ],
    "history": [
      // An Array to show the keys changed and when
      {
        "status": "pending",
        "paid": true,
        "time": "2024-01-01T12:00:00Z"
      }
    ]
  }
}
```

`service.updated` - This event is triggered when a service order is updated, for example, when we have picked up the vehicle and are in transit or when the service has an issue:

```json theme={null}
{
  "event": "service.updated",
  "type": "transport-&-delivery",
  "data": {
    "id": "order_fcx8YdY2lM2zjR",
    "deal": "deal_9f8Y7c",
    "status": "in-progress",
    "estimatedTime": "2024-01-01T12:00:00Z",
    "receiptLink": "https://checkout.driv.ly/order_fcx8YdY2lM2zjR",
    "paid": true,
    "total": 796.5,
    "items": [
      {
        "service": "transport-&-delivery",
        "price": 796.5,
        "name": "Transport & Delivery",
        "description": "Transport and delivery for WP0AF2A99KS165242",
        "fromZip": "60695",
        "toZip": "55379",
        "distance": 429,
        "eta": {
          "min": 2,
          "max": 3
        }
      }
    ],
    "history": [
      {
        "status": "pending",
        "paid": true,
        "time": "2024-01-01T12:00:00Z"
      },
      {
        "status": "in-progress",
        "time": "2024-01-02T12:00:00Z"
      }
    ]
  }
}
```

`service.completed` - This event is triggered when a service order is completed:

```json theme={null}
{
  "event": "service.completed",
  "type": "transport-&-delivery",
  "data": {
    "id": "order_fcx8YdY2lM2zjR",
    "deal": "deal_9f8Y7c",
    "status": "completed",
    "estimatedTime": "2024-01-01T12:00:00Z",
    "receiptLink": "https://checkout.driv.ly/order_fcx8YdY2lM2zjR",
    "paid": true,
    "total": 796.5,
    "items": [
      {
        "service": "transport-&-delivery",
        "price": 796.5,
        "name": "Transport & Delivery",
        "description": "Transport and delivery for WP0AF2A99KS165242",
        "fromZip": "60695",
        "toZip": "55379",
        "distance": 429
      }
    ],
    "history": [
      {
        "status": "pending",
        "paid": true,
        "time": "2024-01-01T12:00:00Z"
      },
      {
        "status": "in-progress",
        "time": "2024-01-02T12:00:00Z"
      },
      {
        "status": "completed",
        "time": "2024-01-04T12:00:00Z"
      }
    ]
  }
}
```

***

## Next Steps

Ready to get started with Transport & Delivery API?

<CardGroup cols={2}>
  <Card title="Quote – Transport & Delivery" icon="square-quote" href="/services/reference/service-quote">
    Quote transport and delivery services
  </Card>

  <Card title="Order – Transport & Delivery" icon="money-bill-wave" href="/services/reference/service-order/create-a-new-service-order">
    Order transport and delivery services
  </Card>
</CardGroup>
