{"openapi":"3.1.0","info":{"title":"TrackMe Sri Lanka — Logistics & AI Agent API","version":"1.0.0","description":"Connect ChatGPT Custom GPT Actions, OpenAI Agents, n8n, Make.com, LangChain, or custom AI agents to your TrackMe Sri Lanka merchant store. Authenticate with your Merchant API Key via Bearer token or x-api-key header.","contact":{"name":"TrackMe Support","email":"support@trackme.lk","url":"https://trackme.lk/docs"}},"servers":[{"url":"https://trackme.lk","description":"TrackMe Production API"}],"security":[{"BearerAuth":[]},{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","description":"Pass your TrackMe Merchant API Key as Authorization: Bearer <API_KEY>"},"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Pass your TrackMe Merchant API Key in the x-api-key header"}}},"paths":{"/api/v1/agent/summary":{"get":{"operationId":"getStoreSummary","summary":"Get store overview, quota usage & live parcel status counts","responses":{"200":{"description":"Store summary & parcel counts"}}}},"/api/v1/agent/at-risk":{"get":{"operationId":"listAtRiskOrders","summary":"List failed delivery attempts & stalled COD orders at risk of RTO","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","default":20,"maximum":50}}],"responses":{"200":{"description":"List of at-risk shipments"}}}},"/api/v1/agent/returns":{"get":{"operationId":"listReturns","summary":"List customer return (RMA) requests","parameters":[{"name":"status","in":"query","schema":{"type":"string","enum":["PENDING","APPROVED","REJECTED","IN_TRANSIT","COMPLETED"]}},{"name":"limit","in":"query","schema":{"type":"integer","default":20,"maximum":50}}],"responses":{"200":{"description":"List of return requests"}}}},"/api/v1/agent/courier-sla":{"get":{"operationId":"getCourierSlaPerformance","summary":"Compare courier delivery success rates & NDR/RTO rates","responses":{"200":{"description":"Courier SLA leaderboard"}}}},"/api/v1/shipments":{"get":{"operationId":"listShipments","summary":"List merchant shipments with pagination and filters","parameters":[{"name":"status","in":"query","schema":{"type":"string"}},{"name":"company","in":"query","schema":{"type":"string"}},{"name":"search","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","default":20,"maximum":100}},{"name":"page","in":"query","schema":{"type":"integer","default":1}}],"responses":{"200":{"description":"Paginated shipments list"}}},"post":{"operationId":"createShipment","summary":"Register a new shipment and begin automated tracking","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["trackingNumber"],"properties":{"trackingNumber":{"type":"string"},"company":{"type":"string","description":"domex, koombiyo, prontolanka, citypack, fardardomestic, transexpress, or auto"},"orderNumber":{"type":"string"},"customerName":{"type":"string"},"customerPhone":{"type":"string"},"customerEmail":{"type":"string"},"shippingCity":{"type":"string"},"shippingAddress":{"type":"string"},"codAmount":{"type":"number"},"isCod":{"type":"boolean"}}}}}},"responses":{"201":{"description":"Shipment created"}}}},"/api/v1/shipments/{trackingNumber}":{"get":{"operationId":"getShipmentDetails","summary":"Get full tracking details and milestone history for a parcel","parameters":[{"name":"trackingNumber","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Shipment tracking details"}}}},"/api/v1/shipments/{trackingNumber}/refresh":{"post":{"operationId":"refreshShipmentLive","summary":"Force a live carrier telemetry refresh for an existing parcel","parameters":[{"name":"trackingNumber","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Updated live shipment telemetry"}}}},"/api/v1/track":{"post":{"operationId":"trackParcelLive","summary":"Perform a live ad-hoc courier tracking lookup","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["trackingNumber"],"properties":{"trackingNumber":{"type":"string"},"company":{"type":"string"},"phone":{"type":"string","description":"Required for Koombiyo"}}}}}},"responses":{"200":{"description":"Live courier tracking result"}}}},"/api/v1/notifications/send":{"post":{"operationId":"sendCustomerNotification","summary":"Send a WhatsApp, SMS, or Email update to a customer","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["trackingNumber","channel","message"],"properties":{"trackingNumber":{"type":"string"},"channel":{"type":"string","enum":["WHATSAPP","SMS","EMAIL"]},"message":{"type":"string"},"customerPhone":{"type":"string"},"customerEmail":{"type":"string"}}}}}},"responses":{"200":{"description":"Notification dispatched"}}}},"/api/v1/couriers/detect":{"post":{"operationId":"detectCourier","summary":"Auto-detect Sri Lankan courier from tracking number format","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["trackingNumber"],"properties":{"trackingNumber":{"type":"string"}}}}}},"responses":{"200":{"description":"Detected courier"}}}}}}