FleetWorkAPI Docs
Job Management

Create Job

Create a new job with tasks in your Fleetwork account.

POST/api/v1/workspace/jobs

Request Body

FieldTypeRequiredDescription
jobNamestringRequiredJob name
jobStatusintegerRequired0=New, 1=Scheduled, 2=InProgress
jobTypeintegerRequired0=Unknown, 1=Shipment, 2=Service
jobDescriptionstringOptionalJob description
metaDatastringOptionalCustom JSON metadata string
tasksarrayRequiredArray of task objects (see Task fields below)

Shipment jobs (jobType=1) require exactly 2 tasks: one Pick (shipmentType=1) and one Drop (shipmentType=2). The API returns an error if this condition is not met.

Task Fields

FieldTypeRequiredDescription
taskNamestringRequiredTask name
taskTypeintegerOptional0=Unknown, 1=Shipment, 2=Service
priorityintegerOptional0=Low, 1=Medium, 2=High
descriptionstringOptionalTask description
contactNamestringOptionalContact person name
contactPhonestringOptionalContact phone number
startDtlongOptionalScheduled start time (Unix ms)
endDtlongOptionalScheduled end time (Unix ms)
startTimeintegerOptionalTime window start (minutes from midnight)
endTimeintegerOptionalTime window end (minutes from midnight)
serviceTimeintegerOptionalService duration in minutes
setupTimeintegerOptionalSetup duration in minutes
placeobjectOptionalPlace object - see Place fields below. Use the Search Places API to retrieve valid refIds.
metaDatastringOptionalTask-level custom JSON metadata
skillIdUUIDOptionalRequired skill ID for this task
shipmentPropertyobjectConditionalRequired for Shipment jobs - see below

place fields

FieldTypeRequiredDescription
idUUIDOptionalID of an existing place (if already in address book)
refIdstringRequiredYour external reference ID for this place (see Search Places)
namestringOptionalPlace name
addressstringOptionalFull address
latnumberOptionalLatitude
lngnumberOptionalLongitude
contactPersonstringOptionalContact person name
contactNumstringOptionalContact phone number
startTimeintegerOptionalTime window start (minutes from midnight)
endTimeintegerOptionalTime window end (minutes from midnight)

shipmentProperty fields (Shipment job only)

FieldTypeRequiredDescription
shipmentTypeintegerRequired1=Pick, 2=Drop
{
  "jobName": "Delivery Job Q1",
  "jobDescription": "Morning delivery run",
  "jobStatus": 1,
  "jobType": 1,
  "tasks": [
    {
      "taskName": "Pick up goods",
      "taskType": 1,
      "priority": 1,
      "contactName": "Mr. Tuan",
      "contactPhone": "+84901234567",
      "shipmentProperty": { "shipmentType": 1 },
      "place": {
        "refId": "WH-001",
        "name": "Main Warehouse",
        "address": "100 Warehouse St, D7",
        "lat": 10.74,
        "lng": 106.72
      }
    },
    {
      "taskName": "Deliver to Customer A",
      "taskType": 1,
      "priority": 1,
      "contactName": "Ms. Lan",
      "contactPhone": "+84907654321",
      "shipmentProperty": { "shipmentType": 2 },
      "place": {
        "refId": "CUST-A-001",
        "name": "Customer A Location",
        "address": "123 Le Loi, D1",
        "lat": 10.7731,
        "lng": 106.703
      }
    }
  ]
}

Example

Request

curl -X POST \
  "https://live.fleetwork.vn/api/v1/workspace/jobs" \
  -H "API-KEY: <your-key>" \
  -H "Content-Type: application/json" \
  -d '{"jobName":"Delivery Job Q1","jobStatus":1,"jobType":1,"tasks":[{"taskName":"Pick up goods","taskType":1,"priority":1,"shipmentProperty":{"shipmentType":1},"place":{"refId":"WH-001","name":"Main Warehouse","address":"100 Warehouse St, D7","lat":10.74,"lng":106.72}},{"taskName":"Deliver to Customer A","taskType":1,"priority":1,"contactName":"Ms. Lan","contactPhone":"+84907654321","shipmentProperty":{"shipmentType":2},"place":{"refId":"CUST-A-001","name":"Customer A","address":"123 Le Loi, D1","lat":10.7731,"lng":106.703}}]}'

Response

{
  "code": "OK",
  "message": null,
  "data": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}

The data field contains the UUID of the newly created job.

On this page