API Tools
Prefill Link API
This API allows you to generate a URL that prefills all or part of a new label form. The simplest way to generate a prefill URL is to use our prefill link builder tool. Developers who want to generate Stampnik URLs within their applications can refer to the following available prefill options.
Prefill links should use this base URL (https://stampnik.com/prefill?) and all params should be appended to the URL. All parameters are optional and are used to prefill a user-editable label form. No API key is required.
Prefill Link Params
Parameter | Required | Type | Description |
---|---|---|---|
service | No | string | Selects which carrier and service level to use. Here's a list of available service levels. |
from_name to_name
|
No | string | Sets the "Name" field of the From/To address. |
from_street1 to_street1
|
No | string | Sets the "Street" field of the From/To address. |
from_street2 to_street2
|
No | string | Sets the "Apt/Suite" field of the From/To address. |
from_city to_city
|
No | string | Sets the "City" field of the From/To address. |
from_region to_region
|
No | string | Sets the "State" field of the From/To address. |
from_postcode to_postcode
|
No | string | Sets the "Zipcode" field of the From/To address. |
from_phone | No | string | Sets the "Phone" field of the From address. |
from_country to_country
|
No | string (ISO 2-letter country code) |
Sets the "Country" field of the From/To address. Only US is supported for now. |
note | No | string | Sets an optional 'note' to be printed on the label (up to 100 chars) |
hazmat_battery | No | boolean | Set to true to indicate that the package contains a Lithium battery. If set, this overrides service level to usps_ground_advantage |
redirect | No | string (url) | Sets the redirect link shown when a label is purchased. We append a GET param to your redirect link that includes the tracking numbers (e.g. "http://mystore.com/order/12345?tracking_numbers=USPS+123456789012) Note: only one redirect link is saved per cart order. |
package | No | string | Selects the package type. Choose from available flat-rate packages or use custom_box to define a custom package. |
If package is set to custom_box, the following params define package size and weight | |||
package_width | No | number | Set the package width (in inches). |
package_height | No | number | Set the package height (in inches). |
package_length | No | number | Set the package length (in inches). |
package_weight_lb | No | number | Set the package weight (in pounds). Both weight values are added together to determine total weight. |
package_weight_oz | No | number | Set the package weight (in ounces). Both weight values are added together to determine total weight. |
Prefill Link Examples
Here are some example use cases and URLs that you can create with the Prefill API
Use case | Example URL |
---|---|
Preselect USPS Express Mail |
https://stampnik.com/prefill?
&service=usps_express |
Send a flat-rate envelope from ABC Example Co. |
https://stampnik.com/prefill?
&from_name=ABC+Example+Co &from_street1=999+Main+St &from_street2= &from_city=Jacksonville &from_region=FL &from_postcode=32099 &from_country=US &service=usps_priority &package=usps_flat_rate_envelope |
Send a Custom Box (10" x 10" x 6", 15 ounces)
via USPS Ground Advantage with note "Order No. 12345" |
https://stampnik.com/prefill?
&service=usps_ground_advantage &package=custom_box &package_weight_lb= &package_weight_oz=15 &package_width=10 &package_height=10 &package_length=6 ¬e=Order+No.+12345 |
Pre-defined Values
Use these values to select a flat-rate package and/or service level.
Service Levels
Value | Description | |
---|---|---|
usps_priority | USPS Priority | |
usps_express | USPS Express | |
usps_ground_advantage | USPS Ground Advantage | |
usps_media | USPS Media Mail | |
usps_first | USPS First-Class | Deprecated: This service is no longer offered by USPS. If used, it will re-map to Ground Advantage |
usps_parcel_select | USPS Parcel Select | Deprecated: This service is no longer offered by USPS. If used, it will re-map to Ground Advantage |
Flat-Rate Packages
Value | Carrier & Service | Description |
---|---|---|
usps_flat_rate_box_small | USPS - Priority |
Box
Small
|
usps_flat_rate_box_medium | USPS - Priority |
Box
Medium
|
usps_flat_rate_box_large | USPS - Priority |
Box
Large
|
usps_flat_rate_box_large_board_game | USPS - Priority |
Box
Large Board Game
|
usps_flat_rate_envelope | USPS - Priority |
Envelope
Letter
|
usps_flat_rate_envelope_legal | USPS - Priority |
Envelope
Legal
|
usps_flat_rate_envelope_padded | USPS - Priority |
Envelope
Padded
|
usps_flat_rate_envelope_small | USPS - Priority |
Envelope
Small
|
usps_flat_rate_envelope_window | USPS - Priority |
Envelope
Window
|
usps_flat_rate_envelope_giftcard | USPS - Priority |
Envelope
Gift-card
|
usps_flat_rate_express_envelope | USPS - Express |
Express Envelope
Letter
|
usps_flat_rate_express_envelope_legal | USPS - Express |
Express Envelope
Legal
|
usps_flat_rate_express_envelope_padded | USPS - Express |
Express Envelope
Padded
|