Calculate rates - AfterShip Shipping API - AfterShip Docs

QUICKSTART

API Quick Start

OAuth

CHANGELOG

REFERENCE

Rates

Labels

Manifests

Couriers

Cancel Labels

Pickups

Cancel Pickups

Shipper Accounts

Specific Shipper Accounts

Address Validations (Beta)

Locations

MODEL

Envelope

Primitive

Resource

Carrier Guide

ENUM

Webhook

SDK

Open Source

Support

Calculate rates

POST https://sandbox-api.aftership.com/postmen/v3/rates

Request

Security: API Key

Headers

Body

{
  "shipper_accounts": [
    {
      "id": "3ba41ff5-59a7-4ff0-8333-64a4375c7f21"
    }
  ],
  "shipment": {
    "ship_from": {
      "contact_name": "AfterShip Shipping",
      "company_name": "AfterShip Shipping",
      "street1": "230 W 200 S LBBY",
      "city": "Salt Lake City",
      "state": "UT",
      "postal_code": "84101",
      "country": "USA",
      "phone": "123456789",
      "email": "test@test.com"
    },
    "ship_to": {
      "contact_name": "AfterShip Shipping",
      "company_name": "AfterShip Shipping",
      "street1": "230 W 200 S LBBY",
      "city": "Salt Lake City",
      "state": "UT",
      "postal_code": "84101",
      "country": "USA",
      "phone": "123456789",
      "email": "test@test.com"
    },
    "parcels": [
      {
        "box_type": "custom",
        "dimension": {
          "width": 10,
          "height": 10,
          "depth": 10,
          "unit": "cm"
        },
        "items": [
          {
            "description": "Food Bar",
            "quantity": 1,
            "price": {
              "currency": "USD",
              "amount": 100
            },
            "item_id": "1234567",
            "origin_country": "CHN",
            "weight": {
              "unit": "kg",
              "value": 10
            },
            "sku": "imac2014",
            "hs_code": "1006.30"
          }
        ],
        "description": "Food XS",
        "weight": {
          "unit": "kg",
          "value": 10
        }
      }
    ],
    "return_to": {
      "contact_name": "AfterShip Shipping",
      "street1": "This is the first streeet",
      "street2": "This is the second streeet",
      "city": "New York",
      "state": "New York",
      "postal_code": "10001",
      "country": "USA",
      "phone": "1-123-456-5496",
      "email": "test@test.test",
      "type": "residential"
    },
    "delivery_instructions": "handle with care"
  }
}

Send API Request

Shell / cURL

curl --request POST \
  --url https://sandbox-api.aftership.com/postmen/v3/rates \
  --header 'Content-Type: application/json' \
  --header 'as-api-key: ' \
  --data '{...}'

Response Example

{
  "meta": {
    "code": 200,
    "type": "OK",
    "message": "Everything worked as expected."
  },
  "data": {
    "created_at": "2015-09-09T07:49:54.060Z",
    "id": "ad1f9340-608d-4a30-be0e-b0a62e07e4cc",
    "updated_at": "2015-09-09T07:49:57.360Z",
    "status": "calculated",
    "rates": [
      {...}
    ]
  }
}