Saltar para o conteúdo
CargoDuo logoCargoDuo
Preços
Entrar

Por enquanto, esta documentação está disponível só em inglês.

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[].

Autenticação

Chave de API Bearer com a permissãopack:writeSaber mais

Parâmetros do corpo

application/json
NomeTipoObrigatórioDescrição
referencestring
string
Não

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

≤ 128 chars
vehiclesVehicle[]obrigatório
Vehicle[]
Sim

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

itemsItem[]obrigatório
Item[]
Sim

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

groupsGroup[]
Group[]
Não

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
Não

Packing options. Every field is optional.

Exemplo de pedido

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"
    }
  }'

Exemplo de resposta

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
  }
}

Respostas

  • 200OKValidation result and price range.
    NomeTipoObrigatórioDescrição
    validboolean
    boolean
    Não

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

    errorsErrorDetail[]
    ErrorDetail[]
    Não

    Validation errors (empty when valid).

    warningsWarning[]
    Warning[]
    Não

    Non-blocking remarks.

    itemsinteger
    integer
    Não

    Total item units.

    max_vehiclesinteger
    integer
    Não

    Most vehicles the job may load.

    estimated_costCostRange
    CostRange
    Não

    Price range in credits.

    estimated_secondsnumber · s
    number · s
    Não

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

    balanceEstimateBalance
    EstimateBalance
    Não

    Your available credits.

  • 400Bad requestinvalid_json
    • invalid_jsonThe body is not valid JSON or a field has the wrong type.
    NomeTipoObrigatórioDescrição
    errorErrorBodyobrigatório
    ErrorBody
    Sim
    Todos os códigos de erro
  • 401Unauthorizedunauthorizedkey_revokedkey_expired
    • unauthorizedMissing, malformed or unknown API key.
    • key_revokedThe key was revoked.
    • key_expiredThe key passed its expiry date.
    NomeTipoObrigatórioDescrição
    errorErrorBodyobrigatório
    ErrorBody
    Sim
    Todos os códigos de erro
  • 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.
    NomeTipoObrigatórioDescrição
    errorErrorBodyobrigatório
    ErrorBody
    Sim
    Todos os códigos de erro
  • 413Payload too largepayload_too_large
    • payload_too_largeThe request body exceeds 10 MB.
    NomeTipoObrigatórioDescrição
    errorErrorBodyobrigatório
    ErrorBody
    Sim
    Todos os códigos de erro
  • 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.
    NomeTipoObrigatórioDescrição
    errorErrorBodyobrigatório
    ErrorBody
    Sim
    Todos os códigos de erro
  • 500Internal server errorinternal_error
    • internal_errorSomething failed on our side.
    NomeTipoObrigatórioDescrição
    errorErrorBodyobrigatório
    ErrorBody
    Sim
    Todos os códigos de erro
  • 503Service unavailableapi_disabled
    • api_disabledThe API is temporarily disabled (maintenance) or switched off for the organization.
    NomeTipoObrigatórioDescrição
    errorErrorBodyobrigatório
    ErrorBody
    Sim
    Todos os códigos de erro