How to Test a Shipment Tracking API with Carrier Codes and Test Numbers
To test a shipment tracking API, start with a carrier code and tracking number that the API provider recognizes as a documented test pair. Submit them using the provider’s published request format, then check both the immediate response and any later tracking updates. A successful request only proves that the API accepted or processed your input; it does not, by itself, prove that a real shipment exists or that your integration handles delivery events correctly.

The safest workflow separates three questions: Is the request valid? Does the carrier-and-number pair produce the expected result? Can your system handle the response or subsequent update? Keeping those questions separate makes failures easier to diagnose.
Prepare the test before sending a request
Gather the API documentation, credentials for the intended environment, the carrier-code reference, and any test numbers or fixtures published by the provider. A tracking number copied from a search result is not a dependable test fixture. It may belong to a real customer, have expired from the provider’s accessible history, or never have been recognized by the API you are testing.
Carrier codes are provider-specific identifiers. Do not assume that a code used by one API, a carrier’s website, or your order management system is accepted unchanged by another tracking API. Find the code in the provider’s documentation and record its exact spelling and format. If the API supports carrier detection, test that separately from an explicitly supplied carrier code. The two paths may produce different results when a number format is shared by multiple carriers.
For 17TRACK, begin with its Tracking API documentation for the current request contract and its Tracking API overview for product context. Confirm the documented authentication method, accepted carrier identifier, request fields, and response behavior before building a test. Do not assume that a sandbox, a particular test number, or a simulated delivery timeline is available unless the current documentation or your account materials explicitly provide it.
Choose numbers that can answer a specific question
A useful test number has a known purpose and expected outcome. If the provider publishes a sample carrier-and-number pair, use it as documented and note whether it demonstrates request validation, an existing tracking record, or simulated tracking events. Those are different kinds of evidence. A sample that shows the shape of a response is not necessarily a reusable, live tracking number.
If no official fixture is available, use a shipment your organization controls and is authorized to track. Confirm the carrier from your shipping record rather than guessing it from the number. Record when the label was created and whether the carrier has scanned the parcel: a newly issued number may be valid but have no events yet. Keep the complete number out of public bug reports and shared screenshots unless you have permission to disclose it.
Set up a small test sheet before you run the API call. For each case, record the environment, carrier code, a masked number, the source of that number, the result you expect, and the reason for that expectation. The most useful baseline cases are:
- Known positive: a provider-supplied fixture or an authorized shipment for which you know the carrier and have a reasonable expectation of a tracking record.
- Valid but not yet active: an authorized number issued before the first carrier scan, if your workflow needs to handle that state.
- Wrong carrier: a known number submitted with a different valid carrier code, to check how mismatches are reported.
- Malformed input: a number that violates the documented input rules, to test request validation.
- Unsupported or invalid carrier code: a code that should be rejected under the documented contract.
Use a deliberately invalid value only in an environment where such testing is permitted. These cases do not all have a universal expected HTTP status or error message. Write expected results from the API’s documentation and your integration requirements, not from assumptions about how tracking services usually behave.
Send one controlled request and capture the complete result
Build the request from the current documentation rather than from a copied example for another API version. Check the method, endpoint, headers, authentication format, and body fields. Where a provider distinguishes registering a number from retrieving an existing tracking record, follow that sequence. Repeatedly sending a registration request is not a substitute for testing retrieval, and you should not assume repeated registration has no side effects.
A command-line request can help isolate API behavior from application code. The following is a request harness, not a ready-to-run 17TRACK endpoint or payload. Supply the URL, header, and JSON body exactly as required by the provider’s documentation:
curl --request POST \
--url "$TRACKING_TEST_URL" \
--header "$TRACKING_AUTH_HEADER" \
--header 'Content-Type: application/json' \
--data "$TRACKING_TEST_PAYLOAD"Here, TRACKING_TEST_URL, TRACKING_AUTH_HEADER, and TRACKING_TEST_PAYLOAD are placeholders you configure; they are not API field names. Use a secure method of supplying credentials, and avoid saving secrets in shell history or committing them to a repository.
Capture the HTTP status, response body, relevant headers, and request time. Log an identifier that lets you match the request to later activity, if the API supplies one. In shared logs, redact credentials and mask tracking numbers. If the request fails, this record helps distinguish an authentication or payload problem from a tracking-data problem. An error from your own HTTP client, such as a connection timeout, also needs to be kept separate from an error response returned by the API.
Interpret acceptance, tracking status, and delivery events separately
Do not treat every successful HTTP response as proof of delivery. An API may accept a tracking number before it has shipment events to return. It may also provide a processing result first and make tracking updates available later. The exact sequence depends on the provider and the documented operation.
Check the response at three levels. First, did the server accept the request in the documented format? Second, does the response identify the intended carrier and number, or otherwise provide a way to correlate the result? Third, does the tracking information mean what your application thinks it means? For example, distinguish a label that has been created from a parcel that the carrier has received. Do not map a missing event list to “delivered” or “lost” simply because your application expects one of those states.
When using a controlled real shipment, compare the API result with your shipping record and the carrier’s available tracking information, allowing for differences in update timing. Treat the carrier’s public page as a useful check, not as a guarantee that two systems will show an update at precisely the same moment. If the tracking API offers callbacks or webhooks under your account configuration, test those as a separate delivery path. Verify the documented authentication or signature procedure, handle duplicate notifications safely, and decide how your application will recover when a notification is delayed or cannot be processed. Do not assume those facilities or their exact behavior without checking your provider’s documentation.
Diagnose failures in the right order
Start with failures that prevent a meaningful tracking test. If authentication fails, verify the environment and credential format before changing the tracking number. If the request is rejected as malformed, compare your actual payload with the documented schema, including data types and required fields. If the carrier code is rejected, check the provider’s identifier list rather than substituting a familiar carrier abbreviation.
If the request is valid but no tracking information appears, check the fixture itself. Was the number copied correctly? Is the selected carrier the one that issued it? Has the carrier received and scanned the parcel? Does the provider describe a delay or a separate step before updates become available? An empty result alone cannot identify which of these explanations is correct.
When automatic carrier detection and an explicit carrier code produce different outcomes, preserve both request-and-response pairs for investigation. Do not silently switch carriers in production merely because a different code returns data during one test. Confirm the underlying shipment and document the rule your application will use. For intermittent failures, retain timestamps and any provider-supplied request identifiers so support teams can investigate a specific call without receiving your credentials.
Make the test repeatable in your application
Once a manual request works, move the same cases into automated tests. Keep contract tests, which verify the request and response shape expected by your code, separate from live integration tests that depend on external carrier data. A mock response is useful for exercising your user interface and status mapping, but it does not prove that your credentials, carrier code, or live API request work.
For a live test, assert only what the fixture can reliably establish. A controlled shipment may move from “in transit” to “delivered,” so a test that demands one exact status indefinitely will eventually fail for the wrong reason. More durable checks may verify that your application can parse the response, associate it with the correct shipment, and handle absent or newly added events without crashing. Where stable provider-supplied fixtures exist, use their documented expectations instead.
Test error handling as deliberately as the positive path. Check what your application does when a number is invalid, the carrier code is wrong, authorization fails, a request times out, or the API returns a temporary error. Make retries bounded and follow any provider guidance on retry timing. Preserve enough diagnostic detail to investigate failures while avoiding unnecessary exposure of customer shipment information.
The test is complete when you can show more than one successful call: a documented carrier code is sent with an appropriate number, the API result is interpreted correctly, and your application behaves predictably when data is missing, delayed, or rejected. If the provider does not offer a confirmed test fixture, state that limitation in your test plan and use authorized shipments for live verification rather than presenting an invented number as a reliable sample.
FAQ
Can I test a tracking API with any number that looks valid?
No. A number can match a familiar format without belonging to the carrier you selected or producing a usable tracking record. Prefer a documented fixture or an authorized shipment whose carrier you can verify.
Why does a valid tracking number return no events?
A label may exist before the carrier’s first scan, or updates may not yet be available through the API. Check the carrier assignment, the shipment’s known history, and the API’s documented workflow before treating an empty event list as a request failure.
Should I let the API detect the carrier or supply a carrier code?
Supply the documented code when your shipping system knows the carrier and the API supports that option. If you plan to use automatic detection, test it independently, including numbers that could be ambiguous. Do not assume both approaches have identical behavior.
Is a successful API response enough to validate my integration?
No. It confirms only the operation described by that response. Also check how your application associates results with orders, handles later events, interprets statuses, protects credentials, and responds to errors or timeouts.
Does 17TRACK provide a universal test tracking number?
Do not assume one exists. Check the current 17TRACK API documentation and any account-specific guidance for supported test inputs. If no suitable fixture is documented for your use case, verify with an authorized shipment.
Sources
- 17TRACK Tracking API documentation — reference for checking the current API request contract, carrier identifiers, and documented testing guidance.
- 17TRACK Tracking API overview — product context for the 17TRACK API example.


