{"openapi":"3.0.3","info":{"title":"D2D Delivery API","version":"1.0.0","description":"Quote, order and track parcels in Israel. Prices in ILS, excluding VAT. Cities are a closed Hebrew list (GET /api/v1/cities). Agents: read https://www.d2d.co.il/llms.txt first.","contact":{"url":"https://www.d2d.co.il/support"}},"servers":[{"url":"https://www.d2d.co.il","description":"Production"},{"url":"https://dev.d2d.co.il","description":"Sandbox — same API and prices, no real messages"}],"externalDocs":{"url":"https://www.d2d.co.il/agents","description":"Agents guide"},"components":{"securitySchemes":{"ApiKey":{"type":"apiKey","in":"header","name":"X-API-Key","description":"Created by the business at /console/business/api-keys"}}},"paths":{"/api/v1/public/quote":{"get":{"operationId":"publicQuote","summary":"Price every service for a city pair — no key","parameters":[{"name":"from_city","in":"query","required":true,"schema":{"type":"string"},"description":"Pickup city, Hebrew, from /api/v1/cities"},{"name":"to_city","in":"query","required":true,"schema":{"type":"string"},"description":"Customer city, Hebrew"},{"name":"service_type","in":"query","required":false,"schema":{"type":"string"},"description":"Omit to get every lane"},{"name":"package_size","in":"query","required":false,"schema":{"type":"string","enum":["small","medium","large","extra_large","pallet"]}},{"name":"weight_kg","in":"query","required":false,"schema":{"type":"number"}},{"name":"package_count","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"distance_km":{"type":"number"},"options":{"type":"array","items":{"type":"object","properties":{"service_type":{"type":"string","example":"economy"},"label":{"type":"string"},"sla":{"type":"string"},"price":{"type":"number","description":"ILS, excluding VAT"},"price_with_vat":{"type":"number"},"currency":{"type":"string","example":"ILS"},"promised_by":{"type":"string","format":"date-time","nullable":true},"order_cutoff_hour":{"type":"integer","nullable":true}}}},"prices_exclude_vat":{"type":"boolean"},"how_to_order":{"type":"string"},"order_endpoint":{"type":"string"}}}}}}}},"422":{"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string"},"errors":{"type":"object"}}}}}}}}},"/api/v1/public/orders":{"post":{"operationId":"orderByPhone","summary":"Order for a registered business by its phone — no key; the business confirms","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["sender_phone","customer_name","customer_phone","customer_address","customer_city"],"properties":{"sender_phone":{"type":"string","description":"The business's registered phone"},"agent":{"type":"string","description":"Who is ordering (shown to the business)"},"customer_name":{"type":"string"},"customer_phone":{"type":"string","example":"0501234567"},"customer_address":{"type":"string","example":"הרצל 10"},"customer_city":{"type":"string","description":"Hebrew, from /api/v1/cities"},"service_type":{"type":"string","example":"economy"},"scheduled_at":{"type":"string","format":"date","description":"Pickup day (today or later)"},"notes":{"type":"string","maxLength":500},"client_ref":{"type":"string","description":"Your order id; the same ref returns the same parcel"},"amount":{"type":"number","description":"Collected from the customer at the door"},"payment_method":{"type":"string","enum":["paid","cash","credit"]},"pickup_location_id":{"type":"integer","description":"A saved pickup place of the business; absent = its own address"},"package_size":{"type":"string","enum":["small","medium","large","extra_large","pallet"]},"weight_kg":{"type":"number"},"package_count":{"type":"integer"},"declared_value":{"type":"number"},"is_express":{"type":"boolean"}}}}}},"responses":{"202":{"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"order":{"type":"object","properties":{"token":{"type":"string"},"status":{"type":"string","enum":["awaiting","confirmed","declined","expired","failed"]},"status_url":{"type":"string"},"expires_at":{"type":"string"}}}}}}}}}},"404":{"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string"},"errors":{"type":"object"}}}}}},"422":{"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string"},"errors":{"type":"object"}}}}}}}}},"/api/v1/public/orders/{token}":{"get":{"operationId":"orderStatus","summary":"Where the business's answer stands; the parcel once confirmed","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"order":{"type":"object","properties":{"status":{"type":"string"},"delivery":{"type":"object","nullable":true,"properties":{"tracking_number":{"type":"string"},"tracking_url":{"type":"string"},"status":{"type":"string"}}}}}}}}}}}},"404":{"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string"},"errors":{"type":"object"}}}}}}}}},"/mcp":{"post":{"operationId":"mcp","summary":"MCP tool server (JSON-RPC 2.0): list_cities, quote_delivery, create_delivery, get_delivery, list_deliveries, cancel_delivery","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"jsonrpc":{"type":"string","example":"2.0"},"id":{"type":"integer"},"method":{"type":"string","example":"tools/list"},"params":{"type":"object"}}}}}},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}}}}}},"/api/v1/cities":{"get":{"operationId":"cities","summary":"The closed list of city names (Hebrew)","responses":{"200":{"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"cities":{"type":"array","items":{"type":"string"}}}}}}}}}}}},"/api/v1/external/deliveries/quote":{"post":{"operationId":"quote","summary":"Price for this business (its deal, intro credits)","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["customer_city"],"properties":{"customer_city":{"type":"string"},"service_type":{"type":"string"},"package_size":{"type":"string"},"weight_kg":{"type":"number"},"package_count":{"type":"integer"},"pickup_location_id":{"type":"integer"}}}}}},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"quote":{"type":"object"}}}}}}}},"422":{"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string"},"errors":{"type":"object"}}}}}}},"security":[{"ApiKey":[]}]}},"/api/v1/external/deliveries":{"post":{"operationId":"createDelivery","summary":"Order a parcel","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["customer_name","customer_phone","customer_address","customer_city"],"properties":{"customer_name":{"type":"string"},"customer_phone":{"type":"string","example":"0501234567"},"customer_address":{"type":"string","example":"הרצל 10"},"customer_city":{"type":"string","description":"Hebrew, from /api/v1/cities"},"service_type":{"type":"string","example":"economy"},"scheduled_at":{"type":"string","format":"date","description":"Pickup day (today or later)"},"notes":{"type":"string","maxLength":500},"client_ref":{"type":"string","description":"Your order id; the same ref returns the same parcel"},"amount":{"type":"number","description":"Collected from the customer at the door"},"payment_method":{"type":"string","enum":["paid","cash","credit"]},"pickup_location_id":{"type":"integer","description":"A saved pickup place of the business; absent = its own address"},"package_size":{"type":"string","enum":["small","medium","large","extra_large","pallet"]},"weight_kg":{"type":"number"},"package_count":{"type":"integer"},"declared_value":{"type":"number"},"is_express":{"type":"boolean"}}}}}},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"delivery":{"type":"object","properties":{"tracking_number":{"type":"string","example":"D2KX7RM9Q4TB"},"tracking_url":{"type":"string"},"status":{"type":"string","enum":["pending","assigned","picked_up","on_way","delivered","failed","cancelled","returned"]},"scheduled_at":{"type":"string","nullable":true},"promised_at":{"type":"string","nullable":true},"client_ref":{"type":"string","nullable":true},"customer_name":{"type":"string"},"customer_phone":{"type":"string"},"customer_address":{"type":"string"},"customer_city":{"type":"string"},"service_type":{"type":"string"},"amount":{"type":"number","nullable":true},"delivery_fee":{"type":"number"},"notes":{"type":"string","nullable":true},"created_at":{"type":"string"}}}}}}}}}},"200":{"description":"Same client_ref: the existing parcel","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"delivery":{"type":"object","properties":{"tracking_number":{"type":"string","example":"D2KX7RM9Q4TB"},"tracking_url":{"type":"string"},"status":{"type":"string","enum":["pending","assigned","picked_up","on_way","delivered","failed","cancelled","returned"]},"scheduled_at":{"type":"string","nullable":true},"promised_at":{"type":"string","nullable":true},"client_ref":{"type":"string","nullable":true},"customer_name":{"type":"string"},"customer_phone":{"type":"string"},"customer_address":{"type":"string"},"customer_city":{"type":"string"},"service_type":{"type":"string"},"amount":{"type":"number","nullable":true},"delivery_fee":{"type":"number"},"notes":{"type":"string","nullable":true},"created_at":{"type":"string"}}}}}}}}}},"422":{"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string"},"errors":{"type":"object"}}}}}}},"security":[{"ApiKey":[]}]},"get":{"operationId":"listDeliveries","summary":"The business's parcels","parameters":[{"name":"status","in":"query","schema":{"type":"string"}},{"name":"page","in":"query","schema":{"type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"tracking_number":{"type":"string","example":"D2KX7RM9Q4TB"},"tracking_url":{"type":"string"},"status":{"type":"string","enum":["pending","assigned","picked_up","on_way","delivered","failed","cancelled","returned"]},"scheduled_at":{"type":"string","nullable":true},"promised_at":{"type":"string","nullable":true},"client_ref":{"type":"string","nullable":true},"customer_name":{"type":"string"},"customer_phone":{"type":"string"},"customer_address":{"type":"string"},"customer_city":{"type":"string"},"service_type":{"type":"string"},"amount":{"type":"number","nullable":true},"delivery_fee":{"type":"number"},"notes":{"type":"string","nullable":true},"created_at":{"type":"string"}}}}}}}}}},"security":[{"ApiKey":[]}]}},"/api/v1/external/deliveries/{tracking_number}":{"get":{"operationId":"getDelivery","summary":"One parcel with its status","parameters":[{"name":"tracking_number","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"delivery":{"type":"object","properties":{"tracking_number":{"type":"string","example":"D2KX7RM9Q4TB"},"tracking_url":{"type":"string"},"status":{"type":"string","enum":["pending","assigned","picked_up","on_way","delivered","failed","cancelled","returned"]},"scheduled_at":{"type":"string","nullable":true},"promised_at":{"type":"string","nullable":true},"client_ref":{"type":"string","nullable":true},"customer_name":{"type":"string"},"customer_phone":{"type":"string"},"customer_address":{"type":"string"},"customer_city":{"type":"string"},"service_type":{"type":"string"},"amount":{"type":"number","nullable":true},"delivery_fee":{"type":"number"},"notes":{"type":"string","nullable":true},"created_at":{"type":"string"}}}}}}}}}},"404":{"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string"},"errors":{"type":"object"}}}}}}},"security":[{"ApiKey":[]}]}},"/api/v1/external/deliveries/{tracking_number}/cancel":{"post":{"operationId":"cancelDelivery","summary":"Cancel before pickup","parameters":[{"name":"tracking_number","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object"}}}}}},"422":{"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string"},"errors":{"type":"object"}}}}}}},"security":[{"ApiKey":[]}]}},"/api/v1/external/status":{"get":{"operationId":"status","summary":"Key and account status","responses":{"200":{"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object"}}}}}}},"security":[{"ApiKey":[]}]}}}}