Nightline API Docs
Empower Your Dev Team with the Nightline Tracking API via AfterShip.
Integrate seamless Nightline tracking integration with robust RESTful API and webhooks to automate Nightline delivery updates in real-time.
With an AfterShip developer account, you'll experience fast tracking updates and industry-leading 99.9% API uptime. Enhance your logistics now with the Nightline Tracking API.
09:56 AM
192 Glenlake CourtSee more info
Nightline Tracking API
Create a tracking
Creates a new tracking object.
Parameters
tracking_number
string required
Tracking number of a shipment. Duplicated tracking numbers, tracking numbers with invalid tracking number format will not be accepted.
Only accept tracking numbers with length from 4 to 100slug
string, staticnightline
.title
string
By default this field shows thetracking_number
, but you can customize it as you wish with any info (e.g. the order number).order_id
string
A globally-unique identifier for the order.order_promised_delivery_date
string
The promised delivery date of the order. It uses the formatYYYY-MM-DD
. This has no timezone and uses whatever date you provide. Since other EDDs use the shipment recipient’s timezone, we suggest following the same logic here.
Returns
Return a tracking object if the call succeeded.
Retrieve a tracking
Retrieves the details of an existing tracking. Supply the unique tracking ID from either a tracking creation request or the tracking list, and AfterShip will return the corresponding tracking information.
Parameters
fields
string
List of fields to include in the response. Use comma for multiple values. Fields to include:tracking_postal_code
,tracking_ship_date
,tracking_account_number
,tracking_key
,tracking_origin_country
,tracking_destination_country
,tracking_state
,title
,order_id
,tag
,checkpoints
lang
string
Translate checkpoint messages from the carrier’s provided language to the target language.
Returns
Returns a tracking object if a valid identifier was provided.
Update a tracking
Updates the specific tracking by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
Parameters
smses
array[string]
The phone number(s) to receive sms notifications. Input [] to clear the value of this field. Supports up to 3 phone numbers.emails
array[string]
Email address(es) to receive email notifications. Input [] to clear the value of this field. Supports up to 3 email addresses.title
string
By default this field shows the tracking_number, but you can customize it as you wish with any info (e.g. the order number).customer_name
string
Customer name of the tracking.order_id
string
A globally-unique identifier for the order.order_id_path
string
The URL for the order in your system or store.note
string
Text field for the note. Input""
to clear the value of this field.language
string
The recipient’s language. If you set up AfterShip notifications in different languages, we use this to send the recipient tracking updates in their preferred language. Use an ISO 639-1 Language Code to specify the language.order_promised_delivery_date
string
The promised delivery date of the order. It uses the format YYYY-MM-DD. This has no timezone and uses whatever date you provide. Since other EDDs use the shipment recipient’s timezone, we suggest following the same logic here.
Returns
Returns the tracking object if the update succeeded.
Delete a tracking
Delete a tracking.
Parameters
id
string required
Tracking ID
Returns
Returns a deleted object on success. Otherwise, this call raises an error.
Retrack an expired tracking
Retrack an expired tracking. Max 3 times per tracking.
Parameters
id
string, required
Tracking ID
Returns
Returns the tracking object if the retrack succeeded.
Mark tracking as completed
Mark a tracking as completed. The tracking won't auto update until retrack it.
Parameters
reason
string required
required
One of DELIVERED
, LOST
or RETURNED_TO_SENDER
.
- Mark the tracking as completed with
DELIVERED
. The tag of the tracking will be updated to Delivered and the subtag will be updated toDelivered_001
. - Mark the tracking as completed with
LOST
. The tag of the tracking will be updated toException
and the subtag will be updated toException_013
. - Mark the tracking as completed with
RETURNED_TO_SENDER
. The tag of the tracking will be updated to Exception and the subtag will be updated toException_011
.
Allowed values: DELIVERED
LOST
RETURNED_TO_SENDER
Returns
meta
meta required
Meta data
code
integer required
meta code
Example:200
message
string
error message, only exist if the response status is not 2xxtype
string
error type, only exist if the response status is not 2xx
Allowed values:BadRequest
Unauthorized
Forbidden
NotFound
TooManyRequests
InternalError
data
object requiredtracking
Tracking
Object describes the tracking information.
Nightline Last Checkpoint API
Get last checkpoint
Return the tracking information of the last checkpoint of a single tracking.
Parameters
fields
string
List of fields to include in the response. Use comma for multiple values. Fields to include:slug
,created_at
,checkpoint_time
,city
,coordinates
,country_iso3
,country_name
,message
,state
,tag
,zip
Example:city,tag
lang
string
Support Chinese to English translation forchina-ems
andchina-post
only
Example:en
Returns
meta
metacode
integer required
meta code
Example: 200message
string
error message, only exist if the response status is not 2xxtype
string
error type, only exist if the response status is not 2xx
Allowed values:BadRequest
Unauthorized
Forbidden
NotFound
TooManyRequests
InternalError
data
objectid
string
Tracking idtracking_number
string
Tracking number.slug
string nightline
Unique code of courier.tag
string
Current status of tracking. (See tag definition)
Allowed values:Pending
InfoReceived
InTransit
OutForDelivery
AttemptFail
Delivered
AvailableForPickup
Exception
Expired
Example:Delivered
subtag
string
Current subtag of tracking. ([See subtag definition]subtag_message
string
Normalized tracking message. (See subtag message definition)checkpoint
Checkpoint
Object describes checkpoint information.
Nightline Estimated delivery date API
Batch predict the estimated delivery date
The estimated delivery date is provided by AfterShip, based on its AI-predictive model. You can display the EDD on the product page, cart, and order checkout page. It indicates when a customer will receive the order.
You can use AfterShip’s AI-powered predictive estimated delivery date API to provide expected delivery dates to shoppers for online orders without tracking numbers. You can get the earliest date, the latest date, and the most-likely-arrival date through our AI-predictive EDD API.
Display accurate estimated delivery dates on the product page, store cart, and order checkout page to encourage customers to check out faster and give them a better customer experience.
Contact sales to activate this feature.
Supported functionalities require:
- One
EstimatedDeliveryDate
object for one prediction result. - Maximum 5
EstimatedDeliveryDate
objects are allowed. - API call will fail if any of the requests
EstimatedDeliveryDate
objects do not meet the specification requirement.
Parameters
estimated_delivery_dates
array[EstimatedDeliveryDate] required
>= 1 items
<= 5 items
slug
stringnightline
required
AfterShip's unique code of courier. Please refer to https://track.aftership.com/couriers/download.service_type_name
string or null
AfterShip’s unique code represents carrier’s shipping and delivery options. Refer to Download Link.origin_address
objectrequired
The location from where the package is picked up by the carrier to be delivered to the final destination.destination_address
objectrequired
The final destination of the customer where the delivery will be made.weight
object or null
AfterShip uses this object to calculate the total weight of the order.package_count
integer or null
The number of packages.pickup_time
string or null
The local pickup time in the origin address time zone of the package.estimated_pickup
object or null
The local pickup time of the package. Eitherpickup_time
orestimated_pickup
is required.
Returns
meta
meta requiredcode
integer required
meta codemessage
string
error message, only exist if the response status is not 2xxtype
string
error type, only exist if the response status is not 2xx
Allowed values:BadRequest
Unauthorized
Forbidden
NotFound
TooManyRequests
InternalError
- data object required
estimated_delivery_dates
array[EstimatedDeliveryDate] required
Nightline Rate API
Nightline Label API
Create a label
Create a label.
Parameters
billing
Billing
Billing object: the description of billing informationpaid_by
string required
Allowed values:shipper
third_party
recipient
method
PaymentMethodAccount
PaymentMethodAccount object: the description of account information
customs
Customs
Customs object: the description of customs informationpurpose
string required
Allowed values:gift
merchandise
personal
sample
return
repair
non-merchandise
terms_of_trade
string
Allowed values:dat
ddu
ddp
dap
exw
fca
fob
cip
cif
cpt
cfr
dpu
eei
one of: AES
AES object: the description of EEI Type - aesbilling
Billing
Billing object: the description of billing informationimporter_address
Address
Address object: the description of address informationpassport
object
Passport Objectadditional_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, UPS currently.
shipment
Shipment
Shipment object: the description of shipment informationship_from
Address required
Address object: the description of address informationship_to Address
required
Address object: the description of address informationparcels
array[Parcel] required
Parcels of shipmentreturn_to
Address
Address object: the description of address informationdelivery_instructions
string
Instructions to aid in prompt delivery of the shipment.
Return
meta
Meta
Meta data object.code
integer required
Code of Metamessage
string required
Message of Metadetails
array[Error]
Details of Metaretryable
boolean
Whether this request will be retryable or not
data
Label
Label object: the description of label objectid
string
Label IDstatus
string
Allowed values:creating
created
cancelling
cancelled
manifesting
manifested
failed
ship_date
string
tracking_numbers
array[string]
Get a label
Get a label.
Parameters
id
string required
label id
Returns
meta
Meta
Meta data object.code
integer required
Code of Metamessage
string required
Message of Metadetails
array[Error]
Details of Metaretryable
boolean
Whether this request will be retryable or not
data
Label
Label object: the description of label objectid
string
Label IDstatus
string
Allowed values:creating
created
cancelling
cancelled
manifesting
manifested
failed
Nightline Manifest API
Nightline Cancel Label API
Nightline Pickup API
Nightline Cancel Pickup API
Nightline Shipper Account API
Create a shipper account
This endpoint allows you to create your shipper account via API. You can integrate our API with your system and manage the shipper account according to your needs.
Please ensure that your account credentials are correct. Different carriers have different requirements for account credentials, you can refer to Shipper account's credetials for more details.
Parameters
slug
stringnightline
description
stringtimezone
stringcredentials
object
Please refer to Shipper account's credetialsaddress
Address
Address object: the description of address informationstreet1
string required
address_line1 of addresscountry
string required
Country in ISO 3166-1 alpha 3 codecontact_name
string required
contact_name of address
Returns
meta
Meta
Meta data object.code
integer required
Code of Metamessage
string required
Message of Metadetails
array[Error]
Details of Metaretryable
boolean
Whether this request will be retryable or not
data
ShipperAccount
ShipperAccount object: the description of shipper account informationid
string
Shipper Account IDaddress
Address
Address object: the description of address information
Get a shipper account
This endpoint allows you get a specific shipper account details by shipper account id.
Parameters
id
string required
Shipper account id
Returns
meta
Meta
Meta data object.code
integer required
Code of Metamessage
string required
Message of Metadetails
array[Error]
Details of Metaretryable
boolean
Whether this request will be retryable or not
data
ShipperAccount
ShipperAccount object: the description of shipper account informationid
string
Shipper Account IDaddress
Address
Address object: the description of address information
Nightline Address Validation (Beta) API
Create an address validation
Create an address validation
Parameters
address
Address
Address object: the description of address informationstreet1
string required
address_line1 of addresscountry
string required
Country in ISO 3166-1 alpha 3 codecontact\_name
string required
contact_name of address
Returns
meta
Meta
Meta data object.code
integer required
Code of Metamessage
string required
Message of Metadetails
array[Error]
Details of Metaretryable
boolean
Whether this request will be retryable or not
data
ShipperAccount
ShipperAccount object: the description of shipper account informationid
string
Shipper Account IDaddress
Address
Address object: the description of address information
Frequently Asked Questions
How to generate Nightline API key?
To ensure secure access, AfterShip requires an as-api-key in the header of each request. You can request a free API key by submitting the form. Get a free API Key
Do I need a Nightline developer account to use this API?
No, you don't need a Nightline account. AfterShip has partnered with Nightline, allowing you direct access to Nightline tracking data through the AfterShip API.
Enhance the entire post-purchase experience with AfterShip
Integrate Nightline and Multi-Carrier Tracking APIs
Easily integrate shipment tracking into your system or website for a seamless tracking experience. AfterShip's tracking API allows you to offer shipment visibility across multiple touchpoints without stretching your development resources.- Global coverage: 1,100+ carrier integrations and 52+ languages
- Accuracy: Normalized data and standardized 7 main-statuses and 33 sub-statuses
- Data integrity: AI helps recognize new tracking number patterns
- Uptime & Reliability: 99.99%+ uptime, ISO 27001, SOC2, and GDPR compliance