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

# Title & Registration

> Learn how to use Title & Registration workflows.

## Overview

Drivly's Title & Registration API simplifies the complex process of managing vehicle titles and
registrations, offering a straightforward solution for obtaining quotes and placing orders.

***

## Workflows

The API provides facilitate two primary functions, `Quote` and `Order` title and registration services.

### Quote Title & Registration

Obtain accurate quotes for complete title and registration, title transfers, registration renewals, and duplicate titles.

<Accordion title="Create Quote">
  A quote is used to pass the cost to the customer, and to allow them to pay for the service.
  The quote will return with a checkout link, which you should redirect the customer towards.

  <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": "title-&-registration",
    "services": ["title-transfer", "registration-renewal"],
    "vin": "WP0AF2A99KS165242"
  }
  ```

  ```json Example Response theme={null}
  {
    "id": "quote_Ma7Y7c",
    "status": "awaiting-payment",
    "estimatedTime": "2024-01-01T12:00:00Z",
    "checkoutLink": "https://checkout.driv.ly/quote_Ma7Y7c",
    "paid": false,
    "total": 130,
    "items": [
      {
        "service": "title-&-registration",
        "price": 40,
        "name": "Title Transfer for WP0AF2A99KS165242",
        "description": "title transfer",
        "quantity": 1
      },
      {
        "service": "title-&-registration",
        "price": 90,
        "name": "Registration Renewal for WP0AF2A99KS165242",
        "description": "registration renewal",
        "quantity": 1
      }
    ]
  }
  ```

  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 title and registration process.
</Accordion>

### Order Title & Registration

Place orders for title and registration services, ensuring vehicles are properly registered and compliant with state regulations.

<Accordion title="Create Order">
  Creating an order will allow you to start the process of title and registration services. The order will be created with the details of the quote, and will be updated as the service progresses.

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

  ```json Create Order theme={null}
  {
    "type": "title-&-registration",
    "services": ["title-transfer", "registration-renewal"],
    "quoteId": "quote_Ma7Y7c",
    "dealId": "deal_1a2b3c4d5e", // Optional, but recommended
    "vin": "WP0AF2A99KS165242"
  }
  ```

  ```json Example Response theme={null}
  {
    "id": "order_PUjabSbTExm1Ac",
    "dealId": "deal_1a2b3c4d5e", // Null if not provided
    "status": "pending",
    "estimatedTime": "2024-01-01T12:00:00Z",
    "receiptLink": "https://checkout.driv.ly/order_PUjabSbTExm1Ac",
    "paid": true, // Will always be true for orders
    "total": 130,
    "items": [
      {
        "service": "title-&-registration",
        "price": 40,
        "name": "Title Transfer for WP0AF2A99KS165242",
        "description": "title transfer",
        "quantity": 1
      },
      {
        "service": "title-&-registration",
        "price": 90,
        "name": "Registration Renewal for WP0AF2A99KS165242",
        "description": "registration renewal",
        "quantity": 1
      }
    ]
  }
  ```

  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 title and registration services.
</Accordion>

***

## Typical Progression

Lets go over the typical progression of a title and registration service order. While these steps are
typical, there may be issues, delays, or other factors that can affect the progression of your service order.

If any problems arise, the service order's status will be updated to either `delayed` or `canceled`, and you
will be notified of the issue via email and webhook.

<Steps>
  <Step title="After payment is successful">
    A service order is created with the details of your quote, including the estimated time and cost.

    The service order will start in the `pending` status, this means that its just waiting for the team to pick up the vehicle, and start work.
  </Step>

  <Step title="After some time has passed">
    The service provider will begin working on your vehicle, ensuring it receives the care it needs.

    The service order will be updated to include the status of the service, moving from `pending` to `in-progress`.
  </Step>

  <Step title="Work is completed">
    Once the service is completed, the service order will be updated to reflect the status of the service.

    After work is completed, the service order will be updated to include the status of the service, moving from `in-progress` to `completed`.
  </Step>
</Steps>

***

## 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": "title-&-registration",
  "data": {
    "id": "order_PUjabSbTExm1Ac",
    "dealId": "deal_1a2b3c4d5e",
    "status": "pending", // pending, in-progress, completed, delayed, canceled
    "estimatedTime": "2024-01-01T12:00:00Z",
    "receiptLink": "https://checkout.driv.ly/order_PUjabSbTExm1Ac",
    "paid": true,
    "total": 130,
    "items": [
      {
        "service": "title-&-registration",
        "price": 40,
        "name": "Title Transfer for WP0AF2A99KS165242",
        "description": "title transfer",
        "quantity": 1
      },
      {
        "service": "title-&-registration",
        "price": 90,
        "name": "Registration Renewal for WP0AF2A99KS165242",
        "description": "registration renewal",
        "quantity": 1
      }
    ],
    "history": [
      {
        "status": "pending",
        "paid": true,
        "timestamp": "2024-01-01T12:00:00Z"
      }
    ]
  }
}
```

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

```json theme={null}
{
  "event": "service.updated",
  "type": "title-&-registration",
  "data": {
    "id": "order_PUjabSbTExm1Ac",
    "dealId": "deal_1a2b3c4d5e",
    "status": "in-progress",
    "estimatedTime": "2024-01-01T12:00:00Z",
    "receiptLink": "https://checkout.driv.ly/order_PUjabSbTExm1Ac",
    "paid": true,
    "total": 130,
    "items": [
      {
        "service": "title-&-registration",
        "price": 40,
        "name": "Title Transfer for WP0AF2A99KS165242",
        "description": "title transfer",
        "quantity": 1
      },
      {
        "service": "title-&-registration",
        "price": 90,
        "name": "Registration Renewal for WP0AF2A99KS165242",
        "description": "registration renewal",
        "quantity": 1
      }
    ],
    "history": [
      {
        "status": "pending",
        "paid": true,
        "timestamp": "2024-01-01T12:00:00Z"
      },
      {
        "status": "in-progress",
        "timestamp": "2024-01-02T12:00:00Z"
      }
    ]
  }
}
```

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

```json theme={null}
{
  "event": "service.completed",
  "type": "title-&-registration",
  "data": {
    "id": "order_PUjabSbTExm1Ac",
    "dealId": "deal_1a2b3c4d5e",
    "status": "completed",
    "estimatedTime": "2024-01-01T12:00:00Z",
    "receiptLink": "https://checkout.driv.ly/order_PUjabSbTExm1Ac",
    "paid": true,
    "total": 130,
    "items": [
      {
        "service": "title-&-registration",
        "price": 40,
        "name": "Title Transfer for WP0AF2A99KS165242",
        "description": "title transfer",
        "quantity": 1
      },
      {
        "service": "title-&-registration",
        "price": 90,
        "name": "Registration Renewal for WP0AF2A99KS165242",
        "description": "registration renewal",
        "quantity": 1
      }
    ],
    "history": [
      {
        "status": "pending",
        "paid": true,
        "timestamp": "2024-01-01T12:00:00Z"
      },
      {
        "status": "in-progress",
        "timestamp": "2024-01-02T12:00:00Z"
      },
      {
        "status": "completed",
        "timestamp": "2024-01-03T12:00:00Z"
      }
    ]
  }
}
```

***

## Next Steps

Ready to get started with Title & Registration API?

<CardGroup cols={2}>
  <Card title="Quote – Title & Registration" icon="square-quote" href="/services/reference/service-quote">
    Quote title and registration services
  </Card>

  <Card title="Order – Title & Registration" icon="money-bill-wave" href="/services/reference/service-order/create-a-new-service-order">
    Order title and registration services
  </Card>
</CardGroup>
