NAV
elixir

Introduction

Welcome to the ScriptDrop Pricing API.

The Pricing API returns delivery price quotes for decision support. A quote does not create an Omni request, reserve a rate, create a label, persist a quote, or guarantee that a later label purchase will match the returned price.

Pricing is documented as a standalone API surface because it can be consumed by Omni API and Pharmacy API integrations without coupling the contract to either API.

Authentication

Authentication is performed using an API key and secret and sent using the Authorization header with the Basic realm.

To authorize, use this code:

api_key = "pk_myapikey1234"
api_secret = "tesk_myapisecret1234"

encoded_authorization = Base.url_encode64("#{api_key}:#{api_secret}")

authorization_header = "Basic #{encoded_authorization}"

ScriptDrop uses API keys to allow access to the API. Please contact our support team for API keys.

ScriptDrop expects the API key to be included in all API requests to the server in a header that looks like the following:

Authorization: Basic encoded_authorization

V1 Quotes

Create a Quote

url = "https://request.scriptdrop.co/pricing/v1/quotes"

headers = [
  {"Authorization", "Basic encoded_authorization"},
  {"Content-type", "application/json"}
]

quote_params = %{
  "pickup" => %{
    "address" => %{
      "zipcode" => "43200"
    }
  },
  "dropoff" => %{
    "address" => %{
      "zipcode" => "43210"
    }
  },
  "providers" => ["all"],
  "service_level" => "ground_advantage",
  "package_dimensions" => %{
    "length_in" => 8,
    "width_in" => 5,
    "height_in" => 3,
    "weight_oz" => 15
  }
}

HTTPoison.start()
HTTPoison.post(url, Jason.encode!(quote_params), headers)

The above command returns JSON structured like this:

{
  "quotes": [
    {
      "provider": "usps",
      "service": "ground_advantage",
      "price_usd": 6.44
    }
  ]
}

This endpoint returns delivery price quotes.

The first Pricing API v1 implementation supports USPS Ground Advantage quotes. The response intentionally omits zone, quote expiration, rate-lock terms, label purchase terms, package codes, signature requirements, and Omni request identifiers.

HTTP Request

POST https://request.scriptdrop.co/pricing/v1/quotes

Body Parameters

Name Type Required Description
pickup.address.zipcode String true Origin ZIP code. ZIP codes are normalized to ZIP5.
dropoff.address.zipcode String true Destination ZIP code. ZIP codes are normalized to ZIP5.
providers String[] false Provider filter. Defaults to ["all"]. V1 accepts all and usps.
service_level String false Service filter. Defaults to all. V1 accepts all and ground_advantage.
package_dimensions.length_in Decimal true Package length in inches.
package_dimensions.width_in Decimal true Package width in inches.
package_dimensions.height_in Decimal true Package height in inches.
package_dimensions.weight_oz Decimal true Package weight in ounces.

Package Dimensions

Pricing API v1 does not silently infer package weight or dimensions. Consumers may use standardized launch defaults, such as liquid vs. non-liquid weight or standard package dimensions, but those values must be explicitly sent in the request.

Round one supports caller-supplied dimensions, not carrier package codes. GoodRx or another consumer may choose a standard package size, such as a launch default like 10 x 12 x 5, but the consumer must send the selected dimensions in the payload. Carrier package types, such as USPS flat-rate boxes or FedEx One Rate packaging, can be considered in a later version.

Validation Rules

Rule Response
ZIP codes must normalize to valid 5-digit ZIP codes. 400
Weight must be greater than zero. 400
Requests must include length, width, height, and weight. 400
Unsupported providers are rejected. 400
Unsupported service levels are rejected. 400
package_code is not supported in v1. 400
signature_requirement is not supported in v1. 400

Full street address, name, and phone number are not required for the first ZIP-only USPS Ground Advantage quote path unless USPS integration testing proves they are necessary.

200 Response Schema

Name Type Description
quotes Quote[] List of matching delivery price quotes.
quotes.provider String External provider key. V1 value: usps.
quotes.service String External service key. V1 value: ground_advantage.
quotes.price_usd Decimal Price in USD, rendered as a JSON number.

Empty Quotes

When the request is valid and processed but no matching USPS Ground Advantage quote is available, the endpoint returns a 200 response with an empty quote list.

{
  "quotes": []
}

An empty quotes list is not an error condition.

Error Response

See Errors.

V1 Deferred Features

The following features are intentionally deferred from Pricing API v1:

Topic Status
package_code values Deferred from v1. Package types can be added in a future version.
signature_requirement in v1 Deferred from v1. Signature-required shipping can be added later if needed.
Public docs home Pricing should likely use a separate docs repo/site. Caleb should be consulted on setup.

Errors

Example validation error response:

{
  "error": {
    "message": "Package weight must be greater than 0."
  }
}

JSON example of a USPS upstream failure response:

{
  "error": {
    "message": "Unable to retrieve pricing from USPS."
  }
}

The ScriptDrop Pricing API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key is missing or invalid.
403 Forbidden -- Your API key is valid, but it is not enabled for Pricing API access.
404 Not Found -- The specified resource could not be found.
405 Method Not Allowed -- You tried to access a route that's not allowed.
406 Not Acceptable -- You requested a format that isn't supported.
429 Too Many Requests -- You've hit your request limit. Retry in a few moments.
500 Internal Server Error -- We had a problem with our server. Try again later.
502 Bad Gateway -- ScriptDrop could not retrieve a reliable quote from an upstream provider.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.