---
title: "Shipment Data Extraction (Text, Image)"
method: POST
path: "/ai/shipment"
---

# Shipment Data Extraction (Text, Image)

`POST /ai/shipment`

## Request

- Base URL: `https://api.cargoai.co/solutions`
- URL: `https://api.cargoai.co/solutions/ai/shipment`
- Auth: none required

Transform raw email data into accurate shipment information and remove manual data entry from your quote and book process. By far the easiest way to leverage powerful AI capabilities to supercharge your workflows.

Send the email subject, its body and any number of attachments in one request (attachments format). The type / data format is deprecated: end of maintenance 2 May 2027. Errors are never billed.

## Headers

- `x-api-key` string, required

## Request body

- union
  - object: Email subject, body and any number of attachments in one request; one consolidated shipment is returned. Supported files: PDF (native and scanned), JPEG, PNG, HEIC, Excel (.xlsx, .xls, .xlsm), Word (.docx), PowerPoint (.pptx), CSV, TSV, RTF, HTML, plain text and saved emails (.eml, .msg, winmail.dat). Limit: 6 MB per request (about 4.5 MB of files once base64 encoded), no limit on the number of attachments. Do not send type or data with attachments (400 MIXED_FORMAT).
    - `subject` string: Subject of the email.
    - `emailBody` string: Body of the email, as plain text.
    - `attachments` object[], required: The files of the request. Use [] for a request with the email body only. An attachment takes only name, contentType and content: any other field is rejected.
      - `name` string, required: File name, for example packing.xlsx. Returned in the response so you can match each file.
      - `contentType` string, required: Media type of the file, for example application/pdf. For information only: the real type is detected from the file itself.
      - `content` string, byte, required: The file, base64 encoded, without a data: prefix. An empty content is accepted and reported ignored with the reason empty.
  - object: Deprecated. Requests with type and data keep working with the same results until 2 May 2027 (end of maintenance); after that date they are still served but no longer maintained. Move to the attachments format before then. Never send type or data together with attachments (400 MIXED_FORMAT).
    - `email` string
    - `data` string, required: Raw text email for RAWTEXT, or base64 encoded content for B64_TEXT, IMAGE, MULTI and EXCEL. Deprecated: End of maintenance: 2 May 2027.
    - `type` string, required: RAWTEXT (email only), B64_TEXT (email in base64), IMAGE (image only), MULTI (email + image) or EXCEL (Excel file). Deprecated: End of maintenance: 2 May 2027.
    - `subject` string
    - `emailBody` string: email body data for MULTI type

## Response `200`

Extracted shipment

- object
  - `origin` string
  - `destination` string
  - `date` string
  - `loadType` string
  - `weight` number
  - `volume` number
  - `dimensions` object[]
    - `pieces` integer
    - `length` number
    - `width` number
    - `height` number
    - `weight` number
    - `lengthUnit` string
    - `weightUnit` string
    - `stackable` 'true' | 'false': Returned as a string, "true" or "false".
  - `attachments` object[]: Status of each file. Attachments format only.
    - `index` integer, required: Position of the file in the request. Files found inside a saved email come after the files of the request.
    - `parentIndex` integer: Only for a file found inside a saved email: the index of that email.
    - `name` string, required: File name.
    - `detectedType` string, required: Type detected from the file itself, for example pdf, xlsx, png.
    - `status` 'processed' | 'ignored' | 'rejected' | 'not_extracted', required: processed, ignored, rejected, or not_extracted (the file was read but the extraction failed or ran out of time).
    - `reason` string: Why the file was ignored or rejected, for example unsupported_format, password_protected, executable, script, corrupt, too_large, duplicate, signature_image, crypto_signature, contact_or_calendar, audio_video, empty, conversion_failed, conversion_timeout, nesting_too_deep, other.
    - `duplicateOf` integer: Only for a duplicate: the index of the file it duplicates.

## Other responses

- `400`: Invalid request
- `413`: Request too large
- `422`: No usable input
- `500`: Internal error
- `502`: Extraction failed
- `503`: Extraction service unavailable
- `504`: Extraction timed out

## Changes

- **2026-11-03** `dfd7950d43d7`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/cargoai/apis/solutions/changes/ai/shipment/post.md)

---

[API](https://skmtc.dev/cargoai/apis/solutions.md) - [All operations](https://skmtc.dev/cargoai/apis/solutions/llms.txt) - [OpenAPI document](https://skmtc.dev/cargoai/apis/solutions/revisions/dfd7950d43d7?raw)
