Address & location validation
- Address input exclusivity:
- An error is raised if you provide both
pickupAddressandpickupPlaceId(or the dropoff equivalents). You must use one or the other. - An error is raised if you provide address components (e.g.,
pickupAddressFormattedStreet) along withpickupAddressorpickupPlaceId.
- An error is raised if you provide both
- Address input requirement: If no store location ID is provided, Nash requires one of the following for both pickup and dropoff:
- A single-line address string (
pickupAddress/dropoffAddress). - A Google Place ID (
pickupPlaceId/dropoffPlaceId). - A set of address components (street, city, zip, etc.).
- If none of these are present, a “required field” error is added for the address.
- A single-line address string (
- Store location logic:
- If a
pickupStoreLocationIdorpickupExternalStoreLocationIdis provided, Nash looks up the corresponding store location. - Existence check: Fails if the store location ID doesn’t exist for that organization, or if the store has been deleted.
- Automatic store creation: If an external store location ID is given but not found, Nash checks an organization preference for automatically creating store locations. If enabled, it creates a new store location from the order’s pickup details.
- Default field population: If a valid pickup store location is found, Nash populates the order’s pickup fields (name, phone, email, instructions) from the store, unless those fields were already provided in the request.
- If a
- Geocoding and parsing:
- If a raw
pickupAddressordropoffAddressstring is provided, Nash parses and geocodes it to get coordinates (latitude/longitude). Parsing failure raises an error (for example, “Address not found”). - Nash performs the same parsing and geocoding for
pickupPlaceIdanddropoffPlaceId.
- If a raw
- Identical location check:
- Nash raises an error if
pickupPlaceIdanddropoffPlaceIdare the same. - After parsing, Nash compares the final parsed pickup and dropoff address components and raises an error if they’re identical.
- Nash raises an error if
- Cross-country check: Fails if the parsed
pickupAddressCountryanddropoffAddressCountryare not the same. - Distance check:
- Nash calculates the straight-line distance between the pickup and dropoff coordinates.
- That distance is checked against an organization-specific maximum delivery distance preference, and fails if it exceeds the maximum.
Required & conditional fields
- Core required fields: Checks that a value is present for:
valueCents,pickupPhoneNumber,dropoffPhoneNumber,deliveryMode. - Contact name requirement:
- Requires either
pickupFirstNameorpickupBusinessNameto be present. - Requires either
dropoffFirstNameordropoffBusinessNameto be present.
- Requires either
Data type & format validation
- Integer fields: Verifies that
valueCents,tipAmountCents, anditemsCountare valid integers. - Float/decimal fields: Verifies that dimensional fields (
weight,height,width,depth,volume) are valid decimal numbers and are greater than 0. - Units: Nash stores weight in kilograms and dimensions in centimeters. Send those units and you don’t need to say so. To send imperial values instead, declare the unit and Nash converts on ingest:
weightUnitacceptslborlbs(case-insensitive) and convertsweightto kilograms. Omitting it, or sendingkg, stores the value as given. Any other value is rejected withORDER_INVALID_WEIGHT_UNIT.lengthUnitacceptsin,inch, orinches(case-insensitive) and convertsheight,width, anddepthto centimeters.volumeis read as cubic inches and converted to cubic centimeters, since one unit covers all four fields. Omitting it, or sendingcm, stores the values as given. Any other value is rejected withORDER_INVALID_LENGTH_UNIT.- Declaring a unit without the matching value is harmless —
weightUnitwith noweightconverts nothing.
- Order value: Checks that
valueCentsis greater than 0. - Item count: Checks that
itemsCount, if provided, is at least 1. - Name fields: Checks that all name fields (
pickupFirstName, etc.) are strings and do not exceed a maximum length (80 characters). - Phone numbers:
- Checks that
pickupPhoneNumberanddropoffPhoneNumberare valid phone numbers for the corresponding country. - If the number is invalid but the organization has a default backup phone number configured, Nash uses the backup number instead of failing.
- Checks that
- Items: If the
itemsfield is provided, Nash validates that each entry in the list is a valid item structure. - Order metadata:
- Nash validates that
orderMetadatahas no more than 15 key-value pairs, and that all values are simple scalar types (string, int, float, bool).
- Nash validates that
Enum & ID validation
- Delivery mode:
- Ensures
deliveryModeis one of the allowed values (noworscheduled). - If mode is
now, Nash nullifies all datetime fields. - If mode is
scheduled, Nash requires at least one of the datetime fields (pickupStartTime, etc.) to be set.
- Ensures
- Currency:
- If a
currencyis provided, Nash checks it against the list of supported currencies. - If no currency is provided, Nash infers it from the
pickupAddressCountry.
- If a
- Requirements: Ensures all provided
requirementsare supported (see Order requirements), unless it’s acustom:requirement. - Vehicle size: Ensures
minimumVehicleSizeis one of the supported vehicle sizes. - Dispatch strategy: If
dispatchStrategyIdis provided, Nash confirms it exists, belongs to the organization, and isn’t deleted. - Delivery window: If
deliveryWindowIdis provided, Nash checks that it’s a valid, active window. - External ID uniqueness: If an
externalIdis given, Nash ensures no other order in the same organization already uses that ID.
Datetime validation
- Parsing: Parses all provided datetime strings (
pickupStartTime,pickupEndTime,dropoffStartTime,dropoffEndTime) into datetime objects, handling both UTC and timezone-localized inputs. Fails if a string is not a valid date format. - Chronological order:
pickupStartTimemust be earlier thanpickupEndTime.dropoffStartTimemust be earlier thandropoffEndTime.pickupStartTimemust be earlier thandropoffEndTime.pickupEndTimemust be earlier thandropoffEndTime.