moovexDocs

Quickstart

Set up your first Fleet Orchestrator operation and create your first trip

Quickstart

Get started with Fleet Orchestrator by setting up a basic operation and routing your first reservations.

Prerequisites

  • API credentials (contact us at moovex.ai/contact to get access)
  • A tool to make HTTP requests (curl, Postman, or your preferred HTTP client)

Base URL

All API requests are made to:

https://api.moovex.ai/api/v1

Authentication

Fleet Orchestrator uses token-based authentication. First, obtain an access token:

curl -X POST https://api.moovex.ai/api/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "your-email@example.com",
    "password": "your-password"
  }'

Response:

{
  "accessToken": "eyJhbGciOiJIUzI1NiIs...",
  "refreshToken": "eyJhbGciOiJIUzI1NiIs...",
  "expiresIn": 3600
}

Include the access token in subsequent requests:

Authorization: Bearer YOUR_ACCESS_TOKEN

Step 1: Get Your Site

Your account is pre-configured with a company and site. List your sites:

curl https://api.moovex.ai/api/v1/sites \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Note the _id of your site - you'll need it for creating resources.

Step 2: Create a Driver

Add a driver to your site:

curl -X POST https://api.moovex.ai/api/v1/drivers \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "firstName": "John",
    "lastName": "Smith",
    "phone": "+15551234567",
    "email": "john.smith@example.com",
    "siteRef": "YOUR_SITE_ID",
    "status": "active"
  }'

Step 3: Create a Vehicle

Add a vehicle and associate it with the driver:

curl -X POST https://api.moovex.ai/api/v1/vehicles \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Van 001",
    "licensePlate": "ABC-1234",
    "seats": 6,
    "siteRef": "YOUR_SITE_ID",
    "driverRef": "DRIVER_ID_FROM_STEP_2",
    "status": "active"
  }'

Step 4: Create Reservations

Create a few reservations (bookings) for routing:

curl -X POST https://api.moovex.ai/api/v1/reservations \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "passenger": {
      "name": "Alice Johnson",
      "phone": "+15559876543"
    },
    "pickup": {
      "address": "123 Main St, New York, NY",
      "lat": 40.7128,
      "lng": -74.0060,
      "time": "2024-01-15T09:00:00Z"
    },
    "dropoff": {
      "address": "456 Park Ave, New York, NY",
      "lat": 40.7614,
      "lng": -73.9776
    },
    "seats": 1,
    "siteRef": "YOUR_SITE_ID"
  }'

Create 2-3 more reservations with different pickup/dropoff locations and similar time windows.

Step 5: Route Reservations

Run the routing engine to optimize your reservations into trips:

curl -X POST https://api.moovex.ai/api/v1/routing/route \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "siteRef": "YOUR_SITE_ID",
    "date": "2024-01-15",
    "reservationIds": ["RES_ID_1", "RES_ID_2", "RES_ID_3"]
  }'

The engine returns optimized trips:

{
  "status": "success",
  "trips": [
    {
      "_id": "trip_abc123",
      "stops": [
        {
          "type": "pickup",
          "address": "123 Main St, New York, NY",
          "scheduledTime": "2024-01-15T09:00:00Z",
          "reservationIds": ["RES_ID_1"]
        },
        {
          "type": "pickup",
          "address": "789 Broadway, New York, NY",
          "scheduledTime": "2024-01-15T09:12:00Z",
          "reservationIds": ["RES_ID_2"]
        },
        {
          "type": "dropoff",
          "address": "456 Park Ave, New York, NY",
          "scheduledTime": "2024-01-15T09:28:00Z",
          "reservationIds": ["RES_ID_1", "RES_ID_2"]
        }
      ],
      "distance": 8500,
      "duration": 1680
    }
  ]
}

Step 6: Assign Drivers

Assign drivers to the optimized trips:

curl -X POST https://api.moovex.ai/api/v1/trips/assign \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "siteRef": "YOUR_SITE_ID",
    "tripIds": ["trip_abc123"]
  }'

The assignment engine considers driver availability, location, attributes, and your assignment settings to find the best match.

Next Steps

Common Patterns

Polling for Results

Some operations (routing, assignment) are asynchronous. Poll for results:

curl https://api.moovex.ai/api/v1/productions/{productionId} \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Handling Webhooks

Configure webhooks to receive real-time updates instead of polling. See Webhooks for setup.

On this page