cj logo

Create Shipment

Copied!
copy

This HTTP POST request is used to create a shipment and generate a Final Mile Carrier label. The request body should contain shipment details such as addresses, items, instructions, pickup time, service name, and label format. The response will include the shipping label, tracking ID, tracking code, and the shipping rate with carrier, service, and amount details.

Supported label formats include ZPL, PDF, PNG, and EPL2.

Request Body

Authorization

Token   <token>

Body

raw (json)
json
Copied!
copy
{
    "shipment": {
        "to_address": {
            "name": "John Doe",
            "street1": "7000 Coliseum Way",
            "street2": "",
            "city": "Oakland",
            "state": "CA",
            "zip": "94621",
            "country": "US",
            "phone": "5555551234",
            "email": "example@email.com"
        },
        "from_address": {
            "name": "Shipping Company Name",
            "street1": "1253 W 66th St",
            "street2": "",
            "city": "Los Angeles",
            "state": "CA",
            "zip": "90044",
            "country": "US",
            "phone": "5555551234",
            "email": "example@email.com"
        },
        "item": {
            "piece_count": 1,
            "package_weight": 30,
            "weight_unit": "kg",
            "length": 5,
            "width": 5,
            "height": 5,
            "description": "Clothing"
        }
    },
    "instructions": "Leave at front door",
    "pickup_at": "2024-03-30T17:30:30Z",
    "service_name": "ClearJet Express",
    "label_format": "PDF",
    "Reference1": "Reference1",
    "Reference2": "Reference2",
    "Reference3": "Reference3",
    "Reference4": "Reference4"
}

Example Request

curl
Copied!
copy
curl --location 'https://os.clearjet.com/version-test/api/1.1/wf/shipment' \
--data-raw '{
    "shipment": {
        "to_address": {
            "name": "John Doe",
            "street1": "7000 Coliseum Way",
            "street2": "",
            "city": "Oakland",
            "state": "CA",
            "zip": "94621",
            "country": "US",
            "phone": "5555551234",
            "email": "example@email.com"
        },
        "from_address": {
            "name": "Shipping Company Name",
            "street1": "1253 W 66th St",
            "street2": "",
            "city": "Los Angeles",
            "state": "CA",
            "zip": "90044",
            "country": "US",
            "phone": "5555551234",
            "email": "example@email.com"
        },
        "item": {
            "piece_count": 1,
            "package_weight": 30,
            "weight_unit": "kg",
            "length": 5,
            "width": 5,
            "height": 5,
            "description": "Clothing"
        }
    },
    "instructions": "Leave at front door",
    "pickup_at": "2024-03-30T17:30:30Z",
    "service_name": "ClearJet Express",
    "label_format": "PDF",
    "Reference1": "Reference1",
    "Reference2": "Reference2",
    "Reference3": "Reference3",
    "Reference4": "Reference4"
}'

Example Response

json
Copied!
copy
{
  "shipping_label": "https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20240227/e85d913b3d24224b8b91413ca5f99761bb.pdf",
  "tracking_id": "CJ85007136",
  "tracking_code": "EZ03EAS0000000013551",
  "rate": {
    "carrier": "ClearJet",
    "service": "ClearJet Express",
    "amount": "6.04"
  }
}

Date

Tue, 27 Feb 2024 22:18:46 GMT

Content-Type

text/plain;charset=utf-8

Transfer-Encoding

chunked

Connection

keep-alive

x-powered-by

Express

access-control-allow-origin

*

x-bubble-perf

{"total":5917.8,"percents":{"top":{"bubble_cpu":6,"block":94.1,"capacity_rl":0,"other_pause":0,"pre_fiber":0},"sub":{"pp_userdb":3,"pp_wait_userdb":0,"http_request":57.6,"serverjson":55.1,"appserver_cache_misses_time":0,"redis":83.4,"fiber_queue":4.2,"capacity_wait":0}},"counts":{"pp_userdb":14,"http_request":3,"derived_build":2,"derived_cache_attempts":3,"derived_cache_memory_misses":3,"derived_cache_redis_misses":2,"derived_cache_postgres_misses":2,"serverjson":385,"appserver_cache_attempts":2,"appserver_mem_cache_hits":0,"appserver_cache_hits":0,"appserver_cache_misses":2,"redis":1247,"fiber_queue":480,"blocks":479},"misc":{"userdb_results":17,"userdb_data":10081,"spent_time":95123800,"derived_build_time_spent":90}}

x-bubble-capacity-used

1.463 unit-seconds used

x-bubble-capacity-limit

0 ms slower

vary

Accept-Encoding

CF-Cache-Status

DYNAMIC

Server

cloudflare

CF-RAY

85c3ce104ec33b50-IAD

Content-Encoding

br

curl
Copied!
copy
curl --location 'https://os.clearjet.com/version-test/api/1.1/wf/shipment' \
--data-raw '{
    "shipment": {
        "to_address": {
            "name": "John Doe",
            "street1": "7000 Coliseum Way",
            "street2": "",
            "city": "Oakland",
            "state": "CA",
            "zip": "94621",
            "country": "US",
            "phone": "4153334445",
            "email": "test07114@gmail.com"
        },
        "from_address": {
            "name": "Quince",
            "street1": "5426 W Rosecrans Ave",
            "street2": "",
            "city": "Hawthorne",
            "state": "CA",
            "zip": "90250",
            "country": "US",
            "phone": "8573875756",
            "email": "test19032@gmail.com"
        },
        "items": [
            {
                "piece_count": 1,
                "package_weight": 2,
                "length": 5,
                "width": 5,
                "height": 5,
                "description": "Clothing"
            }
        ]
    },
    "instructions": "Leave at front door",
    "pickup_at": "",
    "service_name": "ClearJet Express",
    "label_format": "PDF"
}'

Example Response

plain
Copied!
copy
{
  "statusCode": 400,
  "body": {
    "status": "INVALID_DATA",
    "messages": [
      {
        "type": "rate_error",
        "carrier": "GSO",
        "message": "the carrier rejected the request as invalid"
      }
    ]
  }
}

Date

Thu, 14 Mar 2024 14:19:35 GMT

Content-Type

text/plain;charset=utf-8

Transfer-Encoding

chunked

Connection

keep-alive

x-powered-by

Express

access-control-allow-origin

*

x-bubble-perf

{"total":997.6,"percents":{"top":{"bubble_cpu":23.5,"block":76.5,"capacity_rl":0,"other_pause":0,"pre_fiber":0.1},"sub":{"pp_userdb":4.8,"pp_wait_userdb":0,"http_request":55.6,"serverjson":11.3,"appserver_cache_misses_time":0,"redis":23.1,"fiber_queue":0.3,"capacity_wait":0}},"counts":{"pp_userdb":12,"http_request":2,"derived_build":0,"serverjson":144,"appserver_cache_attempts":0,"appserver_mem_cache_hits":0,"appserver_cache_hits":0,"appserver_cache_misses":0,"redis":84,"fiber_queue":112,"blocks":111},"misc":{"userdb_results":17,"userdb_data":8465,"spent_time":50221815}}

x-bubble-capacity-used

0.773 unit-seconds used

x-bubble-capacity-limit

0 ms slower

vary

Accept-Encoding

CF-Cache-Status

DYNAMIC

Server

cloudflare

CF-RAY

8644e645eb1a7d54-DFW

Content-Encoding

br

alt-svc

h3=":443"; ma=86400