{"openapi":"3.0.3","info":{"title":"GoSwift Delivery API","version":"1.0.0","description":"Book, price, track, change and cancel same-day deliveries across New York City. Every call runs through the same booking engine as GoSwift's own booking page: the same prices, dispatch, tracking, emails, weekly invoice and cancel rules. Prices are in cents. Test keys (gsk_test_) give real prices and simulated deliveries."},"servers":[{"url":"https://goswifthq.com/api/v1"}],"security":[{"bearer":[]}],"paths":{"/locations":{"get":{"summary":"List the locations this key can book for","operationId":"listLocations","responses":{"200":{"description":"Locations","content":{"application/json":{"schema":{"type":"object","properties":{"locations":{"type":"array","items":{"type":"object","properties":{"location_id":{"type":"string"},"name":{"type":"string","nullable":true},"label":{"type":"string","nullable":true},"this_key":{"type":"boolean"}}}}}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (120 a minute per account)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/quotes":{"post":{"summary":"Price a trip","operationId":"createQuote","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Trip"}}}},"responses":{"200":{"description":"Quote, held for 15 minutes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quote"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (120 a minute per account)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/deliveries":{"post":{"summary":"Book a delivery","operationId":"createDelivery","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NewDelivery"}}}},"responses":{"200":{"description":"Already booked with this idempotency_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Booked"}}}},"201":{"description":"Booked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Booked"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The account needs a working payment method","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"price_changed, quote_price_changed or quote_expired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"idempotency_key_reused: the key was used for a different request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (120 a minute per account)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"summary":"List deliveries, newest first","operationId":"listDeliveries","parameters":[{"name":"status","in":"query","schema":{"$ref":"#/components/schemas/Status"}},{"name":"reference","in":"query","schema":{"type":"string"}},{"name":"created_after","in":"query","schema":{"type":"string","format":"date-time"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":25}},{"name":"starting_after","in":"query","description":"The last order_number of the previous page","schema":{"type":"string"}},{"name":"source","in":"query","description":"connected: orders from a connected ordering system while GoSwift delivers them","schema":{"type":"string","enum":["connected"]}}],"responses":{"200":{"description":"A page of deliveries","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Delivery"}},"has_more":{"type":"boolean"}}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (120 a minute per account)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/deliveries/{order_number}":{"get":{"summary":"Get one delivery, with the estimated delivery time and drop-off photos","operationId":"getDelivery","parameters":[{"name":"order_number","in":"path","required":true,"schema":{"type":"string","example":"GSB-ABC123XYZ"}}],"responses":{"200":{"description":"The delivery","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Delivery"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (120 a minute per account)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"summary":"Change the drop-off notes or the recipient's phone (until pickup)","operationId":"updateDelivery","parameters":[{"name":"order_number","in":"path","required":true,"schema":{"type":"string","example":"GSB-ABC123XYZ"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"notes":{"type":"string","maxLength":520},"recipient_phone":{"type":"string"}}}}}},"responses":{"200":{"description":"Changed; courier_updated says the courier has it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Delivery"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"not_editable_now: already picked up or finished","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (120 a minute per account)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/deliveries/{order_number}/cancel":{"post":{"summary":"Cancel a delivery","operationId":"cancelDelivery","parameters":[{"name":"order_number","in":"path","required":true,"schema":{"type":"string","example":"GSB-ABC123XYZ"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string"},"accept_fee_cents":{"type":"integer","description":"Required when a courier is already on the way: the fee from the 409 fee_applies answer"}}}}}},"responses":{"200":{"description":"Cancelled or canceling","content":{"application/json":{"schema":{"type":"object","properties":{"order_number":{"type":"string"},"status":{"type":"string","enum":["canceled","canceling"]},"cancel_fee_cents":{"type":"integer"}}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"fee_applies or already_closed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (120 a minute per account)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/openapi.json":{"get":{"summary":"This spec","operationId":"getSpec","security":[],"responses":{"200":{"description":"OpenAPI 3 document"}}}}},"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"gsk_live_… or gsk_test_…, made on the account page"}},"schemas":{"Status":{"type":"string","enum":["pending","finding_courier","courier_assigned","picked_up","delivered","canceled","failed","returned"]},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}}}}},"Trip":{"type":"object","required":["pickup","dropoff"],"properties":{"pickup":{"type":"string"},"dropoff":{"type":"string"},"size":{"type":"string","enum":["standard","large"]},"vehicle":{"type":"string","enum":["any","car"],"default":"any","description":"\"any\" = fastest courier. \"car\" = Priority handling (+$20): a car when one is close, otherwise the fastest courier, handled with priority; standard size only, and it can go as soon as possible. Large packages always go by car."},"location_id":{"type":"string"}}},"Quote":{"type":"object","properties":{"quote_id":{"type":"string","description":"Book with it within 15 minutes for the same trip; if the price has changed by then you get 409 quote_price_changed"},"expires_at":{"type":"string","format":"date-time"},"price_cents":{"type":"integer"},"currency":{"type":"string"},"miles":{"type":"number"},"pickup":{"type":"string"},"dropoff":{"type":"string"},"estimated_window":{"nullable":true},"min_notice_minutes":{"type":"integer","nullable":true}}},"NewDelivery":{"allOf":[{"$ref":"#/components/schemas/Trip"},{"type":"object","required":["recipient_name","recipient_phone","no_restricted_items"],"properties":{"recipient_name":{"type":"string"},"recipient_phone":{"type":"string"},"recipient_email":{"type":"string"},"no_restricted_items":{"type":"boolean","enum":[true]},"item":{"type":"string"},"notes":{"type":"string"},"reference":{"type":"string"},"deliver_by":{"type":"string","description":"ISO time; without an offset it is New York time"},"quote_id":{"type":"string","description":"Books at the quoted price; same trip, within 15 minutes"},"quote_price_cents":{"type":"integer"},"idempotency_key":{"type":"string","maxLength":128}}}]},"Booked":{"type":"object","properties":{"order_number":{"type":"string"},"status":{"$ref":"#/components/schemas/Status"},"price_cents":{"type":"integer"},"miles":{"type":"number","nullable":true},"tracking_url":{"type":"string"},"duplicate":{"type":"boolean"}}},"Delivery":{"type":"object","properties":{"order_number":{"type":"string"},"status":{"$ref":"#/components/schemas/Status"},"source":{"type":"string"},"location_id":{"type":"string"},"reference":{"type":"string","nullable":true},"price_cents":{"type":"integer"},"miles":{"type":"number","nullable":true},"pickup":{"type":"string"},"dropoff":{"type":"string"},"recipient_name":{"type":"string"},"deliver_by":{"type":"string","nullable":true},"courier":{"type":"object","nullable":true,"properties":{"first_name":{"type":"string"}}},"created_at":{"type":"string","format":"date-time"},"estimated_delivery_at":{"type":"string","format":"date-time","nullable":true},"delivered_at":{"type":"string","format":"date-time","nullable":true},"proof_photo_urls":{"type":"array","items":{"type":"string"}},"canceled_at":{"type":"string","nullable":true},"canceled_by":{"type":"string","nullable":true},"cancel_fee_cents":{"type":"integer"},"tracking_url":{"type":"string"}}},"WebhookEvent":{"type":"object","description":"POSTed to your address, signed: GoSwift-Signature: t=<unix>,v1=<hex HMAC-SHA256 of t.body>. Use id to ignore repeats.","properties":{"id":{"type":"string"},"type":{"type":"string","example":"delivery.delivered"},"created":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/Delivery"}}}}}}