Create a new document (v2)

Purpose: Use this API to create a new document for the user. This is the version 2 of the create a document API and its body parameters are different that the v1 endpoint.

Send a document to the dispatch

To send a document to a dispatch please do the following steps:

Step 1: Make a POST call to https://api.keeptruckin.com/v1/documents and pass the category parameter as dispatch and also pass in the dispatch_id of the relevant dispatch as a parameter.

{
     "doc_name": "bill of lading",
     "doc_date": "2022-06-08",
     "category": "dispatch",
     "doc_type": "pdf",
     "doc_size": 5,
     "driver_id": 123,
     "dispatch_id": 40,
     "doc_time": "2022-06-08T21:54:56.601Z"
}

Step 2: Upload the document using the upload_url from the response of the POST call.

Step 3: After uploading the document, make a PUT call to https://api.keeptruckin.com/v1/documents/:id and pass the upload_status parameter as completed.

{
  "id":15310,
  "upload_status":"completed"
}

Update: Upload vehicle as well as driver qualification documents

❗️

IMPORTANT

This update is only available for POST v2/documents endpoint.

The /documents API also allows you to upload vehicle and driver qualification documents. You can follow the steps mentioned-above to upload the documents, but ensure to provide the following JSON fields for the documents.

Vehicle Documents

"doc_json_fields": {
           "expiration_date":"2026-12-24T05:00:00.000Z",
           "vehicle_doc_members": {
            "vehicle_ids": [34337,34323],
            "group_ids": []
           }
        }
  • expiration_date: Specify the expiration date for the document. For example, if you are uploading the vehicle registration certificate, mention its expiry date.
  • vehicle_ids: Mention the IDs of all the vehicles for which you are uploading this document. For example, if you are uploading a vehicle insurance document, and it covers multiple vehicles, then you must mention all the vehicles for which the documents is pertaining to.
  • group_ids: Specify the ID of the group for which you are uploading this document.

Qualification Documents

 "doc_json_fields": {
           "expiration_date":"2026-12-24T05:00:00.000Z",
           "driver_id": "1193969"
        }
  • expiration_date: Specify the expiration date for the driver's qualification document. For example, if you are uploading the driver's license, mention its expiry date.
  • driver_id: Specify the ID of the driver for whom you are uploading this document.

📘

NOTE

When specifying the driver_id, ensure to use the "Internal Motive Driver ID".

Response Parameters

document

  • Type: Object
  • Description: Contains details of the document.

id

  • Type: Integer
  • Description: The unique identifier for the document.

category

  • Type: String
  • Description: The category of the document, e.g., "notes".

ref_no

  • Type: String
  • Description: The reference number associated with the document.

notes

  • Type: String
  • Description: Notes associated with the document.

doc_date

  • Type: Date (YYYY-MM-DD)
  • Description: The date associated with the document.

doc_fields

  • Type: Object
  • Description: The fields associated with the document.

notes

  • Type: String
  • Description: Notes content in the document fields.

doc_time

  • Type: DateTime (ISO 8601)
  • Description: The time associated with the document.

uploader

  • Type: Object
  • Description: The user who uploaded the document.

id

  • Type: Integer
  • Description: The unique identifier for the user who uploaded the document.

first_name

  • Type: String
  • Description: The first name of the user who uploaded the document.

last_name

  • Type: String
  • Description: The last name of the user who uploaded the document.

email

  • Type: String
  • Description: The email address of the user who uploaded the document.

role

  • Type: String
  • Description: The role of the user who uploaded the document, e.g., "dispatcher".

deactivated_at

  • Type: DateTime (ISO 8601) or null
  • Description: The timestamp when the uploader was deactivated.

driver_company_id

  • Type: Integer or null
  • Description: The unique identifier for the driver's company.

attachments

  • Type: Array of Objects
  • Description: A list of attachments associated with the document.

id

  • Type: Integer
  • Description: The unique identifier for the attachment.

name

  • Type: String
  • Description: The name of the attachment.

upload_url

  • Type: String
  • Description: The URL to upload the document.

doc_type

  • Type: String
  • Description: The type of the document, e.g., "jpeg".

offline_id

  • Type: String or null
  • Description: The offline identifier for the attachment.

field_docs

  • Type: String or null
  • Description: Any additional documents fields, if applicable.

created_at

  • Type: DateTime (ISO 8601)
  • Description: The timestamp when the document was created.

updated_at

  • Type: DateTime (ISO 8601)
  • Description: The timestamp when the document was last updated.

Language
Credentials
Header
Click Try It! to start a request and see the response here!