Workflow

Bulk-Uploading Tracking to eBay via Fulfillment API

Manually updating tracking numbers on eBay for hundreds or thousands of dropshipping orders is not sustainable. As your volume scales, this becomes a major bottleneck, impacting your seller performance metrics and leading to more buyer inquiries. The solution lies in automating this process using eBay's Fulfillment API.

This guide focuses on structuring your data and API calls to efficiently bulk-upload tracking information, ensuring your eBay orders are always up-to-date with minimal manual intervention.

Advertisement

Understanding the eBay Fulfillment API for Tracking

The eBay Fulfillment API provides endpoints specifically designed for managing order fulfillment. For tracking number uploads, you'll primarily interact with the /fulfillment/v1/order/{orderId}/issue_refund and /fulfillment/v1/order/{orderId}/add_tracking endpoints. Wait, no, that's wrong. You'll primarily use the /fulfillment/v1/order/{orderId}/add_tracking endpoint.

The key here is that while the API allows for individual order updates, you can batch these requests efficiently through a well-designed script or integration.

Required Data Points for Each Tracking Update

For each order you want to update, you need the following information:

  • orderId: The unique eBay order ID.
  • shippingCarrierName: The name of the shipping carrier (e.g., 'China Post', 'Yanwen', 'ePacket'). This should ideally match one of eBay's recognized carriers, but custom names are often accepted and displayed.
  • trackingNumber: The actual tracking number provided by your AliExpress supplier.
  • logisticsStatus: (Optional but recommended) The current status of the logistics, typically 'IN_TRANSIT' once a tracking number is available.
  • shippedDate: (Optional) The date the item was shipped, in ISO 8601 format (e.g., '2023-10-27T10:00:00.000Z').

Fetch Order Tracking automatically extracts these fields from your AliExpress orders, making it straightforward to map them to the eBay Fulfillment API requirements.

Structuring Your Bulk Upload Workflow

The most efficient way to bulk-upload tracking is to collect all the necessary data first, then iterate through it, making API calls.

Step 1: Extract AliExpress Tracking Data

Your first step is to get the tracking numbers and corresponding eBay order IDs. If you're using Fetch Order Tracking, this data is already organized in your Google Sheet. You'll have columns like ebay_order_id, ali_tracking_number, and ali_logistics_provider.

Filter your data to only include orders where ebay_tracking_uploaded is 'FALSE' and ali_tracking_number is not empty. This ensures you only process new tracking information.

Step 2: Prepare the API Request Body

For each order, you'll construct a JSON payload for the add_tracking endpoint. Here's an example:

{
"shippedDate": "2023-10-27T10:00:00.000Z",
"shippingCarrierName": "China Post",
"trackingNumber": "LP00000000000000",
"logisticsStatus": "IN_TRANSIT"
}

The shippedDate can be automatically generated based on when you retrieve the tracking number or when the order status changes to 'SHIPPED' on AliExpress. Fetch Order Tracking's gmt_create or gmt_refund (for refund detection, not relevant here) fields provide timestamps you can adapt.

Consistency in carrier names is crucial. While eBay can often interpret variations, using a standardized list of carrier names will reduce potential errors and improve buyer experience.

Step 3: Authenticate and Make API Calls

You'll need an eBay developer account and an access token to make API calls. This typically involves OAuth 2.0 client credentials flow for server-to-server applications.

With your access token, you can then make POST requests to the /fulfillment/v1/order/{orderId}/add_tracking endpoint. For example, if your orderId is '1234567890', the full URL would be https://api.ebay.com/fulfillment/v1/order/1234567890/add_tracking.

When processing hundreds or thousands of orders, it's vital to implement proper error handling and rate limiting. eBay's APIs have call limits, and exceeding them will result in temporary blocks.

  • Batching: While you can't send a single API request for multiple orders, you can process them in batches within your script. For example, process 50 orders, pause for a few seconds, then process the next 50.
  • Error Handling: Log any API errors (e.g., HTTP 400 Bad Request, 401 Unauthorized, 429 Too Many Requests). This allows you to reprocess failed updates later.
  • Idempotency: The add_tracking endpoint is generally idempotent; sending the same tracking information multiple times for the same order won't create duplicate entries but will simply update the existing one if changes occurred.

Step 4: Update Your Internal Records

Once an API call is successful, update your internal records (e.g., your Google Sheet) to mark that the tracking number has been uploaded to eBay. For example, set ebay_tracking_uploaded to 'TRUE'. This prevents redundant API calls in subsequent runs.

Advertisement

Example Workflow with Python Pseudocode

Here's a conceptual outline of how you might implement this in Python, assuming you have your data in a pandas DataFrame or similar structure:

import requests
import pandas as pd
from datetime import datetime

# --- Configuration ---
EBAY_API_BASE_URL = "https://api.ebay.com/fulfillment/v1/order/"
ACCESS_TOKEN = "YOUR_EBAY_ACCESS_TOKEN" # Obtain this via OAuth
HEADERS = {
"Authorization": f"Bearer {ACCESS_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json"
}

# --- Load your data (e.g., from a CSV or Google Sheet export) ---
# df = pd.read_csv("your_ali_ebay_orders.csv")
# df_to_upload = df[
# (df['ebay_tracking_uploaded'] == False) &
# (df['ali_tracking_number'].notna())
# ]

# For demonstration, let's create a dummy DataFrame
data = {
'ebay_order_id': ['111111111111', '222222222222', '333333333333'],
'ali_tracking_number': ['LP123456789CN', 'RU987654321CN', 'YT000000000000'],
'ali_logistics_provider': ['China Post', 'Yanwen', 'YunExpress'],
'ebay_tracking_uploaded': [False, False, False]
}
df_to_upload = pd.DataFrame(data)

uploaded_count = 0
failed_uploads = []

for index, row in df_to_upload.iterrows():
order_id = row['ebay_order_id']
tracking_number = row['ali_tracking_number']
carrier_name = row['ali_logistics_provider']

# You might infer shippedDate from your data or use current time
shipped_date = datetime.utcnow().isoformat(timespec='milliseconds') + 'Z'

payload = {
"shippedDate": shipped_date,
"shippingCarrierName": carrier_name,
"trackingNumber": tracking_number,
"logisticsStatus": "IN_TRANSIT"
}

try:
response = requests.post(
f"{EBAY_API_BASE_URL}{order_id}/add_tracking",
headers=HEADERS,
json=payload
)
response.raise_for_status() # Raise an exception for HTTP errors (4xx or 5xx)
print(f"Successfully uploaded tracking for order {order_id}")
df_to_upload.loc[index, 'ebay_tracking_uploaded'] = True
uploaded_count += 1

# Implement rate limiting here if processing many orders
# import time; time.sleep(0.1) # e.g., 100ms delay per request

except requests.exceptions.HTTPError as err:
print(f"Failed to upload tracking for order {order_id}: {err}")
print(f"Response body: {response.text}")
failed_uploads.append({'order_id': order_id, 'error': str(err), 'response': response.text})
except Exception as err:
print(f"An unexpected error occurred for order {order_id}: {err}")
failed_uploads.append({'order_id': order_id, 'error': str(err)})

print(f"\n--- Summary ---")
print(f"Total successful uploads: {uploaded_count}")
print(f"Total failed uploads: {len(failed_uploads)}")
if failed_uploads:
print("Details of failed uploads:")
for fail in failed_uploads:
print(f" Order ID: {fail['order_id']}, Error: {fail['error']}")

# Optionally, save the updated DataFrame back to your source
# df.update(df_to_upload)
# df.to_csv("your_ali_ebay_orders_updated.csv", index=False)

This script demonstrates the core logic. In a real-world scenario, you'd integrate this with your specific data source (e.g., directly querying your Google Sheet via the Google Sheets API) and robust error logging.

Maintaining Data Integrity

Regularly auditing your eBay orders against your AliExpress tracking data is important. Sometimes, tracking numbers change, or an order might be split into multiple shipments. Your automation should be flexible enough to handle these exceptions.

Fetch Order Tracking helps by continuously monitoring AliExpress for updates to ali_tracking_number and logistics_status. If a tracking number changes post-upload, your script can detect this by comparing the current ali_tracking_number with what's recorded as ebay_tracking_uploaded_value (if you store it) and issue an update.

Automating tracking uploads frees up significant time, reduces operational errors, and keeps your buyers informed, ultimately contributing to higher seller ratings and fewer 'Where's my item?' messages.

To streamline your AliExpress order tracking and refund detection, visit Fetch Order Tracking.

Advertisement

Try the fetcher More guides