تخطَّ إلى المحتوى

هذه الوثائق متاحة حاليًا باللغة الإنجليزية فقط.

وثائق المطورينAPI referencePack

Estimate a packing job

Runs the same validation as POST /v1/pack and returns the price range, without creating a job or reserving credits.

POSThttps://runner.cargoduo.com/v1/estimate

Free. An invalid request answers 200 with valid: false and every problem in errors[].

المصادقة

مفتاح API من نوع Bearer بالصلاحيةpack:writeاعرف المزيد

معاملات المحتوى

application/json
الاسمالنوعمطلوبالوصف
referencestring
string
لا

Your own reference (order number, shipment id…). Echoed back on the job.

≤ 128 chars
vehiclesVehicle[]مطلوب
Vehicle[]
نعم

Vehicle definitions. Each one may have quantity > 1. At least one.

itemsItem[]مطلوب
Item[]
نعم

Item definitions. Each one may have quantity > 1. At least one.

groupsGroup[]
Group[]
لا

Optional groups (customers, stops, orders). Required for every group an item names when options.group_routing is not "none"; otherwise groups are created from the item group names in order of appearance.

optionsOptions
Options
لا

Packing options. Every field is optional.

مثال على الطلب

curl -X POST "https://runner.cargoduo.com/v1/estimate" \
  -H "Authorization: Bearer $CARGODUO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "reference": "order-1042",
    "vehicles": [
      {
        "id": "trailer",
        "type": "trailer",
        "name": "13.6 m trailer",
        "length": 1360,
        "width": 245,
        "height": 270,
        "max_weight": 24000
      }
    ],
    "items": [
      {
        "id": "pallet-eu",
        "label": "Euro pallet",
        "length": 120,
        "width": 80,
        "height": 140,
        "weight": 450,
        "quantity": 18,
        "stackable": false
      },
      {
        "id": "carton-a",
        "label": "Carton A",
        "length": 60,
        "width": 40,
        "height": 40,
        "weight": 12,
        "quantity": 40,
        "rotation": "upright"
      }
    ],
    "options": {
      "packing_mode": "auto"
    }
  }'

مثال على الاستجابة

200 OK · Estimate
{
  "valid": true,
  "errors": [],
  "warnings": [],
  "items": 58,
  "max_vehicles": 3,
  "estimated_cost": {
    "min_credits": 0.26,
    "max_credits": 1.11
  },
  "estimated_seconds": 90,
  "balance": {
    "available_credits": 147.75
  }
}

الاستجابات

  • 200OKValidation result and price range.
    الاسمالنوعمطلوبالوصف
    validboolean
    boolean
    لا

    The request would be accepted by POST /v1/pack.

    errorsErrorDetail[]
    ErrorDetail[]
    لا

    Validation errors (empty when valid).

    warningsWarning[]
    Warning[]
    لا

    Non-blocking remarks.

    itemsinteger
    integer
    لا

    Total item units.

    max_vehiclesinteger
    integer
    لا

    Most vehicles the job may load.

    estimated_costCostRange
    CostRange
    لا

    Price range in credits.

    estimated_secondsnumber · s
    number · s
    لا

    Compute budget the job would get (an upper bound; most jobs finish sooner).

    balanceEstimateBalance
    EstimateBalance
    لا

    Your available credits.

  • 400Bad requestinvalid_json
    • invalid_jsonThe body is not valid JSON or a field has the wrong type.
    الاسمالنوعمطلوبالوصف
    errorErrorBodyمطلوب
    ErrorBody
    نعم
    كل رموز الأخطاء
  • 401Unauthorizedunauthorizedkey_revokedkey_expired
    • unauthorizedMissing, malformed or unknown API key.
    • key_revokedThe key was revoked.
    • key_expiredThe key passed its expiry date.
    الاسمالنوعمطلوبالوصف
    errorErrorBodyمطلوب
    ErrorBody
    نعم
    كل رموز الأخطاء
  • 403Forbiddenip_not_allowedsubscription_inactiveaccount_inactivescope_missing
    • ip_not_allowedThe calling IP is not on the key's allowlist.
    • subscription_inactiveThe organization has no active subscription that includes the API.
    • account_inactiveThe organization is suspended, or has no owner whose account is active.
    • scope_missingThe key lacks a scope this endpoint needs.
    الاسمالنوعمطلوبالوصف
    errorErrorBodyمطلوب
    ErrorBody
    نعم
    كل رموز الأخطاء
  • 413Payload too largepayload_too_large
    • payload_too_largeThe request body exceeds 10 MB.
    الاسمالنوعمطلوبالوصف
    errorErrorBodyمطلوب
    ErrorBody
    نعم
    كل رموز الأخطاء
  • 429Too many requestsrate_limited
    • rate_limitedToo many requests in the current minute, hour or day (per key or per organization), or more than 60 failed authentications per minute from your IP address.
    الاسمالنوعمطلوبالوصف
    errorErrorBodyمطلوب
    ErrorBody
    نعم
    كل رموز الأخطاء
  • 500Internal server errorinternal_error
    • internal_errorSomething failed on our side.
    الاسمالنوعمطلوبالوصف
    errorErrorBodyمطلوب
    ErrorBody
    نعم
    كل رموز الأخطاء
  • 503Service unavailableapi_disabled
    • api_disabledThe API is temporarily disabled (maintenance) or switched off for the organization.
    الاسمالنوعمطلوبالوصف
    errorErrorBodyمطلوب
    ErrorBody
    نعم
    كل رموز الأخطاء