Overview

This document describes the Intelligent Document Processing (IDP) module APIs from CD AUTOMATION. APIs follow OpenAPI/REST standards and can be tested via Postman or integrated into ERP systems. Webhooks use POST for callbacks and GET for verification.

API Endpoints

Key endpoints used by clients are listed below; see the Summary section for a compact list.

Authentication

All API requests require a Bearer token. Obtain it by sending credentials to the authentication endpoint.

Endpoint

Request (example)

curl --location 'https://automate-dev.cargodash.in/api/v1/login' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "username": "your@example.com",
    "password": "your_password"
  }'

Successful response (example)

{
  "result": {
    "token": "eyJhbGciOiJIUzI1NiJ9....",
    "expiry": "2025-01-01 01:01:01"
  }
}

File Upload API

Use this endpoint to upload documents for processing (max 10MB).

Endpoint

Form parameters

Sample request

curl --location 'https://automate-dev.cargodash.in/api/v1/doc-parse' \
  --header 'Authorization: Bearer {token}' \
  --form 'doc=@"/path/to/your/document.pdf"' \
  --form 'outputType="AWB"'

Successful response

{
  "document_id": "uuid-here",
  "message": "File uploaded successfully"
}

Getting Started with Webhook

Webhooks let CD AUTOMATION push processed results to your server. Create an HTTPS endpoint and implement:

  1. GET — verification call to confirm the URL is reachable.
  2. POST — CD AUTOMATION will POST the JSON payload with processing updates.

Register the webhook URL in the CD AUTOMATION app (select IDP and add your webhook URL).

Sample webhook payload (AWB)

{
  "id": "a4a793f5-3ce1-4f3a-a300-4cb5223f05ae",
  "originalFileName": "Job Upload-182895-.46.pdf",
  "fileFormat": "PDF",
  "status": "COMPLETED",
  "response": [
    {
      "document_type": "AWB",
      "Document_no": "930226f6-ef39-..._098-99999999",
      "start_page_number": 1,
      "end_page_number": 1,
      "response": {
        "awbNo": "098-99999999",
        "flightNo": "AI-111",
        "flightDate": "30-08-2024",
        "airCarrier": "AIR INDIA",
        "departureAirportCode": "BOM",
        "destinationAirportCode": "JED",
        "shipperName": "ABC PVT LTD.",
        "consigneeName": "New Engineering Pvt. Ltd.",
        "totalAmount": "66279.00",
        "totalAmountCurrency": "INR",
        "details": [
          {
            "noOfPackages": "8",
            "grossWeight": "232.21",
            "chargeableWeight": "233.00",
            "dimensionsValue": ["43X43X52_6","43X43X45_2"],
            "rate": "202.00",
            "amount": "55800.00",
            "productDescription": "MITOCONAZOLE, HS CODE:29332999; ..."
          }
        ]
      }
    }
  ],
  "totalPages": 1
}

(Payload trimmed for clarity — full payload includes additional fields.)

Get Document Parsed Data By Id

You can get the processed results by ID :

  1. GET — https://automate-dev.cargodash.in/api/v1/doc-parse-data/174384a5-0d44-47f9-*******.

Sample Response Data (AWB)

{
  "id": "a4a793f5-3ce1-4f3a-a300-4cb5223f05ae",
  "originalFileName": "Job Upload-182895-.46.pdf",
  "fileFormat": "PDF",
  "status": "COMPLETED",
  "response": [
    {
      "document_type": "AWB",
      "Document_no": "930226f6-ef39-..._098-99999999",
      "start_page_number": 1,
      "end_page_number": 1,
      "response": {
        "awbNo": "098-99999999",
        "flightNo": "AI-111",
        "flightDate": "30-08-2024",
        "airCarrier": "AIR INDIA",
        "departureAirportCode": "BOM",
        "destinationAirportCode": "JED",
        "shipperName": "ABC PVT LTD.",
        "consigneeName": "New Engineering Pvt. Ltd.",
        "totalAmount": "66279.00",
        "totalAmountCurrency": "INR",
        "details": [
          {
            "noOfPackages": "8",
            "grossWeight": "232.21",
            "chargeableWeight": "233.00",
            "dimensionsValue": ["43X43X52_6","43X43X45_2"],
            "rate": "202.00",
            "amount": "55800.00",
            "productDescription": "MITOCONAZOLE, HS CODE:29332999; ..."
          }
        ]
      }
    }
  ],
  "totalPages": 1
}

(Payload trimmed for clarity — full payload includes additional fields.)

Description of output parameters

Property Type Description
id String Document id returned after upload
outputType Array The requested output type (e.g., AWB)
originalFileName String Original uploaded file name
fileFormat String PDF / PNG / JPG / JPEG
status String PROCESSING / COMPLETED / ERROR / INCOMPLETE
response Array List of output labels for each identified document

Processing Status

Error Handling

Common API errors and example responses:

Invalid Token

Status: 401 Unauthorized
{
  "error": "Invalid or expired token."
}

User Not Subscribed

Status: 403 Forbidden
{
  "error": "User is not subscribed to this service."
}

File Too Large

Status: 413 Payload Too Large
{
  "message": "File too large",
  "error": "Payload Too Large",
  "statusCode": 413
}

Missing Parameters / Invalid Output Type

Status: 400 Bad Request
{
  "message": "file parameter is required",
  "error": "Bad Request",
  "statusCode": 400
}

Notes