Errors Guide

Overview

This guide explains how to identify and handle errors returned by the EasyPost API, including HTTP status codes, error response structures, and common error codes.


Prerequisites

  • Review the Getting Started Guide for an introduction to the EasyPost API.
  • Become familiar with EasyPost API operations and Client Libraries.
  • Understand basic HTTP status codes and error handling.

HTTP Status Codes

EasyPost communicates errors using standard HTTP status codes and returns a JSON response with additional details about the error.

  • 400 Bad Request: The request was not processed due to a client error.
  • 401 Unauthorized: Authentication is required and has failed.
  • 402 Payment Required: There is a lack of billing information or insufficient funds.
  • 403 Forbidden: The request was valid, but the server is refusing to respond to it.
  • 404 Not Found: The requested resource could not be found.
  • 405 Method Not Allowed: The request method is not supported for the requested resource.
  • 422 Unprocessable Entity: The request was well-formed, but the server was unable to process the provided data.
  • 429 Too Many Requests: The user has sent too many requests in a given amount of time.
  • 500 Internal Server Error: An unexpected error occurred on the server.
  • 503 Service Unavailable: The server is currently unable to handle the request due to temporary overloading or maintenance.

Error Response Structure

The EasyPost API returns error details in a structured JSON response. Error responses can include the following fields:

  • code: A machine-readable string that identifies the error.
  • message: A human-readable description of the error.
  • errors: An array containing additional error details. Items can be structured objects or strings, depending on the error.

Error Handling

EasyPost Client Libraries encapsulate API errors and raise exceptions for client errors, server errors, and exceptional conditions such as network failures. Handle exceptions appropriately based on the application’s requirements.

API errors can return the errors field in one of two formats:

  • Array of objects: Each item contains structured error details, such as a message field.
  • Array of strings: Each item contains the error message directly as a string.

Check the type of each item in the errors array before accessing its value. When an item is an object, access the error message using a field such as error.errors[0][“message”]. When an item is a string, access the value directly using error.errors[0].

For production error handling, account for both formats rather than assuming a single response shape.

Catching an Error

POST /addresses
1curl -X POST https://api.easypost.com/v2/shipments \
2  -u "$EASYPOST_API_KEY": \
3  -H 'Content-Type: application/json' \
4  -d '{
5    "shipment": {}
6  }'
Response
1{
2  "error": {
3    "code": "ADDRESS.VERIFY.FAILURE",
4    "message": "Address not found",
5    "errors": [
6      {
7        "field": "address",
8        "message": "Address not found",
9        "suggestion": null
10      },
11      {
12        "field": "street1",
13        "message": "House number is missing",
14        "suggestion": null
15      }
16    ]
17  }
18}

General API Error Codes

Code
Description
INTERNAL_SERVER_ERRORAn internal server error occurred. Retry the request. Contact support@easypost.com if the error continues.
NOT_ACCEPTABLEThe requested response format is not supported by the resource.
NOT_FOUNDThe requested resource was not found.
FORBIDDENAccess to the requested resource is forbidden.
PAYMENT_REQUIREDThe account has insufficient funds. Review the account billing settings.
UNAUTHORIZEDAuthentication failed or the provided credentials do not permit access to the resource.
BAD_REQUESTThe request is malformed or contains invalid data.
PAYMENT_GATEWAY.ERRORThe payment processor could not complete the request. Retry the request or contact support@easypost.com if the error continues.
MODE.UNAUTHORIZEDA production API key is required to access this resource.
MODE.CONFLICTThe API key mode does not match the requested resource or parameter mode.
DATE.PARSE.FAILUREOne or more dates are incorrectly formatted and could not be parsed.
PARAMETER.FORBIDDENThe request contains one or more parameters that are not permitted.
PARAMETER.REQUIREDA required parameter is missing.

Address Error Codes

Code
Description
ADDRESS.PARAMETERS.INVALID_CHARACTEROne or more address parameters contain an invalid character.
ADDRESS.PARAMETERS.INVALIDOne or more parameters required to create the Address are missing or invalid.
ADDRESS.COUNTRY.INVALIDThe 'country' parameter must contain a two-character ISO country code.
ADDRESS.VERIFICATION.NOT_FOUNDThe address could not be found.
ADDRESS.VERIFICATION.FAILUREThe address could not be verified.
ADDRESS.VERIFICATION.INVALIDOne or more requested verification types are invalid.
ADDRESS.VERIFY.FAILUREThe address could not be verified.
ADDRESS.VERIFY.UNAVAILABLEAddress verification is temporarily unavailable. Retry the request.
ADDRESS.VERIFY.CARRIER_INVALIDThe address could not be verified using the specified carrier.
ADDRESS.VERIFY.UPSTREAM_UNAVAILABLEAddress verification is unavailable because an upstream service did not respond. Retry the request.
ADDRESS.VERIFY.ONLY_USUSPS address verification supports US addresses only.
ADDRESS.VERIFY.INTL_NOT_ENABLEDInternational address verification is not enabled for the account. Contact EasyPost Support to request access.
ADDRESS.VERIFY.MISSING_STREETA street address is required for address verification.
ADDRESS.VERIFY.MISSING_CITY_STATE_ZIPA city and state or a ZIP code is required for address verification.

Address Verification Error Codes

Code
Description
E.COUNTRY.UNSUPPORTEDThe country is not supported in the current mode. Use production mode.
E.ENGINE.UNAVAILABLENo address verification engine is currently available for this country. Retry the request later.
E.QUERY.UNANSWERABLEInsufficient address data is available for this country to complete the verification. Retry the request later.
E.ADDRESS.NOT_FOUNDThe address could not be found.
E.SECONDARY_INFORMATION.INVALIDThe secondary address information, such as an apartment or suite number, is invalid. This error may also appear on a successful verification.
E.SECONDARY_INFORMATION.MISSINGSecondary address information, such as an apartment or suite number, is required. This error may also appear on a successful verification.
E.HOUSE_NUMBER.MISSINGThe house number is missing.
E.HOUSE_NUMBER.INVALIDThe house number is invalid.
E.STREET.MISSINGThe street is missing.
E.STREET.INVALIDThe street is invalid.
E.BOX_NUMBER.MISSINGThe box number is missing.
E.BOX_NUMBER.INVALIDThe box number is invalid.
E.ADDRESS.INVALIDThe city, state, or ZIP code is invalid.
E.ZIP.NOT_FOUNDThe ZIP code could not be found.
E.ZIP.INVALIDThe ZIP code is invalid.
E.ZIP.PLUS4.NOT_FOUNDThe ZIP+4 code could not be found.
E.ADDRESS.MULTIPLEMultiple addresses were found for the provided ZIP code.
E.ADDRESS.INSUFFICIENTThe address information is incomplete or incorrect.
E.ADDRESS.DUALThe address contains conflicting street and PO Box information.
E.STREET.MAGNETMultiple possible street matches were found for the address.
E.CITY_STATE.INVALIDThe city and state combination could not be verified.
E.STATE.INVALIDThe state is invalid.
E.ADDRESS.DELIVERY.INVALIDThe delivery address is invalid.
E.TIMED_OUTThe address verification request timed out.
E.TIME_ZONE.UNAVAILABLEThe time zone service is currently unavailable.
E.PO_BOX.INTERNATIONALInternational PO Box addresses cannot be verified. This error may also appear on a successful verification.

Batch Error Codes

Code
Description
BATCH.FILE_FORMAT.INVALIDThe 'file_format' parameter is invalid.
BATCH.SHIPMENT.TOO_LARGEThe Batch contains too many Shipments. For best performance, keep each Batch under 1,000 Shipments.
BATCH.SHIPMENT.MISSINGAt least one Shipment is required to perform this operation.
BATCH.SHIPMENTS.REQUIREDThe 'shipments' parameter is required.
BATCH.STATE.CREATINGThe Batch cannot be modified while it is being created.
BATCH.STATE.CREATION_FAILEDOne or more Shipments in the Batch could not be created.
BATCH.STATE.ALREADY_PURCHASEDThe Batch has already been purchased or a purchase is in progress. Retry if the current purchase fails.
BATCH.STATE.NOT_PURCHASEDOne or more Shipments in the Batch do not have purchased postage.
BATCH.PARAMS.INVALIDOne or more parameters provided for the Batch are invalid.

Billing and Payment Error Codes

Code
Description
BANK_ACCOUNT.CHARGE.FAILUREThe bank account charge could not be created.
BANK_ACCOUNT.VERIFY.FAILUREThe bank account could not be verified.
CREDIT_CARD.CHARGE.FAILUREThe credit card charge could not be created.
CREDIT_CARD.INVALIDThe card could not be connected to the payment processor. Retry the request.

Carrier Account Error Codes

Code
Description
CARRIER_ACCOUNT.REGISTRATION.FAILEDThe UPS Access License Request could not be completed.
CARRIER_ACCOUNT.PARAMETERS.INVALIDThe top-level 'carrier_account' parameter is required.
CARRIER_ACCOUNT.INVALIDThe CarrierAccount contains invalid data and could not be saved.
CARRIER_ACCOUNT.TYPE.EXISTSA CarrierAccount of the specified type already exists.
CARRIER_ACCOUNT.TYPE.UNKNOWNThe specified CarrierAccount type is not recognized.

Carrier-specific Error Codes

Code
Description
DHLGM.RATE_TABLE.NOT_FOUNDThe DHL eCommerce rate table was not found.
DHLGM.SCAN_FORM.GENERATION_FAILEDThe DHL eCommerce closeout could not be generated. Retry the request or contact support@easypost.com if the error continues.
DHLGM.RETURN.AUTHORIZATION_NUMBER_REQUIREDA return authorization number is required in the Shipment 'print_custom_1' option.
DHLGM.LABEL.FAILUREThe DHL eCommerce shipping label could not be generated. Retry the request or contact support@easypost.com if the error continues.
DHLGM.NO_INTERNATIONALDHL eCommerce does not support international Shipments for this service.
DHLGM.NO_ALCOHOLDHL eCommerce does not permit alcohol shipments.
DHLGM.GIRTH_MAXThe Parcel exceeds the maximum permitted girth of 84.
DHLGM.LETTER_NOT_SUPPORTEDDHL eCommerce does not support domestic letter mail. Use an eligible USPS service instead.
DHLGM.ACCESS_TOKEN.GENERATION_FAILEDThe DHL eCommerce access token could not be generated. Retry the request or contact support@easypost.com if the error continues.

Container, Parcel, and Item Error Codes

Code
Description
CONTAINER.TYPE.INVALIDThe specified container 'type' is not supported.
CONTAINER.DIMENSION.REQUIREDWhen one container dimension is provided, 'length', 'width', and 'height' are all required.
CONTAINER.NAME.REQUIREDThe container 'name' parameter is required.
PARCEL.PREDEFINED_PACKAGE.INVALIDThe specified predefined package is not valid for the Parcel.
PARCEL.PARAMETERS.INVALIDOne or more parameters required to create the Parcel are missing or invalid. Enter weight in ounces (oz) and dimensions in inches (in), using no more than one decimal place.
ITEM.WEIGHT.REQUIREDThe item 'weight' parameter is required. Enter weight in ounces (oz), using no more than one decimal place.
ITEM.HEIGHT.REQUIREDThe item 'height' parameter is required. Enter dimensions in inches (in), using no more than one decimal place.
ITEM.WIDTH.REQUIREDThe item 'width' parameter is required. Enter dimensions in inches (in), using no more than one decimal place.
ITEM.LENGTH.REQUIREDThe item 'length' parameter is required. Enter dimensions in inches (in), using no more than one decimal place.
ITEM.VALUE.REQUIREDThe item 'value' parameter is required and must be greater than zero.
ITEM.NAME.REQUIREDThe item 'name' parameter is required.

Customs Error Codes

Code
Description
CUSTOMS_INFO.PARAMETERS.INVALIDOne or more parameters required to create the CustomsInfo are missing or invalid.
CUSTOMS_ITEM.ORIGIN_COUNTRY.REQUIREDThe origin country is required for each customs item.
CUSTOMS_ITEM.CURRENCY.ONE_CURRENCY_SUPPORTEDAll customs items in a CustomsInfo object must use the same currency. The currency defaults to USD when not provided.
CUSTOMS_ITEM.PARAMETERS.INVALIDOne or more parameters required to create the CustomsItem are missing or invalid.

Document and Image Error Codes

Code
Description
DOCUMENT.COMMERCIAL_INVOICE.FAILUREThe commercial invoice could not be generated for the Shipment.
DOCUMENT.CONVERSION.FAILUREThe document could not be converted.
IMAGE.CONVERSION.FAILUREThe image could not be converted. Retry the request or contact support@easypost.com if the error continues.
IMAGE.WIDTH.INVALIDThe image width must be a multiple of eight.

Insurance Error Codes

Code
Description
INSURANCE.PARAMETERS.INVALIDOne or more parameters required to create the Insurance object are invalid.
INSURANCE.CREATE.FAILUREThe Insurance object could not be created using the provided data.
INSURANCE.PURCHASE.NOT_ALLOWEDThe account is not permitted to purchase insurance.
INSURANCE.PURCHASE.FAILEDInsurance could not be purchased. Retry the request or contact support@easypost.com if the error continues.
INSURANCE.AMOUNT.BELOW_MINIMUMThe insurance 'amount' must be greater than zero.
INSURANCE.AMOUNT.REQUIREDThe insurance 'amount' parameter is required.
INSURANCE.AMOUNT.ABOVE_MAXIMUMThe insurance amount exceeds the maximum permitted value.

Order Error Codes

Code
Description
ORDER.SHIPMENTS.REQUIREDThe 'shipments' parameter is required when 'containers' and 'items' are not provided.
ORDER.FROM_ADDRESS.REQUIREDThe 'from_address' parameter is required.
ORDER.TO_ADDRESS.REQUIREDThe 'to_address' parameter is required.
ORDER.OPTIONS.INVALIDOne or more Order options are invalid.
ORDER.PARAMS.REQUIREDAt least one parameter is required to create an Order.
ORDER.INVALIDThe request does not contain enough information to create the Order.
ORDER.RATE.UNAVAILABLEThe requested rate is not available for one or more Shipments in the Order.
ORDER.SERVICE.REQUIREDThe 'service' parameter is required.
ORDER.CARRIER.REQUIREDThe 'carrier' parameter is required.
ORDER.LABEL_DATE.INVALIDThe 'label_date' option must be a valid ISO 8601 string or timestamp.
ORDER.CARRIER_ACCOUNTS.CONFLICTProvide the applicable CarrierAccount IDs in the 'carrier_accounts' array.

Pickup Error Codes

Code
Description
PICKUP.MIN_DATETIME.REQUIREDThe 'min_datetime' parameter is required.
PICKUP.MAX_DATETIME.REQUIREDThe 'max_datetime' parameter is required.
PICKUP.IS_ACCOUNT_ADDRESS.REQUIREDThe 'is_account_address' parameter is required.
PICKUP.ADDRESS.INVALIDThe pickup Address requires valid 'street1', 'city', 'state', 'zip', 'phone', and 'name' or 'company' values.
PICKUP.ADDRESS.REQUIREDThe pickup 'address' parameter is required.
PICKUP.REQUEST.INVALIDA Batch and Shipment cannot both be supplied in the same pickup request.
PICKUP.REQUEST.INVALIDA Shipment or a Batch containing Shipments is required to create a Pickup.
PICKUP.REQUEST.INVALIDPickup rates could not be retrieved for the request.
PICKUP.BATCH.INVALIDThe provided Batch does not contain any Shipments.
PICKUP.BATCH.REQUIREDA Batch containing at least one Shipment is required.
PICKUP.SHIPMENT_SERVICE.INVALIDOne or more Shipments in the Batch use a service that is not valid for the Pickup.
PICKUP.BATCH_CARRIER.INCONSISTENTAll Shipments in the Batch must use the same carrier.
PICKUP.STATUS.INVALIDThe Pickup cannot be modified while it is in its current status.
PICKUP.BUY.FAILEDThe Pickup could not be scheduled.
PICKUP.BUY.NO_MATCHING_RATESNo pickup rates match the request.
PICKUP.SERVICE.REQUIREDThe pickup 'service' parameter is required.
PICKUP.CARRIER.REQUIREDThe pickup 'carrier' parameter is required.
PICKUP.SHIPMENT_COUNTRY.INVALIDOne or more Shipments in the Batch have an invalid 'to_address.country' value.
PICKUP.BUY.FORBIDDENUSPS Pickups cannot be purchased in test mode.
PICKUP.CANCEL.FAILEDThe Pickup could not be cancelled.

Refund Error Codes

Code
Description
REFUND.NO_RESPONSEThe carrier did not respond to the refund request. Retry the request or contact support@easypost.com if the error continues.
REFUND.FAILUREThe postage refund could not be completed.
REFUND.TRACKING_CODES.INVALIDThe 'tracking_codes' parameter is missing or invalid.
REFUND.TRACKING_CODE.NOT_FOUNDThe tracking code was not found in the account's purchased Shipment history.

ScanForm Error Codes

Code
Description
SCAN_FORM.FAILUREThe ScanForm could not be generated. Retry the request or contact support@easypost.com if the error continues.
SCAN_FORM.BATCH.MULTIPLE_CARRIERSAll Shipments in the Batch must be purchased from the same carrier.
SCAN_FORM.BATCH.NOT_PURCHASEDAll Shipments in the Batch must be purchased before creating a ScanForm.
SCAN_FORM.SHIPMENTS.INVALIDAll USPS Shipments in the ScanForm must use the same 'from_address'.
SCAN_FORM.SHIPMENTS.REQUIREDA valid list of Shipments is required.
SCAN_FORM.CREATE.CARRIER_NOT_SUPPORTEDThe carrier used to purchase the Shipments does not support ScanForms.
SCAN_FORM.CREATE.FAILUREThe ScanForm could not be created.

Shipment Error Codes

Code
Description
SHIPMENT.PURCHASE.FAILUREThe Shipment could not be purchased. Retry the request or contact support@easypost.com if the error continues.
SHIPMENT.OPTIONS.INVALIDOne or more Shipment options are invalid.
SHIPMENT.INVALID_PARAMSOne or more parameters provided for the Shipment are invalid.
SHIPMENT.INVALIDThe request does not contain enough information to create the Shipment.
SHIPMENT.POSTAGE.INVALID_FORMATThe requested 'file_format' value is invalid.
SHIPMENT.POSTAGE.FORMAT_UNAVAILABLEThe label cannot be converted to the requested image format.
SHIPMENT.POSTAGE.REQUIREDPurchased postage is required to complete this operation.
SHIPMENT.POSTAGE.EXISTSPostage has already been purchased for the Shipment.
SHIPMENT.POSTAGE.NO_RESPONSEThe carrier did not respond to the Shipment purchase request. Retry the request or contact support@easypost.com if the error continues.
SHIPMENT.POSTAGE.FAILUREThe shipping label could not be generated. Retry the request or contact support@easypost.com if the error continues.
SHIPMENT.REFUND.UNAVAILABLEThe Shipment refund is unavailable. If the Shipment is part of an Order, refund the first Shipment in the Order.
SHIPMENT.REFUND.FAILUREThe Shipment refund could not be completed. Retry the request or contact support@easypost.com if the error continues.
SHIPMENT.CUSTOMS_INFO.DESCRIPTION_REQUIREDEach CustomsItem must include a description.
SHIPMENT.CUSTOMS_INFO.REQUIREDThe 'customs_info' parameter is required for international Shipments and Shipments to US military addresses or US territories.
SHIPMENT.POSTAGE.TIMED_OUTThe carrier timed out while processing the Shipment purchase request. Retry the request or contact support@easypost.com if the error continues.
SHIPMENT.RATE.CARRIER_ACCOUNT_INVALIDThe selected Rate belongs to an inactive or inaccessible CarrierAccount. Create a new Shipment or retrieve new Rates.
SHIPMENT.CARRIER_ACCOUNTS.CONFLICTProvide the applicable CarrierAccount IDs in the 'carrier_accounts' array.
SHIPMENT.TRACKING_CODE.INVALID_CARRIERThe specified carrier is not supported for creating a Shipment from a tracking code.
SHIPMENT.INSURANCE.ALREADY_PURCHASEDInsurance has already been purchased for the Shipment.
SHIPMENT.MISSING_RATEA valid Rate associated with the Shipment is required to purchase the Shipment.
SHIPMENT.MISSING_INFORMATIONA valid 'to_address', 'from_address', and 'parcel' are required to purchase the Shipment.
SHIPMENT.PURCHASE.IN_PROGRESSA purchase is already in progress for the Shipment.
SHIPMENT.RATES.UNAVAILABLEThe Shipment does not contain enough information to retrieve Rates.
SHIPMENT.RATE.STAMP_UNAVAILABLEThe selected carrier and service combination does not support stamp labels.
SHIPMENT.RATE.BARCODE_UNAVAILABLEThe selected carrier and service combination does not support barcode labels.
SHIPMENT.POSTAGE.ASCIIASCII label format is not available for production Shipments.
SHIPMENT_REPORT.DATE_RANGE.INVALIDThe Shipment Report date range is invalid.
SHIPMENT_REPORT.ALREADY_IN_PROGRESSA Shipment Report with the same parameters is already being generated.
SHIPMENT_REPORT.DATE_RANGE.TOO_LONGThe Shipment Report date range cannot exceed 31 days.

Tracker Error Codes

Code
Description
TRACKER.RETRIEVE.ERRORThe Tracker could not be retrieved. Retry the request.
TRACKER.RUN.ERRORThe Tracker could not be processed. Retry the request.
TRACKER.CREATE.ERRORThe Tracker could not be created. Retry the request.
TRACKER.NOT_FOUNDThe requested Tracker was not found.
TRACKER.INVALID_TEST_CODETest mode accepts only EasyPost test tracking codes from 'EZ1000000001' through 'EZ7000000007'.
TRACKER.NO_CARRIER_ACCOUNTThe account does not have the required CarrierAccount for the specified carrier.
TRACKER.INVALID_PARAMSOne or more Tracker parameters are invalid.
TRACKER.UNSUPPORTED_CARRIERThe specified carrier is not supported or was entered incorrectly.
TRACKER.CARRIER_CODE_MISMATCHThe tracking code does not belong to the specified carrier.
TRACKER.MULTIPLE_CARRIERS_FOR_CODEThe tracking code may belong to multiple carriers. Specify the carrier when creating the Tracker.
TRACKER.NO_CARRIER_FOR_CODEThe tracking code does not match a supported carrier format.

User Error Codes

Code
Description
USER.UNAUTHORIZEDThe authenticated user does not have permission to access the resource.
USER.INVALIDThe User contains invalid data and could not be saved.
USER.PARENT.INVALIDA child account cannot be added beneath another child account.
USER.CHARGE.NOT_ALLOWEDOne-time charges are not enabled for the account. Contact support@easypost.com to request approval.

Webhook Error Codes

Code
Description
WEBHOOK.EVENT.INVALIDThe received webhook event type could not be mapped to a handler.
WEBHOOK.INVALIDThe Webhook contains invalid data and could not be saved.

Additional Resources

Support and Troubleshooting

Visit the EasyPost Help Center for FAQs, troubleshooting guidance, and additional support resources.