---
canonical_url: "https://docs.composio.dev/toolkits/aftership"
markdown_url: "https://docs.composio.dev/toolkits/aftership.md"
product: "platform"
version: null
last_updated: null
---

# AfterShip

AfterShip provides shipment tracking, courier detection and connections, and estimated delivery date prediction for ecommerce operations.

- **Category:** ecommerce
- **Auth:** API_KEY
- **Composio-managed OAuth available?** N/A
- **Tools:** 17
- **Triggers:** 0
- **Slug:** `AFTERSHIP`
- **Version:** 00000000_00

## Tools

### Create Courier Connection

**Slug:** `AFTERSHIP_CREATE_COURIER_CONNECTION`

Connect one courier account using the courier-specific credential fields advertised by courier metadata.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `courier_slug` | string | Yes | Courier slug to connect. Use LIST_COURIERS to resolve the slug and inspect its required credential fields. |
| `carrier_account_fields` | object | Yes | Carrier-specific secret values keyed by the exact field names from the courier's credentials.fields metadata. Values are sent only to AfterShip; do not use this field for non-secret metadata, and credential values are never included in this action's output. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Create Tracking

**Slug:** `AFTERSHIP_CREATE_TRACKING`

Create one shipment tracking record from a tracking number and optional courier, order, route, customer, and delivery metadata.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `id` | string | No | Optional caller-defined tracking ID; omit to let AfterShip generate one. |
| `note` | string | No | Internal note associated with the tracking. |
| `title` | string | No | Human-readable tracking title. |
| `language` | string | No | Recipient ISO 639-1 language code. |
| `order_id` | string | No | Globally unique order identifier. |
| `customers` | array | No | Customers associated with the tracking, up to three. |
| `last_mile` | object | No | Known last-mile courier and tracking number. |
| `order_date` | string | No | Order date-time, preferably including its timezone. |
| `location_id` | string | No | AfterShip fulfillment location ID; cannot be combined with explicit origin fields. |
| `origin_city` | string | No | Origin city. |
| `pickup_note` | string | No | Pickup instructions shown to the recipient. |
| `courier_slug` | string | No | Courier slug; cannot be combined with courier_slug_group. |
| `order_number` | string | No | Human-readable order number. |
| `origin_state` | string | No | Origin state or province. |
| `tracking_key` | string | No | Additional carrier tracking credential required by some couriers. |
| `custom_fields` | object | No | Non-personal custom string fields associated with the shipment. |
| `delivery_type` | string ("pickup_at_store" | "door_to_door" | "pickup_at_courier") | No | Shipment delivery method. |
| `order_id_path` | string | No | URL for the order in the merchant system. |
| `shipment_tags` | array | No | Tags used to categorize the shipment. |
| `shipment_type` | string | No | Carrier service type for the shipment. |
| `pickup_location` | string | No | Pickup location shown to the recipient. |
| `shipping_method` | string | No | Merchant-facing shipping method name. |
| `tracking_number` | string | Yes | Carrier tracking number for the shipment. |
| `destination_city` | string | No | Destination city. |
| `destination_state` | string | No | Destination state or province. |
| `courier_slug_group` | string | No | Courier slug group for detection; cannot be combined with courier_slug. |
| `origin_postal_code` | string | No | Origin postal code. |
| `shipment_direction` | string ("forward" | "return") | No | Direction in the ecommerce fulfillment lifecycle. |
| `tracking_ship_date` | string | No | Shipment-ready date or date-time accepted by the courier. |
| `origin_raw_location` | string | No | Unstructured origin address. |
| `courier_connection_id` | string | No | Courier connection to use when multiple accounts exist for the courier. |
| `origin_country_region` | string | No | Origin ISO 3166-1 alpha-3 country or region code. |
| `destination_postal_code` | string | No | Destination postal code. |
| `tracking_account_number` | string | No | Carrier account number required by some couriers. |
| `destination_raw_location` | string | No | Unstructured destination address. |
| `destination_country_region` | string | No | Destination ISO 3166-1 alpha-3 country or region code. |
| `order_promised_delivery_date` | object | No | Promised delivery date or range in the recipient timezone. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Create Trackings Batch

**Slug:** `AFTERSHIP_CREATE_TRACKINGS_BATCH`

Sequentially create 1-20 tracking records through AfterShip's single-record create endpoint. This operation is non-atomic: each item consumes one request, successful earlier creates are not rolled back, and no create is retried automatically. Item-specific 400 and 409 rejections do not stop later items; authentication, permission, rate-limit, server, malformed-success, and transport failures stop processing and mark remaining items not_attempted.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `trackings` | array | Yes | Tracking records to create in order, from 1 to 20. Each item uses the full single-tracking create contract and consumes one provider request. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Delete Courier Connection

**Slug:** `AFTERSHIP_DELETE_COURIER_CONNECTION`

Permanently remove one courier account connection by an ID obtained from list or create. Warning: this destructive action cannot be undone.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `courier_connection_id` | string | Yes | Courier connection ID to permanently remove. Use an ID returned by LIST_COURIER_CONNECTIONS or CREATE_COURIER_CONNECTION. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Delete Tracking

**Slug:** `AFTERSHIP_DELETE_TRACKING`

Permanently delete one tracking record by its AfterShip tracking ID. Warning: this destructive action cannot be undone.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `tracking_id` | string | Yes | AfterShip tracking ID to permanently delete. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Detect Courier

**Slug:** `AFTERSHIP_DETECT_COURIER`

Return couriers that may handle a tracking number, using optional courier and shipment hints to narrow detection.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `tracking_key` | string | No | Additional carrier tracking credential used as a detection hint. |
| `courier_slugs` | array | No | Candidate courier slugs; cannot be combined with courier_slug_group. |
| `tracking_number` | string | Yes | Carrier tracking number to analyze. |
| `destination_state` | string | No | Destination state or province used as a detection hint. |
| `courier_slug_group` | string | No | Candidate courier slug group; cannot be combined with courier_slugs. |
| `tracking_ship_date` | string | No | Shipment date in YYYYMMDD format when required by a courier. |
| `origin_country_region` | string | No | Origin uppercase ISO 3166-1 alpha-3 country or region code. |
| `destination_postal_code` | string | No | Destination postal code used as a courier-specific hint. |
| `tracking_account_number` | string | No | Carrier account number used as a detection hint. |
| `destination_country_region` | string | No | Destination uppercase ISO 3166-1 alpha-3 country or region code. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Get Courier Connection

**Slug:** `AFTERSHIP_GET_COURIER_CONNECTION`

Return one courier account connection by an ID obtained from list or create.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `courier_connection_id` | string | Yes | Courier connection ID returned by list or create; do not invent a UUID. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Get Tracking

**Slug:** `AFTERSHIP_GET_TRACKING`

Return one tracking record by its AfterShip tracking ID, with optional field selection and checkpoint translation.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `fields` | array | No | Response fields to include; omit for the full tracking object. |
| `language` | string | No | Target language code for translated checkpoint messages. |
| `tracking_id` | string | Yes | AfterShip tracking ID returned by create or list, not the carrier tracking number. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### List Courier Connections

**Slug:** `AFTERSHIP_LIST_COURIER_CONNECTIONS`

Return one cursor-controlled page of courier account connections, optionally filtered by courier slug.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `limit` | integer | No | Maximum connections to return in this page (1-200). |
| `cursor` | string | No | Opaque next cursor returned by a previous call; omit for the first page. |
| `courier_slug` | string | No | Courier slug whose connections should be returned. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### List Couriers

**Slug:** `AFTERSHIP_LIST_COURIERS`

Return courier metadata, optionally limited to account-activated couriers or selected courier slugs, including required tracking and credential field definitions.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `active` | boolean | No | Set true to return couriers activated for the connected AfterShip account; omit to use provider default behavior. |
| `courier_slugs` | array | No | Courier slugs to return. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### List Trackings

**Slug:** `AFTERSHIP_LIST_TRACKINGS`

Return one cursor-controlled page of shipment trackings, optionally filtered by identifiers, courier, status, dates, route, or shipment metadata.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `tag` | string ("Pending" | "InfoReceived" | "InTransit" | "OutForDelivery" | "AttemptFail" | "Delivered" | "AvailableForPickup" | "Exception" | "Expired") | No | Tracking status to match. |
| `limit` | integer | No | Maximum trackings to return in this page (1-200). |
| `cursor` | string | No | Opaque next cursor returned by a previous call; omit for the first page. |
| `fields` | array | No | Optional response fields to include. |
| `keyword` | string | No | Search text for matching trackings. |
| `order_ids` | array | No | Order IDs to match. |
| `transit_time` | integer | No | Match shipments with this transit time in days. |
| `courier_slugs` | array | No | Courier slugs to match. |
| `shipment_tags` | array | No | Shipment tags to match. |
| `created_at_max` | string | No | Inclusive upper bound for creation time. |
| `created_at_min` | string | No | Inclusive lower bound for creation time. |
| `updated_at_max` | string | No | Inclusive upper bound for update time. |
| `updated_at_min` | string | No | Inclusive lower bound for update time. |
| `return_to_sender` | array | No | Filter by return-to-sender state. |
| `tracking_numbers` | array | No | Tracking numbers to match, up to 50. |
| `origin_country_regions` | array | No | Origin ISO alpha-3 country or region codes. |
| `destination_country_regions` | array | No | Destination ISO alpha-3 country or region codes. |
| `courier_destination_country_region` | string | No | Courier-resolved destination country or region code. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Mark Tracking Completed

**Slug:** `AFTERSHIP_MARK_TRACKING_COMPLETED`

Mark a tracking as delivered, lost, or returned to sender. Warning: a successful call stops automatic tracking updates until the tracking is retracked.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `reason` | string ("DELIVERED" | "LOST" | "RETURNED_TO_SENDER") | Yes | Completion outcome to record: delivered, lost, or returned to sender. |
| `tracking_id` | string | Yes | AfterShip tracking ID to mark completed, not the carrier tracking number. |
| `event_datetime` | string | No | When the completion event occurred, as YYYY-MM-DD, YYYY-MM-DDTHH:mm:ss, or YYYY-MM-DDTHH:mm:ssZ. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Predict Estimated Delivery Date

**Slug:** `AFTERSHIP_PREDICT_ESTIMATED_DELIVERY_DATE`

Predict an estimated delivery date before a tracking number exists. This paid endpoint requires Predict trial access or an AfterShip advanced plan.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `weight` | object | No | Total package weight. |
| `pickup_time` | string | No | Known local pickup date-time in the origin time zone; do not combine with estimated_pickup. |
| `courier_slug` | string | Yes | AfterShip courier slug for the planned shipment. |
| `package_count` | integer | No | Number of packages in the shipment. |
| `origin_address` | object | Yes | Origin address with a country code and either a state or postal code. |
| `estimated_pickup` | object | No | Order schedule from which AfterShip should estimate pickup; do not combine with pickup_time. |
| `service_type_name` | string | No | Courier service type used for the shipment. |
| `destination_address` | object | Yes | Destination address with a country code and either a state or postal code. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Predict Estimated Delivery Dates Batch

**Slug:** `AFTERSHIP_PREDICT_ESTIMATED_DELIVERY_DATES_BATCH`

Predict estimated delivery dates atomically for one to five planned shipments. One invalid item fails the whole batch. The connected AfterShip organization must have a Predict trial or advanced-plan entitlement.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `estimated_delivery_dates` | array | Yes | One to five prediction requests. Every item requires a courier, both addresses, and exactly one pickup-time form. One invalid item fails the entire batch. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Retrack Tracking

**Slug:** `AFTERSHIP_RETRACK_TRACKING`

Restart automatic updates for an expired tracking. Only expired trackings are eligible, and each successful call irreversibly consumes one of at most three retrack attempts for that tracking.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `tracking_id` | string | Yes | AfterShip ID of an expired tracking to retrack. This action only accepts expired trackings, and each successful call consumes one of the tracking's maximum three retrack attempts. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Update Courier Connection

**Slug:** `AFTERSHIP_UPDATE_COURIER_CONNECTION`

Replace carrier-specific credentials on an existing courier account connection. Warning: this consequential credential rotation replaces the complete credential set; incorrect values can stop future tracking updates.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `courier_connection_id` | string | Yes | Courier connection ID returned by list or create. |
| `carrier_account_fields` | object | Yes | Complete carrier-specific secret values keyed by the exact field names advertised for this connection's courier. Values are sent only to AfterShip and are never included in this action's output. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Update Tracking

**Slug:** `AFTERSHIP_UPDATE_TRACKING`

Update editable order, courier, route, customer, and delivery metadata on an existing tracking record.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `note` | string | No | Replacement internal note. |
| `title` | string | No | Replacement human-readable tracking title. |
| `language` | string | No | Replacement recipient ISO 639-1 language code. |
| `order_id` | string | No | Replacement globally unique order identifier. |
| `customers` | array | No | Replacement customer list, up to three. |
| `last_mile` | object | No | Replacement last-mile courier and tracking number. Send null explicitly to clear the existing last-mile value. |
| `order_date` | string | No | Replacement order date-time. |
| `location_id` | string | No | Replacement AfterShip fulfillment location ID; do not combine with explicit origin fields. |
| `origin_city` | string | No | Replacement origin city. |
| `pickup_note` | string | No | Replacement pickup instructions. |
| `tracking_id` | string | Yes | AfterShip tracking ID to update. |
| `courier_slug` | string | No | Replacement courier slug. |
| `order_number` | string | No | Replacement human-readable order number. |
| `origin_state` | string | No | Replacement origin state or province. |
| `tracking_key` | string | No | Replacement additional carrier tracking credential. |
| `custom_fields` | object | No | Replacement non-personal custom string fields. |
| `delivery_type` | string ("pickup_at_store" | "door_to_door" | "pickup_at_courier") | No | Replacement delivery method. |
| `order_id_path` | string | No | Replacement URL for the order in the merchant system. |
| `shipment_type` | string | No | Replacement carrier service type. |
| `pickup_location` | string | No | Replacement pickup location. |
| `shipping_method` | string | No | Replacement merchant-facing shipping method. |
| `destination_city` | string | No | Replacement destination city. |
| `destination_state` | string | No | Replacement destination state or province. |
| `origin_postal_code` | string | No | Replacement origin postal code. |
| `shipment_direction` | string ("forward" | "return") | No | Replacement ecommerce fulfillment direction. |
| `tracking_ship_date` | string | No | Replacement shipment-ready date or date-time. |
| `origin_raw_location` | string | No | Replacement unstructured origin address. |
| `origin_country_region` | string | No | Replacement origin ISO 3166-1 alpha-3 country code. |
| `destination_postal_code` | string | No | Replacement destination postal code. |
| `tracking_account_number` | string | No | Replacement carrier account number. |
| `destination_raw_location` | string | No | Replacement unstructured destination address. |
| `destination_country_region` | string | No | Replacement destination ISO 3166-1 alpha-3 country code. |
| `order_promised_delivery_date` | object | No | Replacement promised delivery date or date range. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |
