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

# API Overview

> Optimize vehicle routes and deliveries with Solvice's powerful Vehicle Routing Problem solver

The Vehicle Routing Problem (VRP) API helps you optimize delivery routes, service appointments, and resource allocation. It finds the most efficient way to assign jobs to vehicles while respecting constraints like time windows, vehicle capacity, and driver skills.

<Info>
  The VRP solver handles complex real-world scenarios including multi-day planning, pickup & delivery, and route balancing.
</Info>

## Core Capabilities

<CardGroup cols={3}>
  <Card title="Route Optimization" icon="route">
    Find optimal sequences for deliveries and service calls
  </Card>

  <Card title="Resource Management" icon="users">
    Assign the right vehicles and drivers to each job
  </Card>

  <Card title="Constraint Handling" icon="shield-check">
    Respect time windows, capacities, skills, and preferences
  </Card>
</CardGroup>

## API Endpoints

The VRP API provides three types of operations:

### Optimization Actions

<Tabs>
  <Tab title="Solve">
    ```bash theme={null}
    POST /v2/vrp/solve
    ```

    Finds the optimal solution for your routing problem. This is the main endpoint for route optimization.

    <Tip>
      Use this for daily route planning, delivery optimization, and service scheduling.
    </Tip>
  </Tab>

  <Tab title="Evaluate">
    ```bash theme={null}
    POST /v2/vrp/evaluate
    ```

    Scores an existing solution without optimization. Useful for comparing manual routes against optimal ones.
  </Tab>

  <Tab title="Suggest">
    ```bash theme={null}
    POST /v2/vrp/suggest
    ```

    Suggests the best position for a single new job within existing routes. Perfect for dynamic insertions.
  </Tab>
</Tabs>

### Result Retrieval

Once you've submitted a request, retrieve results using these endpoints:

<ParamField path="job_id" type="string" required>
  The unique identifier returned when you submit a request
</ParamField>

<CodeGroup>
  ```bash Status Check theme={null}
  GET /v2/vrp/jobs/{job_id}/status
  ```

  ```bash Get Solution theme={null}
  GET /v2/vrp/jobs/{job_id}/solution
  ```

  ```bash Get Explanation theme={null}
  GET /v2/vrp/jobs/{job_id}/explanation
  ```
</CodeGroup>

## How It Works

<Steps>
  <Step title="Submit Request">
    Send your routing problem with resources (vehicles) and jobs (deliveries) to the solve endpoint.

    ```json theme={null}
    {
      "resources": [...],
      "jobs": [...],
      "options": {...}
    }
    ```
  </Step>

  <Step title="Monitor Progress">
    Check the job status while the solver optimizes your routes.

    ```json theme={null}
    {
      "id": "job_123",
      "status": "SOLVING",
      "progress": 45
    }
    ```
  </Step>

  <Step title="Retrieve Solution">
    Get the optimized routes once the solver completes.

    ```json theme={null}
    {
      "trips": [...],
      "score": {...},
      "status": "SOLVED"
    }
    ```
  </Step>
</Steps>

## Key Features

<AccordionGroup>
  <Accordion title="Real-World Distance Calculation">
    * Integration with OSM for actual road distances
    * Support for custom distance matrices
    * Fallback to haversine calculations
  </Accordion>

  <Accordion title="Advanced Constraints">
    * Time windows (hard and soft)
    * Vehicle capacity (volume, weight, count)
    * Driver skills and certifications
    * Preferred resources
    * Service dependencies
  </Accordion>

  <Accordion title="Multi-Day Planning">
    * Plan routes across multiple days
    * Handle recurring appointments
    * Balance workload over planning periods
  </Accordion>

  <Accordion title="Dynamic Updates">
    * Add jobs to existing routes
    * Handle cancellations and changes
    * Real-time route adjustments
  </Accordion>
</AccordionGroup>

## Common Use Cases

<CardGroup cols={2}>
  <Card title="Last-Mile Delivery" icon="truck">
    Optimize delivery routes for e-commerce, food delivery, and courier services
  </Card>

  <Card title="Field Service" icon="wrench">
    Schedule technicians for installations, repairs, and maintenance visits
  </Card>

  <Card title="Transportation" icon="bus">
    Plan pickup/delivery routes for passengers or goods
  </Card>

  <Card title="Healthcare" icon="heart">
    Route nurses and caregivers for home visits
  </Card>
</CardGroup>

## Quick Start

<Note>
  Need an API key? [Contact us](https://solvice.io/contact) to get started.
</Note>

Ready to optimize your first route?

<Card title="VRP Quickstart Guide" icon="rocket" href="/guides/vrp/quickstart">
  Solve your first routing problem in under 5 minutes
</Card>

## Additional Resources

<CardGroup cols={3}>
  <Card title="API Reference" icon="code" href="/api-reference/vrp/solve">
    Detailed endpoint documentation
  </Card>

  <Card title="Examples" icon="lightbulb" href="/guides/vrp/examples">
    Real-world routing scenarios
  </Card>

  <Card title="Performance Guide" icon="star" href="/guides/vrp/concepts/performance-guide">
    Tips for optimal results
  </Card>
</CardGroup>
