Introduction
Welcome to the LugLess API! You can use our API to fetch pricing and create reservations.
Authentication
To authorize, use this code:
# With shell, you can just pass the correct header with each request
curl "api_endpoint_here"
-H 'Content-Type: application/json' \
-H "Authorization: Token token=\"TOKEN\", key=\"KEY\""
# With ruby, set your Token and Key as environment variables
LUGLESS_TOKEN=TOKEN
LUGLESS_KEY=KEY
Make sure to replace
TOKEN
andKEY
with the token and key from your developer key.
LugLess uses API keys to allow access to the API. You can email us for a new LugLess API key at here.
LugLess expects the API key to be included in all API requests to the server in a header that looks like the following:
Authorization: Token token="TOKEN", key="KEY"
Rates
Fetching rates
Example Request
curl 'https://app.lugless.com/api/v2/rates' \
-H 'Authorization: Token token=\"TOKEN\", key=\"KEY\"' \
-H 'Content-Type: application/json' \
-d ' {
"data": {
"attributes": {
"origin_city": "Boston",
"origin_state": "MA",
"origin_postal_code": "02111",
"origin_country_code": "US",
"destination_city": "New York",
"destination_state": "NY",
"destination_postal_code": "11430",
"destination_country_code": "US",
"pickup_date": "2019-09-19",
"carry_on_bag_count": 1,
"checked_bag_count": 0,
"oversize_bag_count": 0
},
"type": "rates"
}
}'
rate = Lugless::Rate.create(
origin_city: "Boston",
origin_state: "MA",
origin_postal_code: "02111",
origin_country_code: "US",
destination_city: "New York",
destination_state: "NY",
destination_postal_code: "11430",
destination_country_code: "US",
pickup_date: "2019-09-19",
carry_on_bag_count: 1
)
Example Response
{
"data": {
"id": "5a0a264b-83cc-40f2-8875-1262e82765ec",
"type": "rates",
"attributes": {
"meta": {
"error": null,
"is_valid_pickup_datetime": true,
"prev_valid_pickup_datetime": "2019-09-18T00:00:00.000+00:00",
"next_valid_pickup_datetime": "2019-09-20T00:00:00.000+00:00"
}
},
"relationships": {
"services": {
"data": [
{
"id": "c904baf1-e18c-4148-abda-83329425653b",
"type": "services"
},
{
"id": "627542fe-a0f2-4746-a208-15c73a644a9f",
"type": "services"
}
]
},
"plans": {
"data": [
{
"id": "5",
"type": "plans"
},
{
"id": "6",
"type": "plans"
},
{
"id": "7",
"type": "plans"
},
{
"id": "8",
"type": "plans"
}
]
}
}
},
"included": [
{
"id": "c904baf1-e18c-4148-abda-83329425653b",
"type": "services",
"attributes": {
"code": "UGX",
"shipper": "UPS",
"name": "Ground X",
"pickup_datetime": "2019-09-19T00:00:00.000Z",
"delivery_datetime": "2019-09-23T23:00:00.000Z",
"cutoff_datetime": "2019-09-19T19:59:99.999Z",
"price": 1499,
"currency": "usd",
"business_transit_days": 2
}
},
{
"id": "627542fe-a0f2-4746-a208-15c73a644a9f",
"type": "services",
"attributes": {
"code": "UGD",
"shipper": "UPS",
"name": "1 Day",
"pickup_datetime": "2019-09-19T00:00:00.000Z",
"delivery_datetime": "2019-09-20T23:00:00.000Z",
"cutoff_datetime": "2019-09-19T19:59:99.999Z",
"price": 2999,
"currency": "usd",
"business_transit_days": 1
}
},
{
"id": "5",
"type": "plans",
"attributes": {
"name": "Minimal",
"description": "Living on the edge",
"tier": 1,
"currency": "usd",
"price": 0,
"features": [
{
"category": "pickup",
"published_name": "Dropoff Luggage",
"description": null
},
{
"category": "tag",
"published_name": "Self Print Tags",
"description": null
},
{
"category": "support",
"published_name": "No Support",
"description": null
},
{
"category": "track",
"published_name": "Carrier Tracking",
"description": null
},
{
"category": "value",
"published_name": "No Insurance",
"description": null
},
{
"category": "guarantee",
"published_name": "No Guarantee",
"description": null
},
{
"category": "refund",
"published_name": "Non-Refundable",
"description": null
}
]
},
"relationships": {
"plan_set": {
"data": {
"id": "1",
"type": "plan_sets"
}
}
}
},
{
"id": "6",
"type": "plans",
"attributes": {
"name": "Basic",
"description": "Just the barebones",
"tier": 2,
"currency": "usd",
"price": 700,
"features": [
{
"category": "pickup",
"published_name": "Dropoff Luggage",
"description": null
},
{
"category": "tag",
"published_name": "Self Print Tags",
"description": null
},
{
"category": "support",
"published_name": "Email and Chat Support",
"description": null
},
{
"category": "track",
"published_name": "Carrier Tracking",
"description": null
},
{
"category": "value",
"published_name": "Insurance up to $200",
"description": null
},
{
"category": "guarantee",
"published_name": "No Guarantee",
"description": null
},
{
"category": "refund",
"published_name": "Changeable",
"description": null
}
]
},
"relationships": {
"plan_set": {
"data": {
"id": "1",
"type": "plan_sets"
}
}
}
},
{
"id": "7",
"type": "plans",
"attributes": {
"name": "Plus",
"description": "The middle road",
"tier": 3,
"currency": "usd",
"price": 1500,
"features": [
{
"category": "pickup",
"published_name": "Dropoff Luggage",
"description": null
},
{
"category": "tag",
"published_name": "Self Print Tags",
"description": null
},
{
"category": "support",
"published_name": "Email and Chat Support",
"description": null
},
{
"category": "track",
"published_name": "Enhanced Tracking",
"description": null
},
{
"category": "value",
"published_name": "Insurance up to $500",
"description": null
},
{
"category": "guarantee",
"published_name": "Carrier Guarantee",
"description": null
},
{
"category": "refund",
"published_name": "Changeable",
"description": null
}
]
},
"relationships": {
"plan_set": {
"data": {
"id": "1",
"type": "plan_sets"
}
}
}
},
{
"id": "8",
"type": "plans",
"attributes": {
"name": "Premium",
"description": "For the best",
"tier": 4,
"currency": "usd",
"price": 4600,
"features": [
{
"category": "pickup",
"published_name": "Doorstep Pickup",
"description": null
},
{
"category": "tag",
"published_name": "Custom Tags",
"description": null
},
{
"category": "support",
"published_name": "Phone Support",
"description": null
},
{
"category": "track",
"published_name": "Enhanced Tracking",
"description": null
},
{
"category": "value",
"published_name": "Insurance up to $700",
"description": null
},
{
"category": "guarantee",
"published_name": "Full Guarantee",
"description": null
},
{
"category": "refund",
"published_name": "Refundable",
"description": null
}
]
},
"relationships": {
"plan_set": {
"data": {
"id": "1",
"type": "plan_sets"
}
}
}
}
]
}
rate.plans.size
#=> 4
rate.plans.first.name
#=>"Minimal"
rate.plans.first.price
#=>0
rate.services.size
#=> 2
rate.services.id
#=> "c904baf1-e18c-4148-abda-83329425653b"
rate.services.first.name
#=> "Ground X"
rate.services.first.price
#=> 1499
rate.services.first.pickup_datetime
#=> "2019-09-19T00:00:00.000Z"
rate.services.first.delivery_datetime
#=> "2019-09-23T23:00:00.000Z"
This endpoint returns available services and plans between two addresses that pickup or deliver on a certain day.
HTTP Request
POST https://app.lugless.com/api/v2/rates
Parameter | Required | Description |
---|---|---|
origin_company | false | The origin's company name. Residential addresses should not have company names. |
origin_address1 | false | The origin's street address. |
origin_address2 | false | The origin's secondary address info such as apartment number. |
origin_city | true | |
origin_state | true | The 2 character state code for the origin. |
origin_postal_code | false | The postal code or zip code for the origin. This will be inferred from the city and state if possible. |
origin_country_code | true | The 2 character ISO code for the origin country. |
destination_company | false | The destination's company name. Residential addresses should not have company names. |
destination_address1 | false | The destination's street address. |
destination_address2 | false | The destination's secondary address info such as apartment number. |
destination_city | true | |
destination_state | true | The 2 character state code for the destination. |
destination_postal_code | false | The postal code or zip code for the destination. This will be inferred from the city and state if possible. |
destination_country_code | true | The 2 character ISO code for the destination country. |
pickup_date | false | Format: "YYYY-MM-DD" (required if the delivery_date is not present) |
delivery_date | false | Format: "YYYY-MM-DD" (required if the pickup_date is not present) |
carry_on_bag_count | false | A carry-on bag with a billable weight of 25 lbs. |
checked_bag_count | false | A checked bag with a billable weight of 50 lbs. |
oversize_bag_count | false | An oversize bag with a billable weight of 75 lbs. |
golf_bag_count | false | A golf bag with a billable weight of 50 lbs. |
ski_bag_count | false | A ski bag with a billable weight of 30 lbs. |
snowboard_bag_count | false | A snowboard bag with a billable weight of 35 lbs. |
Response
Rate Attributes
Field | Description |
---|---|
meta | Supporting information including any applicable errors when calculating rates with our partner, and suggestions for next valid pickup and delivery dates. |
Service Attributes
Field | Description |
---|---|
code | LugLess code to identify the service |
shipper | The full name of the shipper responsible for this service |
name | LugLess name to identify the service |
pickup_datetime | The pickup date and time of this service |
delivery_datetime | The delivery date and time of this service |
cutoff_datetime | The time this service can be booked until |
currency | USD is currently the only supported currency |
price | The price this service will cost in US cents |
business_transit_days | The number of business transit days this shipment will be in transit for |
Plan Attributes
Field | Description |
---|---|
name | A short name identifying the plan |
description | A longer description of the plan |
tier | The higher the tier, the more comprehensive the plan |
currency | USD is currently the only supported currency |
price | The price this plan will cost in US cents |
features | An array of features included with this plan each with the fields category, published_name, and description. |
Reservations
Create a reservation
Example Request
curl -X POST \
"https://app.lugless.com/api/v2/reservations" \
-H 'Authorization: Token token=\"TOKEN\", key=\"KEY\"' \
-H 'Content-Type: application/json' \
-d ' {
"data": {
"attributes": {
"invoice_reference": "we-love-luggage",
"email": "name@example.com",
"test": true
},
"relationships": {
"leg1_service": {
"data": {
"type": "service",
"id": "c904baf1-e18c-4148-abda-83329425653b"
}
},
"leg1_plan": {
"data": {
"type": "plan",
"id": "5"
}
}
},
"type": "reservations"
}
}'
reservation = Lugless::Reservation.create(
invoice_reference: "we-love-luggage",
email: "name@example.com",
test: true,
relationships: {
leg1_service: Lugless::Service.new(id: "c904baf1-e18c-4148-abda-83329425653b"),
leg1_plan: Lugless::Plan.new(id: "5")
}
)
Example Response
{
"data": {
"id": "XPCRJ4EN3H9V",
"type": "reservations",
"attributes": {
"code": "XPCRJ4EN3H9V",
"currency": "usd",
"total_price": 1499
},
"relationships": {
"trip": {
"data": {
"id": "402835",
"type": "trips"
}
}
}
}
}
reservation.total_price
#=> 1499
reservation.currency
#=> "usd"
reservation.code
#=> "XPCRJ4EN3H9V"
This endpoint returns the created reservation. The total_price will be 0 in test mode.
HTTP Request
POST https://app.lugless.com/api/v2/reservations
Parameter | Required | Description |
---|---|---|
invoice_reference | true | A reference used to identify this order for invoicing purposes. |
true | The email of the traveler. This is where the check in email will be sent. | |
test | false | Send false in production. The default is true which will not create any reservations or bill your account. |
leg1_service | true | A service id from the rate response |
leg1_plan | true | A plan id from the rate response |
leg2_service | false | - |
leg2_plan | false | - |
leg3_service | false | - |
leg3_plan | false | - |
Response
Reservation Attributes
Field | Description |
---|---|
code | The LugLess trip confirmation code |
currency | USD is currently the only supported currency |
price | The price this service will cost in US cents |
Errors
The LugLess API uses the following error codes:
Error Code | Meaning |
---|---|
401 | Unauthorized -- Your API key is wrong. |
403 | Forbidden -- The resource requested is hidden. |
404 | Not Found -- The specified resource could not be found. |
500 | Internal Server Error -- We had a problem with our server. Try again later. |