Rate API

This document shows our Rate-API docs.

ATTENTION: Make sure you have your apiKey. To learn how to generate an apiKey, check the relevant link from the side menu.

Contact

API Support

contact@mule.app

API Endpoints
# The URL you have to use in order to make requests:
https://staging-rate-op.api.mule.app/graphql/api
Headers
# Your account's apiKey which can be generated from Mule Dashboard
ApiKey: s3cretT0k2n

Getting Started

Before using this API you must know:

  1. Parameters to pass in order to make a request
  2. How to generate an API Key

1. Required information:

  1. List of Mule supported carriers for which you want to get rates such as DHL Express, DHL Road, UPS International etc.
  2. Rate cards: This is usually an excel file provided by your carrier from which your shipping prices will be calculated according to the weight of the order.
    • We can support domestic and international rate cards
    • We can support both export and import rate cards
  3. Surcharges metadata(per carrier)
    • Surcharges are additional costs applied to base rates.
    • Carriers add surcharges for fuel, Covid, Brexit, residential deliveries and more.

2. Generate API Key:

In order to get rates you must call the endpoint with your Mule account's API Key.

  1. Open the Mule Dashboard
  2. Open The Account Tab from the top right of the page.

Dashboard Image

  1. Click on the Generate API key button and use your generated API key for getting rates.

Dashboard Image

Queries

getRatesWithApiKey

Description

Getting all rates from carriers activated on your account.

Response

Returns [Rate]

Arguments
Name Description
isDDP - Boolean Is The Parcel Delivered Duty Paid
parcel - ParcelInput The Order information To Get Rate For

Example

Query
query GetRatesWithApiKey(
  $isDDP: Boolean,
  $parcel: ParcelInput
) {
  getRatesWithApiKey(
    isDDP: $isDDP,
    parcel: $parcel
  ) {
    cost {
      totalAmount {
        ...MoneyFragment
      }
      baseAmount {
        ...MoneyFragment
      }
      taxBaseAmount {
        ...MoneyFragment
      }
      taxes {
        ...TaxFragment
      }
      marginBaseAmount {
        ...MoneyFragment
      }
      marginAmount {
        ...MoneyFragment
      }
      handlingFeeAmount {
        ...MoneyFragment
      }
      surcharges {
        ...SurchargeFragment
      }
    }
    minDays
    maxDays
    rateType
    carrier
  }
}
Variables
{"isDDP": true, "parcel": ParcelInput}
Response
{
  "data": {
    "getRatesWithApiKey": [
      {
        "cost": Cost,
        "minDays": 2,
        "maxDays": 3,
        "rateType": "DROPOFF",
        "carrier": "Evri Standard"
      }
    ]
  }
}

Types

AddressInput

Description

This is the recipient address of the parcel

Fields
Input Field Description
address1 - String Address Line 1 is generally for the civic number and street name (street address).
address2 - String Address Line 2 is for the apartment, suite, unit number, or other address designation that is not part of the physical address.
address3 - String Address Line 3 is typically for the city, state, and zip code.
postcode - String! Postcode/zipcode of the address
countryName - String This is the full name of the country
countryCode - String! The Alpha-2 code of the country in ISO 3166 standard
cityName - String The full name of the city
region - String The region of the address
Example
{
  "address1": "221B Baker St",
  "address2": "abc123",
  "address3": "xyz789",
  "postcode": "NW1 6XE",
  "countryName": "United Kingdom",
  "countryCode": "GB",
  "cityName": "London",
  "region": "Greater London",
}

Boolean

Description

The Boolean scalar type represents true or false.

Example
true

Cost

Fields
Field Name Description
totalAmount - Money Returns the total cost of sending the parcel (baseAmount + all surcharges + taxes + margin)
baseAmount - Money Returns the base rate (taxes & surcharges & margins excluded)
taxBaseAmount - Money Returns tax excluded amount (tax base)
taxes - [Tax] Returns a breakdown of all taxes applied to the parcel
marginBaseAmount - Money Returns margin excluded amount (margin base)
marginAmount - Money Returns margin on a shipping rate
handlingFeeAmount - Money Returns the handling fee applied to the rate. Handling fees are charged for cross-border DDP shipments
surcharges - [Surcharge] Returns an array of all surcharges applied to the rate
Example
{
  "totalAmount": Money,
  "baseAmount": Money,
  "taxBaseAmount": Money,
  "taxes": [Tax],
  "marginBaseAmount": Money,
  "marginAmount": Money,
  "handlingFeeAmount": Money,
  "surcharges": [Surcharge]
}

Float

Description

The Float scalar type represents signed double-precision fractional values as specified by IEEE 754.

Example
987.65

Int

Description

The Int scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.

Example
987

ItemInput

Fields
Input Field Description
length - Float Length of the item in centimeters
height - Float Height of the item in centimeters
width - Float Width of the item in centimeters
weight - Float Weight of the item in kilograms
measuringSystem - MeasuringSystem The system of measurement that the units of this entity are based on. Default = METRIC
price - MoneyInput Value of the item
hsCode - String Harmonized System Code of the item (HS Code)
count - Int The quantity of this item inside the parcel
description - String Description of the item (e.g. Blue T-shirt)
Example
{
  "length": 10.2,
  "height": 9,
  "width": 10,
  "weight": 2.4,
  "measuringSystem": "METRIC",
  "price": 98.50,
  "hsCode": "100630",
  "count": 2,
  "description": "Blue T-Shirt"
}

MeasuringSystem

Description

A system of measurement is a collection of units of measurement and rules relating them to each other

Values
Enum Value Description

METRIC

Units such as meters and grams, and adds prefixes like kilo, milli, and centi to count orders of magnitude

IMPERIAL

Measured in feet, inches, and pounds.
Example
"METRIC"

Money

Fields
Field Name Description
amount - Float Integer representation of the amount of money
currency - String Currency in ISO 4217 format
Example
{"amount": 123.45, "currency": "GBP"}

MoneyInput

Fields
Input Field Description
amount - Float Integer Representation Of The Amount Of The Money
currency - String Currency In ISO 4217 Format
Example
{"amount": 987.65, "currency": "GBP"}

ParcelInput

Fields
Input Field Description
id - Int A random ID of the order
length - Float! Length of the parcel in centimeters
height - Float! Height of the parcel in centimeters
width - Float! Width of the parcel in centimeters
weight - Float! Weight of the parcel in kilograms
measuringSystem - MeasuringSystem! The system of measurement that the units of this entity are based on. Default = METRIC
price - MoneyInput Value of the parcel
count - Int The number of parcels in the shipment
description - String Description of the parcel contents
recepient - AddressInput Address of the recipient of the parcel
sender - AddressInput Address of the sender of the parcel
contents - [ItemInput] Items inside the order
Example
{
  "id": 987,
  "length": 11.5,
  "height": 10,
  "width": 10,
  "weight": 2.5,
  "measuringSystem": "METRIC",
  "price": 45.89,
  "count": 1,
  "description": "2 Black Jeans",
  "recepient": AddressInput,
  "sender": AddressInput,
  "contents": [ItemInput]
}

Rate

Fields
Field Name Description
cost - Cost The cost of shipping the parcel
minDays - Int The minimum possible number of days it takes to deliver the parcel(s)
maxDays - Int The maximum possible number of days it takes to deliver the parcel(s)
rateType - RateType The type of this rate
carrier - String The name of the carrier
Example
{
  "cost": 34.60,
  "minDays": 1,
  "maxDays": 2,
  "rateType": "DROPOFF",
  "carrier": "DHL Express"
}

RateType

Values
Enum Value Description

DROPOFF

the carrier service requires the sender to drop the parcel off at a "drop-off point". The carrier will collect the parcel from the drop-off point commence the delivery process.

POSTABLE_DROPOFF

Postable is when the parcel is small enough to be be posted through a letter-box.

NEXT_DAY_DROPOFF

Next-day refers to a service where the courier will deliver the parcel to the recipient on the next working day.

NEXT_DAY_POSTABLE_DROPOFF

This refers to a combination of a next-day, postable and drop-off service.

COLLECTION

A collection service is when the courier will come to the senders address and collect the parcel
Example
"DROPOFF"

String

Description

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Example
"xyz789"

Surcharge

Fields
Field Name Description
name - String The name of the surcharge
description - String The description of the surcharge
amount - Money The cost of the surcharge
Example
{
  "name": "Fuel surcharge",
  "description": "An additional fee charged by the carrier relating to the cost of fuel",
  "amount": 1.34
}

Tax

Fields
Field Name Description
name - String The name of the Tax
description - String The description of the Tax
amount - Money The cost of the Tax
Example
{
  "name": "VAT",
  "description": "Value added tax",
  "amount": 2.35
}