# Quick Start

## Authentication

### Sign String

### OAuth

#### Overview

#### Getting Started

#### Scope List

#### Rate Limit

#### Body Envelope

#### Request Errors

# Changelog

## Reference

### API Overview v3

#### Rates

- [Get rates](/content/docs/shipping/99f88b084657b-get-rates/index.html) (GET)
- [Calculate rates](/content/docs/shipping/f4353677b8ac1-calculate-rates/index.html) (POST)
- [Get a rate](/content/docs/shipping/dc0944cbb5839-get-a-rate/index.html) (GET)

### Labels

- [Get labels](/content/docs/shipping/c056230c3b6c4-get-labels/index.html) (GET)
- [Create a label](/content/docs/shipping/c665e0489b6d9-create-a-label/index.html) (POST)
- [Get a label](/content/docs/shipping/1aa84af009bb2-get-a-label/index.html) (GET)

### Manifests

- [Get manifests](/content/docs/shipping/8ba86e501d12e-get-manifests/index.html) (GET)
- [Create a manifest](/content/docs/shipping/467d57d8c1766-create-a-manifest/index.html) (POST)
- [Get a manifest](/content/docs/shipping/9ca3cc790beee-get-a-manifest/index.html) (GET)

### Couriers

- [Get all couriers](/content/docs/shipping/89c99df22fcd7-get-all-couriers/index.html) (GET)

### Cancel Labels

- [Get the cancelled labels](/content/docs/shipping/24ec02f862c50-get-the-cancelled-labels/index.html) (GET)
- [Cancel a label](/content/docs/shipping/4c82fee7cfe54-cancel-a-label/index.html) (POST)
- [Get a cancelled label](/content/docs/shipping/f173ecb472bca-get-a-cancelled-label/index.html) (GET)

### Pickups

- [Get pickups](/content/docs/shipping/x8mxu5wa7m6y3-get-pickups/index.html) (GET)
- [Create a pickup](/content/docs/shipping/bzel9ue0joeds-create-a-pickup/index.html) (POST)
- [Get a pickup](/content/docs/shipping/ytjdnwbl7dqxb-get-a-pickup/index.html) (GET)

### Cancel Pickups

- [Get the cancelled pickups](/content/docs/shipping/35p8o3dsqpaqc-get-the-cancelled-pickups/index.html) (GET)
- [Cancel a pickup](/content/docs/shipping/nmi7kbs8wavn2-cancel-a-pickup/index.html) (POST)
- [Get a cancelled pickup](/content/docs/shipping/lgdp9svgf645n-get-a-cancelled-pickup/index.html) (GET)

### Shipper Accounts

- [Get shipper accounts](/content/docs/shipping/5742112a2c755-get-shipper-accounts/index.html) (GET)
- [Create a shipper account](/content/docs/shipping/02bbb6a0e0b27-create-a-shipper-account/index.html) (POST)
- [Get a shipper account](/content/docs/shipping/51195022963fd-get-a-shipper-account/index.html) (GET)
- [Delete a shipper account](/content/docs/shipping/cef1918aaf9df-delete-a-shipper-account/index.html) (DELETE)
- [Update a shipper account's information](/content/docs/shipping/a57d4ec851992-update-a-shipper-account-s-information/index.html) (PUT)
- [Update a shipper account's credentials](/content/docs/shipping/093809311940d-update-a-shipper-account-s-credentials/index.html) (PATCH)
- [Update a shipper account's settings](/content/docs/shipping/0xlo21h5n3o1j-update-a-shipper-account-s-settings/index.html) (PATCH)

### Specific Shipper Accounts

- [Create a FedEx shipper account](/content/docs/shipping/c1hmaoymtcjf2-create-a-fed-ex-shipper-account/index.html) (POST)
- [Update a FedEx shipper account](/content/docs/shipping/alkwtehrfwa1s-update-a-fed-ex-shipper-account/index.html) (POST)

### Address Validations (Beta)

- [Create an address validation](/content/docs/shipping/f88a36ecf54a2-create-an-address-validation/index.html) (POST)

### Locations

- [Get locations](/content/docs/shipping/bdb851fc7dfdc-get-locations/index.html) (GET)

# Model

## Envelope

- [Meta v3](/content/docs/shipping/model/envelope/meta/index.html)  
- [Error v3](/content/docs/shipping/model/envelope/error/index.html)

## Primitive

- [Billing v3](/content/docs/shipping/model/primitive/billing/index.html)  
- [Customs v3](/content/docs/shipping/model/primitive/customs/index.html)  
- [Shipment v3](/content/docs/shipping/model/primitive/shipment/index.html)  
- [Address v3](/content/docs/shipping/model/primitive/address/index.html)  
- [Parcel v3](/content/docs/shipping/model/primitive/parcel/index.html)  
- [Item v3](/content/docs/shipping/model/primitive/item/index.html)  
- [Courier v3](/content/docs/shipping/model/primitive/courier/index.html)  
- [Reference v3](/content/docs/shipping/model/primitive/reference/index.html)  
- [Money v3](/content/docs/shipping/model/primitive/money/index.html)  
- [PaymentMethodAccount v3](/content/docs/shipping/model/primitive/payment-method-account/index.html)  
- [Dimension v3](/content/docs/shipping/model/primitive/dimension/index.html)  
- [Weight v3](/content/docs/shipping/model/primitive/weight/index.html)  
- [Volume v3](/content/docs/shipping/model/primitive/volume/index.html)  
- [Aes v3](/content/docs/shipping/model/primitive/aes/index.html)  
- [NoEei v3](/content/docs/shipping/model/primitive/no-eei/index.html)

## Resource

- [Rate v3](/content/docs/shipping/model/resource/rate/index.html)  
- [RateRecord v3](/content/docs/shipping/model/resource/rate-record/index.html)  
- [Label v3](/content/docs/shipping/model/resource/label/index.html)  
- [Manifest v3](/content/docs/shipping/model/resource/manifest/index.html)  
- [ShipperAccount v3](/content/docs/shipping/model/resource/shipper-account/index.html)  
- [CancelLabel v3](/content/docs/shipping/model/resource/cancel-label/index.html)  
- [AddressValidation (Beta) v3](/content/docs/shipping/model/resource/address-validation/index.html)  
- [Location v3](/content/docs/shipping/model/resource/location/index.html)  
- [Pickup v3](/content/docs/shipping/model/resource/pickups/index.html)  
- [CancelPickup v3](/content/docs/shipping/model/resource/cancel-pickup/index.html)

### Carrier Guide

- [Supported Carriers](/content/docs/shipping/carrier-guide-supported-couriers/index.html)

### ENUM

- [Shipper Accounts Credentials](/content/docs/shipping/enum/shipper-accounts-credentials/index.html)
- [Service Types and Service Options List](/content/docs/shipping/enum/service-options-lists/index.html)
- [All Service Options](/content/docs/shipping/enum/all-service-options/index.html)

### Webhook

- [Webhook Overview](/content/docs/shipping/webhook/webhook-overview/index.html)
- [Webhook Specifications](/content/docs/shipping/webhook/webhook-specifications/index.html)
- [Webhook Signature](/content/docs/shipping/webhook/webhook-signature/index.html)
- [Webhook Outgoing IPs](/content/docs/shipping/webhook/webhook-outgoing-ips/index.html)

### SDK

- [Java SDK](https://github.com/AfterShip/shipping-sdk-java)
- [Node.js SDK](https://github.com/postmen/postmen-sdk-js)

### Open Source

- [phone](https://github.com/AfterShip/phone)
- [email-verifier](https://github.com/AfterShip/email-verifier)

### Support

- [Contact Support](https://support.postmen.com/en/)

# 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](../docs/enum/all-service-options.md) and [service options list](../docs/enum/service-types-and-service-options-lists.md) for details.  
This array contains reference data. Please refer to [reference](../model/primitive/reference.v3.json) object for label object details.

## Request

- **Security**: API Key

### Headers

- `Content-Type`: string (required)
  - Default: application/json

### Body

Create a label object.  
- **billing**: Billing object: the description of billing information
  - paid_by: string (required)
    - Allowed values: shipper, third_party, recipient
  - method: PaymentMethodAccount
  - customs: Customs object: the description of customs information
  - purpose: string (required)
    - Allowed values: gift, merchandise, personal, sample, return, repair, non-merchandise
  - terms_of_trade: string
  - eei: AESNOEEI
  - importer_address: Address
  - broker_address: Address
  - additional_charges: array[object]
    - This array contains additional_charges object. Additional charge to be added to the commercial invoice of this shipment. Only applies to FedEx, DHL Express, UPS currently.
    - <= 3 items
  - return_shipment: boolean (set to false if not provided)
  - is_document: boolean (If the shipment is document type. Set to false if not provided)
  - service_type: string
  - paper_size: string
  - shipper_account: object
    - id: string
    - references: array[string]
  - shipment: Shipment object: the description of shipment information
    - refer to [shipment](../model/resource/label.v3.json) object.
  - tax_total: Money
  - ship_from: Address (required)
    - Address object: the description of address information
  - ship_to: Address (required)
    - Address object: the description of address information
  - parcels: array[Parcel] (required)
    - Parcels of shipment
  - return_to: Address
  - delivery_instructions: string
  - invoice: Invoice or null
    - Invoice object: the description of invoice type, commercial invoice will be generated if field is present in the request body
  - date: string (required)
    - Invoice date in YYYY-MM-DD
  - number: string
  - type: string
    - Allowed values: commercial, proforma
  - number_of_copies: integer (>= 1, <= 4)
  - signature_name: string
  - declaration_statement: string
  - service_options: array[object]
    - This array contains service_options object. Please refer to [all service options](/content/docs/shipping/enum/all-service-options/index.html) and [service types and service options list](/content/docs/shipping/enum/service-options-lists/index.html) for details.
  - file_type: string
    - Allowed values: pdf, zpl
  - ship_date: string
    - Ship Date in YYYY-MM-DD, if not provided, will be today of the shipper account timezone
  - order_number: string
    - A user-defined order number used to identify an order.
  - order_id: string
    - Unique identification of the order.
  - custom_fields: object
    - Custom fields that accept an object with string field.
  - files: InputFiles
    - Files object: additional shipping documents to upload with label generation. Only applies to FedEx, DHL Express currently.
  - certificate_of_origin: object
  - commercial_invoice: object
  - customs_declaration: object
  - print_options: object
    - qr_code: object
      - Whether to return the qr_code when creating a label
      - Supported slug: `arvato`, `canada-post`, `dpd-uk`, `evri`, `vesyl`, `usps`, `poste-italiane`, `pitney-bowes`, `dpd-nl`, `dpd-prt`, `mondialrelay`
      - automatic: boolean (When set to `true`, automation rules configured for the organization will be applied to this label request. Enterprise only.)

### Responses

- **200 OK**

### Body

- **meta**: Meta data object.
- **data**: Label object: the description of label object
    - This array contains service_options object. Please refer to [all service options](../../docs/enum/all-service-options.md) and [service options list](../../docs/enum/service-options-lists.md) for details.
    - This array contains reference data. Please refer to [reference](../model/primitive/reference.v3.json) object for label object details.
    - **id**: string
    - **status**: string
      - Allowed values: creating, created, cancelling, cancelled, manifesting, manifested, failed
    - **ship_date**: string
    - **tracking_numbers**: array[string]
    - **carrier_references**: array[object]
    - **files**: Files object: the description of 6 different file objects(label, qr_code, invoice, customs_declaration, packing_slip, manifest)
    - **rate**: Rate object: the description of rate information
    - **created_at**: string
      - A formatted date.
    - **updated_at**: string
      - A formatted date.
    - **references**: array[string] or null
    - **shipper_account**: Reference object: the description of reference information
    - **service_type**: string
    - **order_number**: string
    - **service_options**: array[object]
    - **order_id**: string
    - **custom_fields**: object
    - **carrier_redirect_link**: string or null

### Auth

- as-api-key:
  - Parameters
  - Content-Type*:

## Request Sample: Shell / cURL

```shell
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

```json
{
  "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"
  }
}
```
