ruby check_your_key.rb runs
them as they are.
1
Check the key
Every call carries If it comes back
Authorization: Bearer <your key>, and this one exists to
prove the key works before you build anything on it. It answers with the
account the key belongs to and the world it acts in.check_your_key.rb
invalid_api_key instead, the key is either revoked or from
the other mode. There is no third possibility: a key that authenticates at all
can do everything its mode allows, unless it was issued as read-only, in which
case it can read and every other call answers 403 read_only_key.2
Register a pickup location
A delivery is dispatched from a store, so you need at least one. Send the
name, a phone the courier can call, and the street; everything else is
optional.That
create_store.rb
st_... is the id you pass as store_id from here on. A store belongs
to the world it was created in and cannot move between them, so the ones you
make now are test stores and stay that way.3
Quote it, then dispatch it
Two calls. The first asks what a delivery to a given address costs and holds
that price; the second dispatches and charges the price you were quoted.The dropoff below is a real address in Guadalajara about 2.4 km from the
store, comfortably inside the area Listo covers. Use your own store’s
neighbourhood when you adapt this.Note the
quote_and_create.rb
Idempotency-Key header. It is required on every create, and it is
what makes a retry after a timeout safe: the same key returns the original
delivery rather than sending a second courier.4
Watch it move
Open the tracking link and you will see the courier make its way to the store
and then to the door, on the same page your customers get. Within a few
minutes the delivery walks the whole lifecycle:You can follow the same thing from your own code in two ways. Poll
GET /v1/deliveries/{id} and read status, which is fine while you are
finding your way around, or point a webhook endpoint at your server and be
told. The second is what a production integration does, and it is the next
page to read.Where to go next
- Quote and create a delivery covers the create body in full: scheduling, cash and card, the manifest, and every way the call can be refused.
- Receive and verify webhooks replaces polling with events, and shows how to check that one really came from Listo.
- Test mode explains what the simulated courier does and does not do, and how the play money behaves.
- The API reference is generated from Listo’s own test suite, so every field and example on it is one the API demonstrably answers with.