本文へスキップ
CargoDuo logoCargoDuo
料金

このドキュメントは現在、英語版のみです。

Errors

One error envelope, stable codes, clear retry rules.

Every non-2xx response has one shape. Branch on error.code, never on message.

JSON
{
  "error": {
    "code": "validation_failed",
    "message": "The request is invalid.",
    "request_id": "req_8fK2Lq9ZtX4mN7bV1cW3yH6p",
    "details": [
      {
        "path": "items[3].length",
        "code": "out_of_range",
        "message": "length must be greater than 0."
      }
    ]
  }
}
FieldHolds
codeStable, snake_case
messageEnglish, for logs
request_idAlso in X-Request-Id. Quote it to support
details[]On 400/422: path, code, message per problem

Codes

StatusCodeMeaningWhat to doRetry
400invalid_jsonThe body is not valid JSON or a field has the wrong type.Fix the request body.No
401unauthorizedMissing, malformed or unknown API key.Send Authorization: Bearer cd_live_…; check the key was copied completely.No
401key_revokedThe key was revoked.Create a new key in the developer console.No
401key_expiredThe key passed its expiry date.Create a new key in the developer console.No
402insufficient_creditsAvailable credits do not cover the smallest possible run of this job.Buy a credit pack or wait for the monthly credits; nothing was charged.No
403ip_not_allowedThe calling IP is not on the key's allowlist.Call from an allowed IP or edit the allowlist.No
403subscription_inactiveThe organization has no active subscription that includes the API.Renew the subscription.No
403account_inactiveThe organization is suspended, or has no owner whose account is active.Contact support.No
403scope_missingThe key lacks a scope this endpoint needs.Use a key with the scope (pack:write, jobs:read, account:read, resources:read, resources:write).No
403preset_read_onlyPresets cannot be changed or deleted.Create your own vehicle with POST /v1/vehicles.No
403plan_limit_reachedThe organization's plan allows no more projects or cargo items.Delete projects you no longer need, or move to a larger plan.No
404not_foundNo /v1 endpoint has this method and path.Check the method and path against the endpoint list.No
404job_not_foundNo job with this id in your organization.Check the id.No
404vehicle_not_foundNo vehicle with this id among the presets or your organization's vehicles.Check the id against GET /v1/vehicles.No
404template_not_foundNo template with this id in your organization.Check the id against GET /v1/templates.No
404project_not_foundNo project with this id in your organization.Check the id against GET /v1/projects.No
409job_not_finishedThe job is still queued or running.Poll GET /v1/jobs/{id} until status is succeeded.Yes
409project_busyThe project is being packed right now (in the app or by another job).Wait for that run to end, then retry.Yes
409job_failedThe job failed; it has no result.Read job.error; failures on our side are not charged (time_limit_exceeded is charged like a canceled job) — resubmit if the cause was temporary.No
409job_canceledThe job was canceled; it has no result.Resubmit if needed.No
409job_already_finishedThe job already ended and cannot be canceled.Nothing to do.No
400idempotency_key_invalidThe Idempotency-Key header is longer than 128 characters.Use a shorter key (a UUID works).No
410result_expiredThe result passed the retention window and was deleted.Resubmit the job if you need the plan again.No
413payload_too_largeThe request body exceeds 10 MB.Send fewer or simpler items.No
422validation_failedThe request is well-formed JSON but describes an invalid job. details[] lists every problem.Fix each details[].path; validation failures are free.No
429rate_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.Wait Retry-After seconds, then retry with backoff.Yes
429too_many_jobsThe organization already has the maximum number of queued + running jobs.Wait for running jobs to finish, then retry.Yes
500internal_errorSomething failed on our side.Retry with backoff; quote request_id if it persists.Yes
503api_disabledThe API is temporarily disabled (maintenance) or switched off for the organization.Retry later.Yes

Validation details

details[].code on 422 validation_failed:

CodeMeaning
requiredA required field is missing
invalid_valueWrong type or not one of the allowed values
out_of_rangeToo small, too large or too long
duplicate_idAn id is used twice
unknown_vehicleNo preset or vehicle of yours with this vehicle_id
unknown_templateNo template of yours with this template_id
type_not_allowedVehicle type not enabled for your organization
unknown_groupAn item names a group that is not listed
does_not_fitThe item fits no listed vehicle
too_many_itemsMore item units than the job limit
too_many_vehiclesMore vehicles than the job limit
unknown_fieldA field the API does not know

Job errors

A failed or canceled job says why in job.error.code:

CodeMeaning
canceledCanceled by DELETE /v1/jobs/{id}. Charged base + compute used.
time_limit_exceededThe compute budget ran out before any vehicle was packed. Charged like a canceled job: per-job fee, large-load surcharge and the compute used, never the per-vehicle fee.
engine_failedThe packing engine failed. Not charged.
queue_timeoutThe job waited too long for a compute slot. Not charged.
server_restartedThe service restarted while the job was queued or running. Not charged.

Retries

Retry 429, 500 and 503 with exponential backoff, honouring Retry-After. Send the same Idempotency-Key (Idempotency). Never retry other 4xx unchanged.