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

# Bulk create jobs

> Create up to 100 delivery or collection jobs in a single request using the Detrack REST API v2 POST /dn/jobs/bulk endpoint.

The bulk create endpoint lets you submit up to 100 jobs in one call. Each job is validated independently, so a single bad row does not block the rest. When every job is valid, the API returns `201 Created` with the created jobs and their assigned IDs. When some jobs fail, the API returns `422`: the valid jobs are still created, and the response lists them separately from the failed ones.

For a complete list of job fields, see the [Retrieve job](/api-reference/jobs/retrieve) reference. For single job creation, see [Create job](/api-reference/jobs/create).


## OpenAPI

````yaml POST /dn/jobs/bulk
openapi: 3.0.3
info:
  title: Detrack REST API v2
  version: '2.0'
  description: >-
    Detrack REST API v2. Checked against detrack-webapp origin/main (production)
    on 2026-09-29: dn_jobs.rb @ d246ad006, dn_depots.rb @ 2a5f387, dn_routes.rb
    @ 50a73a9, app_helper.rb @ d745ad2, dn_jobs_helper.rb @ d296e30,
    job_decorator.rb @ 3041da7, run_location_decorator.rb @ 0f0274d,
    vehicle_route_plan_decorator.rb and tsp_route_decorator.rb @ 7d1f3ef,
    data_export.rb @ ed4e135.
servers:
  - url: https://app.detrack.com/api/v2
security:
  - apiKey: []
tags:
  - name: Jobs
    description: Deliveries and collections.
  - name: Depots
    description: Saved warehouse and pickup locations.
  - name: Routes
    description: Optimized multi-stop plans across vehicles.
paths:
  /dn/jobs/bulk:
    post:
      tags:
        - Jobs
      summary: Bulk create jobs
      description: >-
        Creates up to 100 jobs. Any beyond the first 100 are ignored. Each job
        is validated on its own, so one bad row doesn't block the rest.
      operationId: bulkCreateJobs
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - data
              properties:
                data:
                  type: array
                  description: >-
                    Only the first 100 items are processed. Any beyond that are
                    ignored without an error.
                  items:
                    $ref: '#/components/schemas/JobCreateInput'
      responses:
        '201':
          description: Every job was created.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/Job'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: >-
            Some jobs failed validation. The valid jobs are still created and
            appear under `data.data`. Each failed job appears in `errors` with
            its own `errors` list.
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: validation_failed
                  message:
                    type: string
                    example: Validation failed
                  errors:
                    type: array
                    items:
                      allOf:
                        - $ref: '#/components/schemas/Job'
                        - type: object
                          properties:
                            errors:
                              type: array
                              items:
                                $ref: '#/components/schemas/FieldError'
                  data:
                    type: object
                    properties:
                      data:
                        type: array
                        items:
                          $ref: '#/components/schemas/Job'
        default:
          $ref: '#/components/responses/ServerError'
components:
  schemas:
    JobCreateInput:
      description: >-
        Fields for creating a job. `do_number` and `date` are required.
        `address` is required unless you send `address_1`, `address_2`, or
        `address_3`. Your account settings can make other fields mandatory.
      allOf:
        - $ref: '#/components/schemas/JobInput'
        - type: object
          required:
            - do_number
            - date
    Job:
      type: object
      description: >-
        A delivery or collection job. Only the most-used fields are listed; the
        API returns more.
      properties:
        id:
          type: string
          example: 5b22055510c92b1a046ece04
        type:
          type: string
          enum:
            - Delivery
            - Collection
          example: Delivery
        do_number:
          type: string
          example: DO-10001
        date:
          type: string
          format: date
          example: '2026-09-15'
        status:
          type: string
          description: >-
            Lifecycle status. Use this in integration logic. See [Status
            fields](/concepts/jobs#status-fields).
          example: dispatched
        primary_job_status:
          type: string
          description: Same value as `status`.
          example: dispatched
        tracking_status:
          type: string
          description: >-
            Customer-facing label, which can be customised per account. Don't
            use it in integration logic.
          example: Info received
        attempt:
          type: integer
          example: 1
        detrack_number:
          type: string
          example: DET2000001
        tracking_number:
          type: string
          nullable: true
          example: T0
        order_number:
          type: string
          nullable: true
          example: ORN12345678
        address:
          type: string
          example: Singapore 470140
        postal_code:
          type: string
          nullable: true
          example: '470140'
        deliver_to_collect_from:
          type: string
          nullable: true
          example: James Li
        phone_number:
          type: string
          nullable: true
          example: '65432178'
        notify_email:
          type: string
          nullable: true
          example: test@example.com
        items_count:
          type: integer
          example: 2
        created_at:
          type: string
          format: date-time
          example: '2026-09-15T06:04:06.017Z'
        items:
          type: array
          items:
            $ref: '#/components/schemas/Item'
        milestones:
          type: array
          items:
            $ref: '#/components/schemas/Milestone'
    FieldError:
      type: object
      properties:
        field:
          type: string
          example: do_number
        codes:
          type: array
          items:
            type: string
          example:
            - can't be blank
    JobInput:
      type: object
      description: >-
        Job fields you can send. On update, send only the fields you want to
        change.
      properties:
        type:
          type: string
          enum:
            - Delivery
            - Collection
          default: Delivery
        do_number:
          type: string
          example: DO-10001
        date:
          type: string
          format: date
          example: '2026-09-15'
        address:
          type: string
          description: >-
            Full address. Required on create unless you send `address_1`,
            `address_2`, or `address_3`.
          example: Singapore 470140
        address_1:
          type: string
          description: Address line 1.
        address_2:
          type: string
          description: Address line 2.
        address_3:
          type: string
          description: Address line 3.
        deliver_to_collect_from:
          type: string
          example: James Li
        phone_number:
          type: string
          example: '65432178'
        fax_number:
          type: string
          example: '65432179'
        notify_email:
          type: string
          example: test@example.com
        tracking_number:
          type: string
          example: T0
        order_number:
          type: string
          example: ORN12345678
        job_sequence:
          type: integer
          description: Position of the job in the driver's run.
          example: 1
        assign_to:
          type: string
          description: Name of the vehicle (driver) to assign the job to.
          example: Driver 1
        items:
          type: array
          description: >-
            Line items. Which item fields are required depends on your account's
            mandatory item field settings. On update, the items you send replace
            the existing ones.
          items:
            $ref: '#/components/schemas/ItemInput'
    Item:
      type: object
      properties:
        id:
          type: string
          readOnly: true
          example: 5b22055510c92b1a046ece05
        sku:
          type: string
          example: '12345678'
        description:
          type: string
          nullable: true
          example: iPad
        quantity:
          type: number
          example: 10
        checked:
          type: boolean
          readOnly: true
          example: false
    Milestone:
      type: object
      properties:
        status:
          type: string
          example: info_recv
        assign_to:
          type: string
          nullable: true
          example: null
        reason:
          type: string
          nullable: true
          example: null
        pod_at:
          type: string
          format: date-time
          example: '2026-09-15T06:04:06.017Z'
        created_at:
          type: string
          format: date-time
          example: '2026-09-15T06:04:06.017Z'
        user_name:
          type: string
          example: Simon
    Error:
      type: object
      properties:
        code:
          type: string
          example: not_found
        message:
          type: string
          example: Could not find job with this DO number
    ItemInput:
      type: object
      description: >-
        Item fields you can send. Which ones are required depends on your
        account's mandatory item field settings.
      properties:
        sku:
          type: string
          example: '12345678'
        description:
          type: string
          example: iPad
        quantity:
          type: number
          example: 10
        unit_of_measure:
          type: string
          example: pcs
        purchase_order_number:
          type: string
        batch_number:
          type: string
        expiry_date:
          type: string
          format: date
        comments:
          type: string
        serial_numbers:
          type: array
          items:
            type: string
        weight:
          type: number
        unit_price:
          type: number
        fixed_price:
          type: number
        minimum_quantity:
          type: number
        position:
          type: integer
          description: Order of the item in the job. Defaults to its position in the array.
        checked:
          type: boolean
        actual_quantity:
          type: number
        inbound_quantity:
          type: number
        follow_up_quantity:
          type: number
        follow_up_reason:
          type: string
        rework_quantity:
          type: number
        rework_reason:
          type: string
        reject_quantity:
          type: number
        reject_reason:
          type: string
        unload_time_estimate:
          type: string
        unload_time_actual:
          type: string
  responses:
    BadRequest:
      description: The request body isn't valid JSON.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: invalid_json_format
    Unauthorized:
      description: >-
        The API key is missing or invalid. A missing `X-API-KEY` returns `{
        "error": "Missing Authorization header" }`; an invalid key returns `{
        "code": "invalid_key", "message": "Invalid key" }`.
      content:
        application/json:
          schema:
            oneOf:
              - type: object
                title: Missing key
                required:
                  - error
                properties:
                  error:
                    type: string
                    example: Missing Authorization header
              - type: object
                title: Invalid key
                required:
                  - code
                properties:
                  code:
                    type: string
                    example: invalid_key
                  message:
                    type: string
                    example: Invalid key
          example:
            code: invalid_key
            message: Invalid key
    Forbidden:
      description: Your API key's user doesn't have permission for this action.
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: string
                example: forbidden
          example:
            code: forbidden
    ServerError:
      description: >-
        Unexpected server error. Retry with exponential backoff, and contact
        Detrack support if it persists.
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: X-API-KEY
      description: Your Detrack API key, from **Integrations > API Key** in the dashboard.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.