Create a label - AfterShip Shipping API - AfterShip Docs

Quick Start

Authentication

Sign String

OAuth

Overview

Getting Started

Scope List

Rate Limit

Body Envelope

Request Errors

Changelog

Reference

API Overview v3

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

Create a label

POST

Endpoint

https://sandbox-api.aftership.com/postmen/v3/labels

Create a label.
This array contains service_options object. Please refer to all service options and service options list for details.
This array contains reference data. Please refer to reference object for label object details.

Request

Headers

Body

Create a label object.

Responses

Body

Auth

Request Sample: Shell / cURL

curl --request POST \
  --url https://sandbox-api.aftership.com/postmen/v3/labels \
  --header 'Content-Type: application/json' \
  --header 'as-api-key: ' \
  --data '{
    "return_shipment": false,
    "is_document": false,
    "service_type": "ups_ground",
    "paper_size": "4x6",
    "shipper_account": {
        "id": "3ba41ff5-59a7-4ff0-8333-64a4375c7f21"
    },
    "references": ["refernce1"],
    "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": "19835553752",
            "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": "19835553752",
            "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": 1
                        },
                        "sku": "imac2014",
                        "hs_code": "100630",
                        "return_reason": "too big"
                    }
                ],
                "description": "Food XS",
                "weight": {
                    "unit": "kg",
                    "value": 1
                }
            }
        ]
    },
    "custom_fields": {
        "ship_code": "01"
    },
    "print_options": {
        "qr_code": {
            "enabled": true
        }
    }
}'

Response Example

{
  "meta": {
    "code": 200,
    "message": "OK",
    "details": []
  },
  "data": {
    "id": "3318b97b-150f-4205-840d-a6d966b9e0ea",
    "status": "created",
    "tracking_numbers": ["3884930103"],
    "files": {
      "label": {
        "paper_size": "4x8",
        "url": "https://sandbox-download.postmen.com/label/2015-11-27/00000000-0000-0000-0000-000000000000-1441785264309885.pdf",
        "file_type": "pdf"
      },
      "invoice": null,
      "customs_declaration": null,
      "manifest": null
    },
    "rate": {
      "charge_weight": {
        "value": 3.307,
        "unit": "lb"
      },
      "total_charge": {
        "amount": 0,
        "currency": "USD"
      },
      "shipper_account": {
        "id": "00000000-0000-0000-0000-000000000000",
        "slug": "dhl",
        "description": "DHL Sandbox"
      },
      "service_type": "dhl_express_0900",
      "service_name": "DHL Express 0900",
      "pickup_deadline": null,
      "booking_cut_off": null,
      "delivery_date": null,
      "transit_time": null,
      "detailed_charges": [],
      "error_message": null,
      "info_message": null
    },
    "created_at": "2022-05-09T07:54:13.024Z",
    "updated_at": "2022-09-09T07:54:24.569Z",
    "ship_date": "2022-09-09"
  },
  "custom_fields": {
    "ship_code": "01"
  }
}