List workers

List workers

Returns a collection of all workers in your organization.

Query parameters

NameTypeDescription
filterstringOptional. A comma-separated list of fields to return, if all are not desired. For example, name, location.
teamsstringOptional. A comma-separated list of the team IDs that workers must be part of.
statesstringOptional. A comma-separated list of worker states, where 0 is off-duty, 1 is idle (on-duty, no active task) and 2 is active (on-duty, active task).
phonesstringOptional. A comma-separated list of workers' phone numbers.
includePasswordDetailsstringOptional. Set as true to include password details of a worker.

📘

Password information when includePasswordDetails is set as true

New password fields will appear in the response:

  • password includes { isPermanent: true } if the driver has signed up and set their password.
  • password includes { isPermanent: false, value: XXXXXX } if the driver has not yet set their permanent password.

🚧

502 Internal Timed out

Onfleet has an internal system timeout of 70 seconds, which can be encountered when listing workers. If the 502 error comes up, try narrowing your search parameters so that query can be executed more quickly.

curl -X GET "https://onfleet.com/api/v2/workers?states=1" \
       -u "cd3b3de84cc1ee040bf06512d233719c:"
onfleet.workers.get()
onfleet.workers.get();
$onfleet->workers->get();
[
  {
    "id": "h*wSb*apKlDkUFnuLTtjPke7",
    "timeCreated": 1455049674000,
    "timeLastModified": 1455156646529,
    "organization": "yAM*fDkztrT3gUcz9mNDgNOL",
    "name": "Andoni",
    "displayName": "Andoni",
    "phone": "+14155558442",
    "activeTask": null,
    "tasks": [
      "11z1BbsQUZFHD1XAd~emDDeK"
    ],
    "onDuty": true,
    "timeLastSeen": 1455156644323,
    "capacity": 0,
    "userData": {
    	"appVersion": "1.2.0",
      "batteryLevel": 0.99,
      "deviceDescription": "Simulator (iOS 12.1.0)",
      "platform": "IOS"
    },
    "accountStatus": "ACCEPTED",
    "metadata": [
          {
        "name": "nickname",
        "type": "string",
        "value": "Puffy",
        "visibility": [
          "api"
        ]
      },
      {
        "name": "otherDetails",
        "type": "object",
        "value": {
          "availability": {
            "mon": "10:00",
            "sat": "16:20",
            "wed": "13:30"
          },
          "premiumInsurance": false,
          "trunkSize": 9.5
        },
        "visibility": [
          "api"
        ]
      }
    ],
    "imageUrl": null,
    "teams": [
      "R4P7jhuzaIZ4cHHZE1ghmTtB"
    ],
    "delayTime": null,
    "location": [
      -122.4015496466794,
      37.77629837661284
    ],
    "vehicle": null
  },
  {
    "id": "1LjhGUWdxFbvdsTAAXs0TFos",
    "timeCreated": 1455049755000,
    "timeLastModified": 1455072352267,
    "organization": "yAM*fDkztrT3gUcz9mNDgNOL",
    "name": "Yevgeny",
    "displayName": "YV",
    "phone": "+14155552299",
    "activeTask": null,
    "tasks": [
      "*0tnJcly~vSI~9uHz*ICHXTw",
      "PauBfRH8gQCjtMLaPe97G8Jf"
    ],
    "onDuty": true,
    "timeLastSeen": 1455156649007,
    "capacity": 0,
    "userData": {
    	"appVersion": "1.2.0",
      "batteryLevel": 0.97,
      "deviceDescription": "Galaxy S8",
      "platform": "Android"
    },
    "accountStatus": "ACCEPTED",
    "metadata": [],
    "location": [
      -122.4016366,
      37.7764098
    ],
    "imageUrl": null,
    "teams": [
      "9dyuPqHt6kDK5JKHFhE0xihh",
      "yKpCnWprM1Rvp3NGGlVa5TMa",
      "fwflFNVvrK~4t0m5hKFIxBUl"
    ],
    "delayTime": null,
    "vehicle": {
      "id": "ArBoHNxS4B76AiBKoIawY9OS",
      "type": "CAR",
      "description": "Lada Niva",
      "licensePlate": "23KJ129",
      "color": "Red",
      "timeLastModified": 1545086815176
    }
  }
]

The index of each id in the tasks array indicates the order of assigned tasks for that worker.