{
  "asyncapi": "3.0.0",
  "id": "urn:miare:webhooks:v2",
  "info": {
    "title": "Miare webhooks",
    "version": "2.0.0",
    "description": "Public HTTP POST callbacks for trip lifecycle, course additions, support issues, area changes and batch financial results. Configure your receiver URL with the Miare technical team. See the [webhook integration guide](/docs/guides/webhooks) for authentication, delivery and recovery.\n\nTrip/course/issue/area events include X-Miare-API-Version: 2. Authorization normally uses Token <client application token>; explicitly configured trip callbacks can omit it. Issue and area callbacks require it. Financial callbacks require Authorization and omit the version header.\n\nGo-service callbacks reload the current snapshot before delivery and retry HTTP 500 responses up to five times, five seconds apart. Financial callbacks preserve the original payload and use a separate configurable retry policy for any non-2XX response or network failure. Both can be duplicated or arrive out of order.\n\ncourse_added contains the whole trip; course_added__course contains one course. Delegated trip issue callbacks contain a restricted issue projection, while issue_* callbacks contain the full webhook issue snapshot. issue_updated is not emitted. The older guide also lists returning and canceled_by_delay as event names; the current Go event mapper does not emit them. They remain valid trip states, so reconcile state using List Trips rather than waiting for these callbacks.\n\nAccount enablement controls advanced return, arrival/departure, delegated issue and financial features. All monetary values are Tomans (IRT). Example identifiers and receiver addresses are illustrative.",
    "contact": {
      "name": "Miare Engineering"
    },
    "tags": [
      {
        "name": "Trip"
      },
      {
        "name": "Course"
      },
      {
        "name": "Issue"
      },
      {
        "name": "Area"
      },
      {
        "name": "Financial"
      }
    ]
  },
  "defaultContentType": "application/json",
  "servers": {
    "customerWebhook": {
      "host": "partner.example.invalid",
      "protocol": "https",
      "description": "Illustrative receiver only. The actual host and path come from the client’s configured webhook URL."
    }
  },
  "channels": {
    "clientWebhook": {
      "address": null,
      "title": "Client-configured webhook URL",
      "description": "HTTP POST to the callback URL configured for the delivery client. The example receiver host is illustrative.",
      "servers": [
        {
          "$ref": "#/servers/customerWebhook"
        }
      ],
      "messages": {
        "added": {
          "$ref": "#/components/messages/added"
        },
        "assigned": {
          "$ref": "#/components/messages/assigned"
        },
        "arrived": {
          "$ref": "#/components/messages/arrived"
        },
        "picked_up": {
          "$ref": "#/components/messages/picked_up"
        },
        "departed": {
          "$ref": "#/components/messages/departed"
        },
        "course_dropped_off": {
          "$ref": "#/components/messages/course_dropped_off"
        },
        "course_added": {
          "$ref": "#/components/messages/course_added"
        },
        "course_deleted": {
          "$ref": "#/components/messages/course_deleted"
        },
        "delivered": {
          "$ref": "#/components/messages/delivered"
        },
        "canceled_by_client": {
          "$ref": "#/components/messages/canceled_by_client"
        },
        "canceled_by_miare": {
          "$ref": "#/components/messages/canceled_by_miare"
        },
        "trip_issue_reported": {
          "$ref": "#/components/messages/trip_issue_reported"
        },
        "trip_issue_resolved": {
          "$ref": "#/components/messages/trip_issue_resolved"
        },
        "course_added__course": {
          "$ref": "#/components/messages/course_added__course"
        },
        "issue_added": {
          "$ref": "#/components/messages/issue_added"
        },
        "issue_picked": {
          "$ref": "#/components/messages/issue_picked"
        },
        "issue_resolved": {
          "$ref": "#/components/messages/issue_resolved"
        },
        "issue_message_added": {
          "$ref": "#/components/messages/issue_message_added"
        },
        "area_radius_changed": {
          "$ref": "#/components/messages/area_radius_changed"
        },
        "financial_calculated": {
          "$ref": "#/components/messages/financial_calculated"
        },
        "financial_adjusted": {
          "$ref": "#/components/messages/financial_adjusted"
        }
      }
    }
  },
  "operations": {
    "sendTripWebhooks": {
      "action": "send",
      "title": "Trip webhook events",
      "channel": {
        "$ref": "#/channels/clientWebhook"
      },
      "messages": [
        {
          "$ref": "#/channels/clientWebhook/messages/added"
        },
        {
          "$ref": "#/channels/clientWebhook/messages/assigned"
        },
        {
          "$ref": "#/channels/clientWebhook/messages/arrived"
        },
        {
          "$ref": "#/channels/clientWebhook/messages/picked_up"
        },
        {
          "$ref": "#/channels/clientWebhook/messages/departed"
        },
        {
          "$ref": "#/channels/clientWebhook/messages/course_dropped_off"
        },
        {
          "$ref": "#/channels/clientWebhook/messages/course_added"
        },
        {
          "$ref": "#/channels/clientWebhook/messages/course_deleted"
        },
        {
          "$ref": "#/channels/clientWebhook/messages/delivered"
        },
        {
          "$ref": "#/channels/clientWebhook/messages/canceled_by_client"
        },
        {
          "$ref": "#/channels/clientWebhook/messages/canceled_by_miare"
        },
        {
          "$ref": "#/channels/clientWebhook/messages/trip_issue_reported"
        },
        {
          "$ref": "#/channels/clientWebhook/messages/trip_issue_resolved"
        }
      ],
      "bindings": {
        "http": {
          "method": "POST",
          "bindingVersion": "0.3.0"
        }
      },
      "tags": [
        {
          "name": "Trip"
        }
      ]
    },
    "sendCourseWebhooks": {
      "action": "send",
      "title": "Course webhook events",
      "channel": {
        "$ref": "#/channels/clientWebhook"
      },
      "messages": [
        {
          "$ref": "#/channels/clientWebhook/messages/course_added__course"
        }
      ],
      "bindings": {
        "http": {
          "method": "POST",
          "bindingVersion": "0.3.0"
        }
      },
      "tags": [
        {
          "name": "Course"
        }
      ]
    },
    "sendIssueWebhooks": {
      "action": "send",
      "title": "Issue webhook events",
      "channel": {
        "$ref": "#/channels/clientWebhook"
      },
      "messages": [
        {
          "$ref": "#/channels/clientWebhook/messages/issue_added"
        },
        {
          "$ref": "#/channels/clientWebhook/messages/issue_picked"
        },
        {
          "$ref": "#/channels/clientWebhook/messages/issue_resolved"
        },
        {
          "$ref": "#/channels/clientWebhook/messages/issue_message_added"
        }
      ],
      "bindings": {
        "http": {
          "method": "POST",
          "bindingVersion": "0.3.0"
        }
      },
      "tags": [
        {
          "name": "Issue"
        }
      ]
    },
    "sendAreaWebhooks": {
      "action": "send",
      "title": "Area webhook events",
      "channel": {
        "$ref": "#/channels/clientWebhook"
      },
      "messages": [
        {
          "$ref": "#/channels/clientWebhook/messages/area_radius_changed"
        }
      ],
      "bindings": {
        "http": {
          "method": "POST",
          "bindingVersion": "0.3.0"
        }
      },
      "tags": [
        {
          "name": "Area"
        }
      ]
    },
    "sendFinancialWebhooks": {
      "action": "send",
      "title": "Financial webhook events",
      "description": "Separate accounting delivery policy. No X-Miare-API-Version header. Return 2XX after accepting an event; any other response or network failure is retried. The request timeout is ten seconds; default configurable delays are 30, 120, 300, 900 and 1800 seconds. Retry payloads are preserved. Deduplicate by (batch_id, revision), retain the highest revision and use financials.total_cost without reapplying cumulative changes. Receiving an event does not imply that an invoice PDF is ready.",
      "channel": {
        "$ref": "#/channels/clientWebhook"
      },
      "messages": [
        {
          "$ref": "#/channels/clientWebhook/messages/financial_calculated"
        },
        {
          "$ref": "#/channels/clientWebhook/messages/financial_adjusted"
        }
      ],
      "bindings": {
        "http": {
          "method": "POST",
          "bindingVersion": "0.3.0"
        }
      },
      "tags": [
        {
          "name": "Financial"
        }
      ]
    }
  },
  "components": {
    "messages": {
      "added": {
        "name": "added",
        "title": "added",
        "summary": "A trip was created.",
        "description": "A trip was created.",
        "headers": {
          "$ref": "#/components/schemas/TripWebhookHeaders"
        },
        "payload": {
          "$ref": "#/components/schemas/AddedPayload"
        },
        "tags": [
          {
            "name": "Trip"
          }
        ],
        "examples": [
          {
            "name": "added",
            "headers": {
              "Authorization": "Token EXAMPLE_CLIENT_TOKEN",
              "X-Miare-API-Version": "2"
            },
            "payload": {
              "event": "added",
              "trip": {
                "id": "11111111-1111-4111-8111-111111111111",
                "batch_id": "11111111-1111-4111-8111-111111111111",
                "area": {
                  "id": "12",
                  "name": "Example area"
                },
                "pickup": {
                  "name": "Example pickup",
                  "phone_number": "02100000000",
                  "address": "Example pickup address",
                  "image": "",
                  "location": {
                    "latitude": 35.73,
                    "longitude": 51.41
                  },
                  "deadline": null
                },
                "courses": [
                  {
                    "id": "22222222-2222-4222-8222-222222222222",
                    "trip_id": "11111111-1111-4111-8111-111111111111",
                    "bill_number": "DEMO-100",
                    "requires_box": false,
                    "name": "Example recipient",
                    "phone_number": "09000000000",
                    "address": "Example drop-off address",
                    "location": {
                      "latitude": 35.74,
                      "longitude": 51.42
                    },
                    "payment": {
                      "price": 0,
                      "payment_type": "cash"
                    },
                    "manifest_items": [
                      {
                        "name": "Example package",
                        "quantity": 1
                      }
                    ],
                    "dropped_off_at": null,
                    "tracking_url": "https://tracking.example.invalid/DEMOHASH01"
                  }
                ],
                "courier": null,
                "created_at": "2026-11-29T10:00:00Z",
                "assigned_at": null,
                "picked_up_at": null,
                "delivery_cost": null,
                "arrived_at": null,
                "departed_at": null,
                "state": "assign_queue",
                "boost": {
                  "level": 0,
                  "amount": 0
                }
              }
            }
          },
          {
            "name": "configured-tokenless-trip-callback",
            "headers": {
              "X-Miare-API-Version": "2"
            },
            "payload": {
              "event": "added",
              "trip": {
                "id": "11111111-1111-4111-8111-111111111111",
                "batch_id": "11111111-1111-4111-8111-111111111111",
                "area": {
                  "id": "12",
                  "name": "Example area"
                },
                "pickup": {
                  "name": "Example pickup",
                  "phone_number": "02100000000",
                  "address": "Example pickup address",
                  "image": "",
                  "location": {
                    "latitude": 35.73,
                    "longitude": 51.41
                  },
                  "deadline": null
                },
                "courses": [
                  {
                    "id": "22222222-2222-4222-8222-222222222222",
                    "trip_id": "11111111-1111-4111-8111-111111111111",
                    "bill_number": "DEMO-100",
                    "requires_box": false,
                    "name": "Example recipient",
                    "phone_number": "09000000000",
                    "address": "Example drop-off address",
                    "location": {
                      "latitude": 35.74,
                      "longitude": 51.42
                    },
                    "payment": {
                      "price": 0,
                      "payment_type": "cash"
                    },
                    "manifest_items": [
                      {
                        "name": "Example package",
                        "quantity": 1
                      }
                    ],
                    "dropped_off_at": null,
                    "tracking_url": "https://tracking.example.invalid/DEMOHASH01"
                  }
                ],
                "courier": null,
                "created_at": "2026-11-29T10:00:00Z",
                "assigned_at": null,
                "picked_up_at": null,
                "delivery_cost": null,
                "arrived_at": null,
                "departed_at": null,
                "state": "assign_queue",
                "boost": {
                  "level": 0,
                  "amount": 0
                }
              }
            }
          }
        ],
        "externalDocs": {
          "description": "Source in websocket",
          "url": "https://git.miare.ir/miare/websocket/-/blob/fea3fdd932db57d447eb35d1c22c9033914f1fd6/realtime/interfaces/webhooks/informers/v2/informer_impl.go#L170"
        }
      },
      "assigned": {
        "name": "assigned",
        "title": "assigned",
        "summary": "An assignment was made, confirmed as seen, or revoked.",
        "description": "An assignment was made, confirmed as seen, or revoked. Delivery may wait for courier visibility; an unseen revocation can be suppressed. Reconcile the supplied trip snapshot.",
        "headers": {
          "$ref": "#/components/schemas/TripWebhookHeaders"
        },
        "payload": {
          "$ref": "#/components/schemas/AssignedPayload"
        },
        "tags": [
          {
            "name": "Trip"
          }
        ],
        "examples": [
          {
            "name": "assigned",
            "headers": {
              "Authorization": "Token EXAMPLE_CLIENT_TOKEN",
              "X-Miare-API-Version": "2"
            },
            "payload": {
              "event": "assigned",
              "trip": {
                "id": "11111111-1111-4111-8111-111111111111",
                "batch_id": "11111111-1111-4111-8111-111111111111",
                "area": {
                  "id": "12",
                  "name": "Example area"
                },
                "pickup": {
                  "name": "Example pickup",
                  "phone_number": "02100000000",
                  "address": "Example pickup address",
                  "image": "",
                  "location": {
                    "latitude": 35.73,
                    "longitude": 51.41
                  },
                  "deadline": null
                },
                "courses": [
                  {
                    "id": "22222222-2222-4222-8222-222222222222",
                    "trip_id": "11111111-1111-4111-8111-111111111111",
                    "bill_number": "DEMO-100",
                    "requires_box": false,
                    "name": "Example recipient",
                    "phone_number": "09000000000",
                    "address": "Example drop-off address",
                    "location": {
                      "latitude": 35.74,
                      "longitude": 51.42
                    },
                    "payment": {
                      "price": 0,
                      "payment_type": "cash"
                    },
                    "manifest_items": [
                      {
                        "name": "Example package",
                        "quantity": 1
                      }
                    ],
                    "dropped_off_at": null,
                    "tracking_url": "https://tracking.example.invalid/DEMOHASH01"
                  }
                ],
                "courier": {
                  "name": "Example Courier",
                  "first_name": "Example",
                  "last_name": "Courier",
                  "image": "",
                  "phone_number": "09000000001",
                  "location_updated_at": "2026-11-29T10:00:00Z",
                  "location": {
                    "latitude": 35.735,
                    "longitude": 51.415
                  }
                },
                "created_at": "2026-11-29T10:00:00Z",
                "assigned_at": "2026-11-29T10:00:00Z",
                "picked_up_at": null,
                "delivery_cost": null,
                "arrived_at": null,
                "departed_at": null,
                "state": "pickup",
                "boost": {
                  "level": 0,
                  "amount": 0
                }
              }
            }
          },
          {
            "name": "assignment-revoked",
            "headers": {
              "Authorization": "Token EXAMPLE_CLIENT_TOKEN",
              "X-Miare-API-Version": "2"
            },
            "payload": {
              "event": "assigned",
              "trip": {
                "id": "11111111-1111-4111-8111-111111111111",
                "batch_id": "11111111-1111-4111-8111-111111111111",
                "area": {
                  "id": "12",
                  "name": "Example area"
                },
                "pickup": {
                  "name": "Example pickup",
                  "phone_number": "02100000000",
                  "address": "Example pickup address",
                  "image": "",
                  "location": {
                    "latitude": 35.73,
                    "longitude": 51.41
                  },
                  "deadline": null
                },
                "courses": [
                  {
                    "id": "22222222-2222-4222-8222-222222222222",
                    "trip_id": "11111111-1111-4111-8111-111111111111",
                    "bill_number": "DEMO-100",
                    "requires_box": false,
                    "name": "Example recipient",
                    "phone_number": "09000000000",
                    "address": "Example drop-off address",
                    "location": {
                      "latitude": 35.74,
                      "longitude": 51.42
                    },
                    "payment": {
                      "price": 0,
                      "payment_type": "cash"
                    },
                    "manifest_items": [
                      {
                        "name": "Example package",
                        "quantity": 1
                      }
                    ],
                    "dropped_off_at": null,
                    "tracking_url": "https://tracking.example.invalid/DEMOHASH01"
                  }
                ],
                "courier": null,
                "created_at": "2026-11-29T10:00:00Z",
                "assigned_at": null,
                "picked_up_at": null,
                "delivery_cost": null,
                "arrived_at": null,
                "departed_at": null,
                "state": "assign_queue",
                "boost": {
                  "level": 0,
                  "amount": 0
                }
              }
            }
          }
        ],
        "externalDocs": {
          "description": "Source in websocket",
          "url": "https://git.miare.ir/miare/websocket/-/blob/fea3fdd932db57d447eb35d1c22c9033914f1fd6/realtime/interfaces/webhooks/informers/v2/informer_impl.go#L170"
        }
      },
      "arrived": {
        "name": "arrived",
        "title": "arrived",
        "summary": "The courier arrived at pickup.",
        "description": "The courier arrived at pickup. Emitted only when arrival/departure notifications are enabled for the client.",
        "headers": {
          "$ref": "#/components/schemas/TripWebhookHeaders"
        },
        "payload": {
          "$ref": "#/components/schemas/ArrivedPayload"
        },
        "tags": [
          {
            "name": "Trip"
          }
        ],
        "examples": [
          {
            "name": "arrived",
            "headers": {
              "Authorization": "Token EXAMPLE_CLIENT_TOKEN",
              "X-Miare-API-Version": "2"
            },
            "payload": {
              "event": "arrived",
              "trip": {
                "id": "11111111-1111-4111-8111-111111111111",
                "batch_id": "11111111-1111-4111-8111-111111111111",
                "area": {
                  "id": "12",
                  "name": "Example area"
                },
                "pickup": {
                  "name": "Example pickup",
                  "phone_number": "02100000000",
                  "address": "Example pickup address",
                  "image": "",
                  "location": {
                    "latitude": 35.73,
                    "longitude": 51.41
                  },
                  "deadline": null
                },
                "courses": [
                  {
                    "id": "22222222-2222-4222-8222-222222222222",
                    "trip_id": "11111111-1111-4111-8111-111111111111",
                    "bill_number": "DEMO-100",
                    "requires_box": false,
                    "name": "Example recipient",
                    "phone_number": "09000000000",
                    "address": "Example drop-off address",
                    "location": {
                      "latitude": 35.74,
                      "longitude": 51.42
                    },
                    "payment": {
                      "price": 0,
                      "payment_type": "cash"
                    },
                    "manifest_items": [
                      {
                        "name": "Example package",
                        "quantity": 1
                      }
                    ],
                    "dropped_off_at": null,
                    "tracking_url": "https://tracking.example.invalid/DEMOHASH01"
                  }
                ],
                "courier": {
                  "name": "Example Courier",
                  "first_name": "Example",
                  "last_name": "Courier",
                  "image": "",
                  "phone_number": "09000000001",
                  "location_updated_at": "2026-11-29T10:00:00Z",
                  "location": {
                    "latitude": 35.735,
                    "longitude": 51.415
                  }
                },
                "created_at": "2026-11-29T10:00:00Z",
                "assigned_at": "2026-11-29T10:00:00Z",
                "picked_up_at": null,
                "delivery_cost": null,
                "arrived_at": "2026-11-29T10:00:00Z",
                "departed_at": null,
                "state": "receiving",
                "boost": {
                  "level": 0,
                  "amount": 0
                }
              }
            }
          }
        ],
        "externalDocs": {
          "description": "Source in websocket",
          "url": "https://git.miare.ir/miare/websocket/-/blob/fea3fdd932db57d447eb35d1c22c9033914f1fd6/realtime/interfaces/webhooks/informers/v2/informer_impl.go#L170"
        }
      },
      "picked_up": {
        "name": "picked_up",
        "title": "picked_up",
        "summary": "The pickup was accepted.",
        "description": "The pickup was accepted. The snapshot may be departing or dropoff depending on client configuration.",
        "headers": {
          "$ref": "#/components/schemas/TripWebhookHeaders"
        },
        "payload": {
          "$ref": "#/components/schemas/PickedUpPayload"
        },
        "tags": [
          {
            "name": "Trip"
          }
        ],
        "examples": [
          {
            "name": "picked_up",
            "headers": {
              "Authorization": "Token EXAMPLE_CLIENT_TOKEN",
              "X-Miare-API-Version": "2"
            },
            "payload": {
              "event": "picked_up",
              "trip": {
                "id": "11111111-1111-4111-8111-111111111111",
                "batch_id": "11111111-1111-4111-8111-111111111111",
                "area": {
                  "id": "12",
                  "name": "Example area"
                },
                "pickup": {
                  "name": "Example pickup",
                  "phone_number": "02100000000",
                  "address": "Example pickup address",
                  "image": "",
                  "location": {
                    "latitude": 35.73,
                    "longitude": 51.41
                  },
                  "deadline": null
                },
                "courses": [
                  {
                    "id": "22222222-2222-4222-8222-222222222222",
                    "trip_id": "11111111-1111-4111-8111-111111111111",
                    "bill_number": "DEMO-100",
                    "requires_box": false,
                    "name": "Example recipient",
                    "phone_number": "09000000000",
                    "address": "Example drop-off address",
                    "location": {
                      "latitude": 35.74,
                      "longitude": 51.42
                    },
                    "payment": {
                      "price": 0,
                      "payment_type": "cash"
                    },
                    "manifest_items": [
                      {
                        "name": "Example package",
                        "quantity": 1
                      }
                    ],
                    "dropped_off_at": null,
                    "tracking_url": "https://tracking.example.invalid/DEMOHASH01"
                  }
                ],
                "courier": {
                  "name": "Example Courier",
                  "first_name": "Example",
                  "last_name": "Courier",
                  "image": "",
                  "phone_number": "09000000001",
                  "location_updated_at": "2026-11-29T10:00:00Z",
                  "location": {
                    "latitude": 35.735,
                    "longitude": 51.415
                  }
                },
                "created_at": "2026-11-29T10:00:00Z",
                "assigned_at": "2026-11-29T10:00:00Z",
                "picked_up_at": "2026-11-29T10:00:00Z",
                "delivery_cost": null,
                "arrived_at": "2026-11-29T10:00:00Z",
                "departed_at": null,
                "state": "departing",
                "boost": {
                  "level": 0,
                  "amount": 0
                }
              }
            }
          }
        ],
        "externalDocs": {
          "description": "Source in websocket",
          "url": "https://git.miare.ir/miare/websocket/-/blob/fea3fdd932db57d447eb35d1c22c9033914f1fd6/realtime/interfaces/webhooks/informers/v2/informer_impl.go#L170"
        }
      },
      "departed": {
        "name": "departed",
        "title": "departed",
        "summary": "The courier departed pickup.",
        "description": "The courier departed pickup. Emitted only when arrival/departure notifications are enabled for the client.",
        "headers": {
          "$ref": "#/components/schemas/TripWebhookHeaders"
        },
        "payload": {
          "$ref": "#/components/schemas/DepartedPayload"
        },
        "tags": [
          {
            "name": "Trip"
          }
        ],
        "examples": [
          {
            "name": "departed",
            "headers": {
              "Authorization": "Token EXAMPLE_CLIENT_TOKEN",
              "X-Miare-API-Version": "2"
            },
            "payload": {
              "event": "departed",
              "trip": {
                "id": "11111111-1111-4111-8111-111111111111",
                "batch_id": "11111111-1111-4111-8111-111111111111",
                "area": {
                  "id": "12",
                  "name": "Example area"
                },
                "pickup": {
                  "name": "Example pickup",
                  "phone_number": "02100000000",
                  "address": "Example pickup address",
                  "image": "",
                  "location": {
                    "latitude": 35.73,
                    "longitude": 51.41
                  },
                  "deadline": null
                },
                "courses": [
                  {
                    "id": "22222222-2222-4222-8222-222222222222",
                    "trip_id": "11111111-1111-4111-8111-111111111111",
                    "bill_number": "DEMO-100",
                    "requires_box": false,
                    "name": "Example recipient",
                    "phone_number": "09000000000",
                    "address": "Example drop-off address",
                    "location": {
                      "latitude": 35.74,
                      "longitude": 51.42
                    },
                    "payment": {
                      "price": 0,
                      "payment_type": "cash"
                    },
                    "manifest_items": [
                      {
                        "name": "Example package",
                        "quantity": 1
                      }
                    ],
                    "dropped_off_at": null,
                    "tracking_url": "https://tracking.example.invalid/DEMOHASH01"
                  }
                ],
                "courier": {
                  "name": "Example Courier",
                  "first_name": "Example",
                  "last_name": "Courier",
                  "image": "",
                  "phone_number": "09000000001",
                  "location_updated_at": "2026-11-29T10:00:00Z",
                  "location": {
                    "latitude": 35.735,
                    "longitude": 51.415
                  }
                },
                "created_at": "2026-11-29T10:00:00Z",
                "assigned_at": "2026-11-29T10:00:00Z",
                "picked_up_at": "2026-11-29T10:00:00Z",
                "delivery_cost": null,
                "arrived_at": "2026-11-29T10:00:00Z",
                "departed_at": "2026-11-29T10:00:00Z",
                "state": "dropoff",
                "boost": {
                  "level": 0,
                  "amount": 0
                }
              }
            }
          }
        ],
        "externalDocs": {
          "description": "Source in websocket",
          "url": "https://git.miare.ir/miare/websocket/-/blob/fea3fdd932db57d447eb35d1c22c9033914f1fd6/realtime/interfaces/webhooks/informers/v2/informer_impl.go#L170"
        }
      },
      "course_dropped_off": {
        "name": "course_dropped_off",
        "title": "course_dropped_off",
        "summary": "A course was completed.",
        "description": "A course was completed. This payload contains the full trip, not a top-level course object. For configured clients, completion of the final course can emit delivered instead.",
        "headers": {
          "$ref": "#/components/schemas/TripWebhookHeaders"
        },
        "payload": {
          "$ref": "#/components/schemas/CourseDroppedOffPayload"
        },
        "tags": [
          {
            "name": "Trip"
          }
        ],
        "examples": [
          {
            "name": "course_dropped_off",
            "headers": {
              "Authorization": "Token EXAMPLE_CLIENT_TOKEN",
              "X-Miare-API-Version": "2"
            },
            "payload": {
              "event": "course_dropped_off",
              "trip": {
                "id": "11111111-1111-4111-8111-111111111111",
                "batch_id": "11111111-1111-4111-8111-111111111111",
                "area": {
                  "id": "12",
                  "name": "Example area"
                },
                "pickup": {
                  "name": "Example pickup",
                  "phone_number": "02100000000",
                  "address": "Example pickup address",
                  "image": "",
                  "location": {
                    "latitude": 35.73,
                    "longitude": 51.41
                  },
                  "deadline": null
                },
                "courses": [
                  {
                    "id": "22222222-2222-4222-8222-222222222222",
                    "trip_id": "11111111-1111-4111-8111-111111111111",
                    "bill_number": "DEMO-100",
                    "requires_box": false,
                    "name": "Example recipient",
                    "phone_number": "09000000000",
                    "address": "Example drop-off address",
                    "location": {
                      "latitude": 35.74,
                      "longitude": 51.42
                    },
                    "payment": {
                      "price": 0,
                      "payment_type": "cash"
                    },
                    "manifest_items": [
                      {
                        "name": "Example package",
                        "quantity": 1
                      }
                    ],
                    "dropped_off_at": null,
                    "tracking_url": "https://tracking.example.invalid/DEMOHASH01"
                  }
                ],
                "courier": {
                  "name": "Example Courier",
                  "first_name": "Example",
                  "last_name": "Courier",
                  "image": "",
                  "phone_number": "09000000001",
                  "location_updated_at": "2026-11-29T10:00:00Z",
                  "location": {
                    "latitude": 35.735,
                    "longitude": 51.415
                  }
                },
                "created_at": "2026-11-29T10:00:00Z",
                "assigned_at": "2026-11-29T10:00:00Z",
                "picked_up_at": "2026-11-29T10:00:00Z",
                "delivery_cost": null,
                "arrived_at": "2026-11-29T10:00:00Z",
                "departed_at": "2026-11-29T10:00:00Z",
                "state": "dropoff",
                "boost": {
                  "level": 0,
                  "amount": 0
                }
              }
            }
          }
        ],
        "externalDocs": {
          "description": "Source in websocket",
          "url": "https://git.miare.ir/miare/websocket/-/blob/fea3fdd932db57d447eb35d1c22c9033914f1fd6/realtime/interfaces/webhooks/informers/v2/informer_impl.go#L170"
        }
      },
      "course_added": {
        "name": "course_added",
        "title": "course_added",
        "summary": "A course was added.",
        "description": "A course was added. A full-trip callback accompanies the per-course course_added__course callbacks.",
        "headers": {
          "$ref": "#/components/schemas/TripWebhookHeaders"
        },
        "payload": {
          "$ref": "#/components/schemas/CourseAddedPayload"
        },
        "tags": [
          {
            "name": "Trip"
          }
        ],
        "examples": [
          {
            "name": "course_added",
            "headers": {
              "Authorization": "Token EXAMPLE_CLIENT_TOKEN",
              "X-Miare-API-Version": "2"
            },
            "payload": {
              "event": "course_added",
              "trip": {
                "id": "11111111-1111-4111-8111-111111111111",
                "batch_id": "11111111-1111-4111-8111-111111111111",
                "area": {
                  "id": "12",
                  "name": "Example area"
                },
                "pickup": {
                  "name": "Example pickup",
                  "phone_number": "02100000000",
                  "address": "Example pickup address",
                  "image": "",
                  "location": {
                    "latitude": 35.73,
                    "longitude": 51.41
                  },
                  "deadline": null
                },
                "courses": [
                  {
                    "id": "22222222-2222-4222-8222-222222222222",
                    "trip_id": "11111111-1111-4111-8111-111111111111",
                    "bill_number": "DEMO-100",
                    "requires_box": false,
                    "name": "Example recipient",
                    "phone_number": "09000000000",
                    "address": "Example drop-off address",
                    "location": {
                      "latitude": 35.74,
                      "longitude": 51.42
                    },
                    "payment": {
                      "price": 0,
                      "payment_type": "cash"
                    },
                    "manifest_items": [
                      {
                        "name": "Example package",
                        "quantity": 1
                      }
                    ],
                    "dropped_off_at": null,
                    "tracking_url": "https://tracking.example.invalid/DEMOHASH01"
                  }
                ],
                "courier": {
                  "name": "Example Courier",
                  "first_name": "Example",
                  "last_name": "Courier",
                  "image": "",
                  "phone_number": "09000000001",
                  "location_updated_at": "2026-11-29T10:00:00Z",
                  "location": {
                    "latitude": 35.735,
                    "longitude": 51.415
                  }
                },
                "created_at": "2026-11-29T10:00:00Z",
                "assigned_at": "2026-11-29T10:00:00Z",
                "picked_up_at": "2026-11-29T10:00:00Z",
                "delivery_cost": null,
                "arrived_at": "2026-11-29T10:00:00Z",
                "departed_at": "2026-11-29T10:00:00Z",
                "state": "dropoff",
                "boost": {
                  "level": 0,
                  "amount": 0
                }
              }
            }
          }
        ],
        "externalDocs": {
          "description": "Source in websocket",
          "url": "https://git.miare.ir/miare/websocket/-/blob/fea3fdd932db57d447eb35d1c22c9033914f1fd6/realtime/interfaces/webhooks/informers/v2/informer_impl.go#L170"
        }
      },
      "course_deleted": {
        "name": "course_deleted",
        "title": "course_deleted",
        "summary": "A course was removed.",
        "description": "A course was removed. This callback contains the updated full trip; no course_deleted__course callback is emitted.",
        "headers": {
          "$ref": "#/components/schemas/TripWebhookHeaders"
        },
        "payload": {
          "$ref": "#/components/schemas/CourseDeletedPayload"
        },
        "tags": [
          {
            "name": "Trip"
          }
        ],
        "examples": [
          {
            "name": "course_deleted",
            "headers": {
              "Authorization": "Token EXAMPLE_CLIENT_TOKEN",
              "X-Miare-API-Version": "2"
            },
            "payload": {
              "event": "course_deleted",
              "trip": {
                "id": "11111111-1111-4111-8111-111111111111",
                "batch_id": "11111111-1111-4111-8111-111111111111",
                "area": {
                  "id": "12",
                  "name": "Example area"
                },
                "pickup": {
                  "name": "Example pickup",
                  "phone_number": "02100000000",
                  "address": "Example pickup address",
                  "image": "",
                  "location": {
                    "latitude": 35.73,
                    "longitude": 51.41
                  },
                  "deadline": null
                },
                "courses": [
                  {
                    "id": "22222222-2222-4222-8222-222222222222",
                    "trip_id": "11111111-1111-4111-8111-111111111111",
                    "bill_number": "DEMO-100",
                    "requires_box": false,
                    "name": "Example recipient",
                    "phone_number": "09000000000",
                    "address": "Example drop-off address",
                    "location": {
                      "latitude": 35.74,
                      "longitude": 51.42
                    },
                    "payment": {
                      "price": 0,
                      "payment_type": "cash"
                    },
                    "manifest_items": [
                      {
                        "name": "Example package",
                        "quantity": 1
                      }
                    ],
                    "dropped_off_at": null,
                    "tracking_url": "https://tracking.example.invalid/DEMOHASH01"
                  }
                ],
                "courier": {
                  "name": "Example Courier",
                  "first_name": "Example",
                  "last_name": "Courier",
                  "image": "",
                  "phone_number": "09000000001",
                  "location_updated_at": "2026-11-29T10:00:00Z",
                  "location": {
                    "latitude": 35.735,
                    "longitude": 51.415
                  }
                },
                "created_at": "2026-11-29T10:00:00Z",
                "assigned_at": "2026-11-29T10:00:00Z",
                "picked_up_at": "2026-11-29T10:00:00Z",
                "delivery_cost": null,
                "arrived_at": "2026-11-29T10:00:00Z",
                "departed_at": "2026-11-29T10:00:00Z",
                "state": "dropoff",
                "boost": {
                  "level": 0,
                  "amount": 0
                }
              }
            }
          }
        ],
        "externalDocs": {
          "description": "Source in websocket",
          "url": "https://git.miare.ir/miare/websocket/-/blob/fea3fdd932db57d447eb35d1c22c9033914f1fd6/realtime/interfaces/webhooks/informers/v2/informer_impl.go#L170"
        }
      },
      "delivered": {
        "name": "delivered",
        "title": "delivered",
        "summary": "The trip completed, or a configured final-course completion produced a delivered snapshot.",
        "description": "The trip completed, or a configured final-course completion produced a delivered snapshot. Event-driven and current-state delivery can overlap.",
        "headers": {
          "$ref": "#/components/schemas/TripWebhookHeaders"
        },
        "payload": {
          "$ref": "#/components/schemas/DeliveredPayload"
        },
        "tags": [
          {
            "name": "Trip"
          }
        ],
        "examples": [
          {
            "name": "delivered",
            "headers": {
              "Authorization": "Token EXAMPLE_CLIENT_TOKEN",
              "X-Miare-API-Version": "2"
            },
            "payload": {
              "event": "delivered",
              "trip": {
                "id": "11111111-1111-4111-8111-111111111111",
                "batch_id": "11111111-1111-4111-8111-111111111111",
                "area": {
                  "id": "12",
                  "name": "Example area"
                },
                "pickup": {
                  "name": "Example pickup",
                  "phone_number": "02100000000",
                  "address": "Example pickup address",
                  "image": "",
                  "location": {
                    "latitude": 35.73,
                    "longitude": 51.41
                  },
                  "deadline": null
                },
                "courses": [
                  {
                    "id": "22222222-2222-4222-8222-222222222222",
                    "trip_id": "11111111-1111-4111-8111-111111111111",
                    "bill_number": "DEMO-100",
                    "requires_box": false,
                    "name": "Example recipient",
                    "phone_number": "09000000000",
                    "address": "Example drop-off address",
                    "location": {
                      "latitude": 35.74,
                      "longitude": 51.42
                    },
                    "payment": {
                      "price": 0,
                      "payment_type": "cash"
                    },
                    "manifest_items": [
                      {
                        "name": "Example package",
                        "quantity": 1
                      }
                    ],
                    "dropped_off_at": "2026-11-29T10:00:00Z",
                    "tracking_url": "https://tracking.example.invalid/DEMOHASH01"
                  }
                ],
                "courier": {
                  "name": "Example Courier",
                  "first_name": "Example",
                  "last_name": "Courier",
                  "image": "",
                  "phone_number": "09000000001",
                  "location_updated_at": "2026-11-29T10:00:00Z",
                  "location": {
                    "latitude": 35.766428,
                    "longitude": 51.395183
                  }
                },
                "created_at": "2026-11-29T10:00:00Z",
                "assigned_at": "2026-11-29T10:00:00Z",
                "picked_up_at": "2026-11-29T10:00:00Z",
                "delivery_cost": 12000,
                "arrived_at": "2026-11-29T10:00:00Z",
                "departed_at": "2026-11-29T10:00:00Z",
                "state": "delivered",
                "boost": {
                  "level": 0,
                  "amount": 0
                }
              }
            }
          }
        ],
        "externalDocs": {
          "description": "Source in websocket",
          "url": "https://git.miare.ir/miare/websocket/-/blob/fea3fdd932db57d447eb35d1c22c9033914f1fd6/realtime/interfaces/webhooks/informers/v2/informer_impl.go#L170"
        }
      },
      "canceled_by_client": {
        "name": "canceled_by_client",
        "title": "canceled_by_client",
        "summary": "The client canceled the trip.",
        "description": "The client canceled the trip. The current state may also be canceled_by_delay for configured clients.",
        "headers": {
          "$ref": "#/components/schemas/TripWebhookHeaders"
        },
        "payload": {
          "$ref": "#/components/schemas/CanceledByClientPayload"
        },
        "tags": [
          {
            "name": "Trip"
          }
        ],
        "examples": [
          {
            "name": "canceled_by_client",
            "headers": {
              "Authorization": "Token EXAMPLE_CLIENT_TOKEN",
              "X-Miare-API-Version": "2"
            },
            "payload": {
              "event": "canceled_by_client",
              "trip": {
                "id": "11111111-1111-4111-8111-111111111111",
                "batch_id": "11111111-1111-4111-8111-111111111111",
                "area": {
                  "id": "12",
                  "name": "Example area"
                },
                "pickup": {
                  "name": "Example pickup",
                  "phone_number": "02100000000",
                  "address": "Example pickup address",
                  "image": "",
                  "location": {
                    "latitude": 35.73,
                    "longitude": 51.41
                  },
                  "deadline": null
                },
                "courses": [
                  {
                    "id": "22222222-2222-4222-8222-222222222222",
                    "trip_id": "11111111-1111-4111-8111-111111111111",
                    "bill_number": "DEMO-100",
                    "requires_box": false,
                    "name": "Example recipient",
                    "phone_number": "09000000000",
                    "address": "Example drop-off address",
                    "location": {
                      "latitude": 35.74,
                      "longitude": 51.42
                    },
                    "payment": {
                      "price": 0,
                      "payment_type": "cash"
                    },
                    "manifest_items": [
                      {
                        "name": "Example package",
                        "quantity": 1
                      }
                    ],
                    "dropped_off_at": null,
                    "tracking_url": "https://tracking.example.invalid/DEMOHASH01"
                  }
                ],
                "courier": null,
                "created_at": "2026-11-29T10:00:00Z",
                "assigned_at": null,
                "picked_up_at": null,
                "delivery_cost": null,
                "arrived_at": null,
                "departed_at": null,
                "state": "canceled_by_client",
                "boost": {
                  "level": 0,
                  "amount": 0
                }
              }
            }
          }
        ],
        "externalDocs": {
          "description": "Source in websocket",
          "url": "https://git.miare.ir/miare/websocket/-/blob/fea3fdd932db57d447eb35d1c22c9033914f1fd6/realtime/interfaces/webhooks/informers/v2/informer_impl.go#L170"
        }
      },
      "canceled_by_miare": {
        "name": "canceled_by_miare",
        "title": "canceled_by_miare",
        "summary": "Miare canceled/deleted the trip.",
        "description": "Miare canceled/deleted the trip.",
        "headers": {
          "$ref": "#/components/schemas/TripWebhookHeaders"
        },
        "payload": {
          "$ref": "#/components/schemas/CanceledByMiarePayload"
        },
        "tags": [
          {
            "name": "Trip"
          }
        ],
        "examples": [
          {
            "name": "canceled_by_miare",
            "headers": {
              "Authorization": "Token EXAMPLE_CLIENT_TOKEN",
              "X-Miare-API-Version": "2"
            },
            "payload": {
              "event": "canceled_by_miare",
              "trip": {
                "id": "11111111-1111-4111-8111-111111111111",
                "batch_id": "11111111-1111-4111-8111-111111111111",
                "area": {
                  "id": "12",
                  "name": "Example area"
                },
                "pickup": {
                  "name": "Example pickup",
                  "phone_number": "02100000000",
                  "address": "Example pickup address",
                  "image": "",
                  "location": {
                    "latitude": 35.73,
                    "longitude": 51.41
                  },
                  "deadline": null
                },
                "courses": [
                  {
                    "id": "22222222-2222-4222-8222-222222222222",
                    "trip_id": "11111111-1111-4111-8111-111111111111",
                    "bill_number": "DEMO-100",
                    "requires_box": false,
                    "name": "Example recipient",
                    "phone_number": "09000000000",
                    "address": "Example drop-off address",
                    "location": {
                      "latitude": 35.74,
                      "longitude": 51.42
                    },
                    "payment": {
                      "price": 0,
                      "payment_type": "cash"
                    },
                    "manifest_items": [
                      {
                        "name": "Example package",
                        "quantity": 1
                      }
                    ],
                    "dropped_off_at": null,
                    "tracking_url": "https://tracking.example.invalid/DEMOHASH01"
                  }
                ],
                "courier": null,
                "created_at": "2026-11-29T10:00:00Z",
                "assigned_at": null,
                "picked_up_at": null,
                "delivery_cost": null,
                "arrived_at": null,
                "departed_at": null,
                "state": "canceled_by_miare",
                "boost": {
                  "level": 0,
                  "amount": 0
                }
              }
            }
          }
        ],
        "externalDocs": {
          "description": "Source in websocket",
          "url": "https://git.miare.ir/miare/websocket/-/blob/fea3fdd932db57d447eb35d1c22c9033914f1fd6/realtime/interfaces/webhooks/informers/v2/informer_impl.go#L170"
        }
      },
      "trip_issue_reported": {
        "name": "trip_issue_reported",
        "title": "trip_issue_reported",
        "summary": "A delegated issue was reported for this trip.",
        "description": "A delegated issue was reported for this trip. Includes the affected issue projection and available actions. The event does not imply a particular trip state.",
        "headers": {
          "$ref": "#/components/schemas/TripWebhookHeaders"
        },
        "payload": {
          "$ref": "#/components/schemas/TripIssueReportedPayload"
        },
        "tags": [
          {
            "name": "Trip"
          }
        ],
        "examples": [
          {
            "name": "trip_issue_reported",
            "headers": {
              "Authorization": "Token EXAMPLE_CLIENT_TOKEN",
              "X-Miare-API-Version": "2"
            },
            "payload": {
              "event": "trip_issue_reported",
              "trip": {
                "id": "11111111-1111-4111-8111-111111111111",
                "batch_id": "11111111-1111-4111-8111-111111111111",
                "area": {
                  "id": "12",
                  "name": "Example area"
                },
                "pickup": {
                  "name": "Example pickup",
                  "phone_number": "02100000000",
                  "address": "Example pickup address",
                  "image": "",
                  "location": {
                    "latitude": 35.73,
                    "longitude": 51.41
                  },
                  "deadline": null
                },
                "courses": [
                  {
                    "id": "22222222-2222-4222-8222-222222222222",
                    "trip_id": "11111111-1111-4111-8111-111111111111",
                    "bill_number": "DEMO-100",
                    "requires_box": false,
                    "name": "Example recipient",
                    "phone_number": "09000000000",
                    "address": "Example drop-off address",
                    "location": {
                      "latitude": 35.74,
                      "longitude": 51.42
                    },
                    "payment": {
                      "price": 0,
                      "payment_type": "cash"
                    },
                    "manifest_items": [
                      {
                        "name": "Example package",
                        "quantity": 1
                      }
                    ],
                    "dropped_off_at": null,
                    "tracking_url": "https://tracking.example.invalid/DEMOHASH01"
                  }
                ],
                "courier": {
                  "name": "Example Courier",
                  "first_name": "Example",
                  "last_name": "Courier",
                  "image": "",
                  "phone_number": "09000000001",
                  "location_updated_at": "2026-11-29T10:00:00Z",
                  "location": {
                    "latitude": 35.735,
                    "longitude": 51.415
                  }
                },
                "created_at": "2026-11-29T10:00:00Z",
                "assigned_at": "2026-11-29T10:00:00Z",
                "picked_up_at": "2026-11-29T10:00:00Z",
                "delivery_cost": null,
                "arrived_at": "2026-11-29T10:00:00Z",
                "departed_at": "2026-11-29T10:00:00Z",
                "state": "dropoff",
                "boost": {
                  "level": 0,
                  "amount": 0
                }
              },
              "issue": {
                "id": "33333333-3333-4333-8333-333333333333",
                "problem_id": "44444444-4444-4444-8444-444444444444",
                "reported_at": "2026-11-29T10:00:00Z",
                "description": "Please confirm whether the courier can proceed.",
                "resolution_actions": [
                  "cancel_trip",
                  "reject_issue"
                ],
                "resolution_deadline": "2026-11-29T10:10:00Z"
              }
            }
          }
        ],
        "externalDocs": {
          "description": "Source in websocket",
          "url": "https://git.miare.ir/miare/websocket/-/blob/fea3fdd932db57d447eb35d1c22c9033914f1fd6/realtime/interfaces/webhooks/informers/v2/informer_impl.go#L170"
        }
      },
      "trip_issue_resolved": {
        "name": "trip_issue_resolved",
        "title": "trip_issue_resolved",
        "summary": "A delegated issue was resolved.",
        "description": "A delegated issue was resolved. Includes the selected action, resolver role, and resolution text; the full trip snapshot is also included.",
        "headers": {
          "$ref": "#/components/schemas/TripWebhookHeaders"
        },
        "payload": {
          "$ref": "#/components/schemas/TripIssueResolvedPayload"
        },
        "tags": [
          {
            "name": "Trip"
          }
        ],
        "examples": [
          {
            "name": "trip_issue_resolved",
            "headers": {
              "Authorization": "Token EXAMPLE_CLIENT_TOKEN",
              "X-Miare-API-Version": "2"
            },
            "payload": {
              "event": "trip_issue_resolved",
              "trip": {
                "id": "11111111-1111-4111-8111-111111111111",
                "batch_id": "11111111-1111-4111-8111-111111111111",
                "area": {
                  "id": "12",
                  "name": "Example area"
                },
                "pickup": {
                  "name": "Example pickup",
                  "phone_number": "02100000000",
                  "address": "Example pickup address",
                  "image": "",
                  "location": {
                    "latitude": 35.73,
                    "longitude": 51.41
                  },
                  "deadline": null
                },
                "courses": [
                  {
                    "id": "22222222-2222-4222-8222-222222222222",
                    "trip_id": "11111111-1111-4111-8111-111111111111",
                    "bill_number": "DEMO-100",
                    "requires_box": false,
                    "name": "Example recipient",
                    "phone_number": "09000000000",
                    "address": "Example drop-off address",
                    "location": {
                      "latitude": 35.74,
                      "longitude": 51.42
                    },
                    "payment": {
                      "price": 0,
                      "payment_type": "cash"
                    },
                    "manifest_items": [
                      {
                        "name": "Example package",
                        "quantity": 1
                      }
                    ],
                    "dropped_off_at": null,
                    "tracking_url": "https://tracking.example.invalid/DEMOHASH01"
                  }
                ],
                "courier": {
                  "name": "Example Courier",
                  "first_name": "Example",
                  "last_name": "Courier",
                  "image": "",
                  "phone_number": "09000000001",
                  "location_updated_at": "2026-11-29T10:00:00Z",
                  "location": {
                    "latitude": 35.735,
                    "longitude": 51.415
                  }
                },
                "created_at": "2026-11-29T10:00:00Z",
                "assigned_at": "2026-11-29T10:00:00Z",
                "picked_up_at": "2026-11-29T10:00:00Z",
                "delivery_cost": null,
                "arrived_at": "2026-11-29T10:00:00Z",
                "departed_at": "2026-11-29T10:00:00Z",
                "state": "dropoff",
                "boost": {
                  "level": 0,
                  "amount": 0
                }
              },
              "issue": {
                "id": "33333333-3333-4333-8333-333333333333",
                "problem_id": "44444444-4444-4444-8444-444444444444",
                "reported_at": "2026-11-29T10:00:00Z",
                "description": "Please confirm whether the courier can proceed.",
                "resolution_actions": [
                  "cancel_trip",
                  "reject_issue"
                ],
                "resolution_deadline": "2026-11-29T10:10:00Z",
                "resolved_at": "2026-11-29T10:00:00Z",
                "resolution_action": "reject_issue",
                "resolve_description": "Confirmed with the recipient.",
                "resolver_type": "client"
              }
            }
          }
        ],
        "externalDocs": {
          "description": "Source in websocket",
          "url": "https://git.miare.ir/miare/websocket/-/blob/fea3fdd932db57d447eb35d1c22c9033914f1fd6/realtime/interfaces/webhooks/informers/v2/informer_impl.go#L170"
        }
      },
      "course_added__course": {
        "name": "course_added__course",
        "title": "course_added__course",
        "summary": "One callback for each newly added course identified by the event.",
        "description": "One callback for each newly added course identified by the event. The companion course_added callback carries the full trip. The double underscore is part of the wire event name.",
        "headers": {
          "$ref": "#/components/schemas/TripWebhookHeaders"
        },
        "payload": {
          "$ref": "#/components/schemas/CourseAddedCoursePayload"
        },
        "tags": [
          {
            "name": "Course"
          }
        ],
        "examples": [
          {
            "name": "course_added__course",
            "headers": {
              "Authorization": "Token EXAMPLE_CLIENT_TOKEN",
              "X-Miare-API-Version": "2"
            },
            "payload": {
              "event": "course_added__course",
              "course": {
                "id": "22222222-2222-4222-8222-222222222222",
                "trip_id": "11111111-1111-4111-8111-111111111111",
                "bill_number": "DEMO-100",
                "requires_box": false,
                "name": "Example recipient",
                "phone_number": "09000000000",
                "address": "Example drop-off address",
                "location": {
                  "latitude": 35.74,
                  "longitude": 51.42
                },
                "payment": {
                  "price": 0,
                  "payment_type": "cash"
                },
                "manifest_items": [
                  {
                    "name": "Example package",
                    "quantity": 1
                  }
                ],
                "dropped_off_at": null,
                "tracking_url": "https://tracking.example.invalid/DEMOHASH01"
              }
            }
          }
        ],
        "externalDocs": {
          "description": "Source in websocket",
          "url": "https://git.miare.ir/miare/websocket/-/blob/fea3fdd932db57d447eb35d1c22c9033914f1fd6/realtime/interfaces/webhooks/informers/v2/informer_impl.go#L227"
        }
      },
      "issue_added": {
        "name": "issue_added",
        "title": "issue_added",
        "summary": "An issue was reported; contains the full issue snapshot.",
        "description": "An issue was reported; contains the full issue snapshot.",
        "headers": {
          "$ref": "#/components/schemas/WebhookHeaders"
        },
        "payload": {
          "$ref": "#/components/schemas/IssueAddedPayload"
        },
        "tags": [
          {
            "name": "Issue"
          }
        ],
        "examples": [
          {
            "name": "issue_added",
            "headers": {
              "Authorization": "Token EXAMPLE_CLIENT_TOKEN",
              "X-Miare-API-Version": "2"
            },
            "payload": {
              "event": "issue_added",
              "issue": {
                "picker_type": null,
                "state": "reported",
                "resolve_description": null,
                "id": "33333333-3333-4333-8333-333333333333",
                "trip_id": "11111111-1111-4111-8111-111111111111",
                "problem_id": "44444444-4444-4444-8444-444444444444",
                "resolved_at": null,
                "reported_at": "2026-11-29T10:00:00Z",
                "reporter_type": "miare",
                "resolver_type": null,
                "picked_at": null,
                "messages": []
              }
            }
          }
        ],
        "externalDocs": {
          "description": "Source in websocket",
          "url": "https://git.miare.ir/miare/websocket/-/blob/fea3fdd932db57d447eb35d1c22c9033914f1fd6/realtime/interfaces/webhooks/informers/v2/informer_impl.go#L250"
        }
      },
      "issue_picked": {
        "name": "issue_picked",
        "title": "issue_picked",
        "summary": "An issue was picked for handling; contains the full issue snapshot.",
        "description": "An issue was picked for handling; contains the full issue snapshot.",
        "headers": {
          "$ref": "#/components/schemas/WebhookHeaders"
        },
        "payload": {
          "$ref": "#/components/schemas/IssuePickedPayload"
        },
        "tags": [
          {
            "name": "Issue"
          }
        ],
        "examples": [
          {
            "name": "issue_picked",
            "headers": {
              "Authorization": "Token EXAMPLE_CLIENT_TOKEN",
              "X-Miare-API-Version": "2"
            },
            "payload": {
              "event": "issue_picked",
              "issue": {
                "picker_type": "miare",
                "state": "picked",
                "resolve_description": null,
                "id": "33333333-3333-4333-8333-333333333333",
                "trip_id": "11111111-1111-4111-8111-111111111111",
                "problem_id": "44444444-4444-4444-8444-444444444444",
                "resolved_at": null,
                "reported_at": "2026-11-29T10:00:00Z",
                "reporter_type": "miare",
                "resolver_type": null,
                "picked_at": "2026-11-29T10:00:00Z",
                "messages": []
              }
            }
          }
        ],
        "externalDocs": {
          "description": "Source in websocket",
          "url": "https://git.miare.ir/miare/websocket/-/blob/fea3fdd932db57d447eb35d1c22c9033914f1fd6/realtime/interfaces/webhooks/informers/v2/informer_impl.go#L250"
        }
      },
      "issue_resolved": {
        "name": "issue_resolved",
        "title": "issue_resolved",
        "summary": "An issue was resolved; contains the full issue snapshot.",
        "description": "An issue was resolved; contains the full issue snapshot. Delegated issues can also produce trip_issue_resolved.",
        "headers": {
          "$ref": "#/components/schemas/WebhookHeaders"
        },
        "payload": {
          "$ref": "#/components/schemas/IssueResolvedPayload"
        },
        "tags": [
          {
            "name": "Issue"
          }
        ],
        "examples": [
          {
            "name": "issue_resolved",
            "headers": {
              "Authorization": "Token EXAMPLE_CLIENT_TOKEN",
              "X-Miare-API-Version": "2"
            },
            "payload": {
              "event": "issue_resolved",
              "issue": {
                "picker_type": "miare",
                "state": "resolved",
                "resolve_description": "Resolved by support.",
                "id": "33333333-3333-4333-8333-333333333333",
                "trip_id": "11111111-1111-4111-8111-111111111111",
                "problem_id": "44444444-4444-4444-8444-444444444444",
                "resolved_at": "2026-11-29T10:00:00Z",
                "reported_at": "2026-11-29T10:00:00Z",
                "reporter_type": "miare",
                "resolver_type": "miare",
                "picked_at": "2026-11-29T10:00:00Z",
                "messages": []
              }
            }
          },
          {
            "name": "resolved-delegated-issue",
            "headers": {
              "Authorization": "Token EXAMPLE_CLIENT_TOKEN",
              "X-Miare-API-Version": "2"
            },
            "payload": {
              "event": "issue_resolved",
              "issue": {
                "picker_type": "miare",
                "state": "resolved",
                "resolve_description": "Resolved by support.",
                "id": "33333333-3333-4333-8333-333333333333",
                "trip_id": "11111111-1111-4111-8111-111111111111",
                "problem_id": "44444444-4444-4444-8444-444444444444",
                "resolved_at": "2026-11-29T10:00:00Z",
                "reported_at": "2026-11-29T10:00:00Z",
                "reporter_type": "miare",
                "resolver_type": "miare",
                "picked_at": "2026-11-29T10:00:00Z",
                "messages": [],
                "description": "Please confirm whether the courier can proceed.",
                "resolution_actions": [
                  "cancel_trip",
                  "reject_issue"
                ],
                "resolution_deadline": "2026-11-29T10:10:00Z",
                "resolution_action": "reject_issue"
              }
            }
          }
        ],
        "externalDocs": {
          "description": "Source in websocket",
          "url": "https://git.miare.ir/miare/websocket/-/blob/fea3fdd932db57d447eb35d1c22c9033914f1fd6/realtime/interfaces/webhooks/informers/v2/informer_impl.go#L250"
        }
      },
      "issue_message_added": {
        "name": "issue_message_added",
        "title": "issue_message_added",
        "summary": "A message was added to an issue.",
        "description": "A message was added to an issue. The issue.messages array contains the serialized conversation snapshot.",
        "headers": {
          "$ref": "#/components/schemas/WebhookHeaders"
        },
        "payload": {
          "$ref": "#/components/schemas/IssueMessageAddedPayload"
        },
        "tags": [
          {
            "name": "Issue"
          }
        ],
        "examples": [
          {
            "name": "issue_message_added",
            "headers": {
              "Authorization": "Token EXAMPLE_CLIENT_TOKEN",
              "X-Miare-API-Version": "2"
            },
            "payload": {
              "event": "issue_message_added",
              "issue": {
                "picker_type": null,
                "state": "reported",
                "resolve_description": null,
                "id": "33333333-3333-4333-8333-333333333333",
                "trip_id": "11111111-1111-4111-8111-111111111111",
                "problem_id": "44444444-4444-4444-8444-444444444444",
                "resolved_at": null,
                "reported_at": "2026-11-29T10:00:00Z",
                "reporter_type": "miare",
                "resolver_type": null,
                "picked_at": null,
                "messages": [
                  {
                    "id": "55555555-5555-4555-8555-555555555555",
                    "type": "text",
                    "message": "Example update from support.",
                    "image_url": "",
                    "created_at": "2026-11-29T10:00:00Z",
                    "sender_type": "miare"
                  }
                ]
              }
            }
          }
        ],
        "externalDocs": {
          "description": "Source in websocket",
          "url": "https://git.miare.ir/miare/websocket/-/blob/fea3fdd932db57d447eb35d1c22c9033914f1fd6/realtime/interfaces/webhooks/informers/v2/informer_impl.go#L250"
        }
      },
      "area_radius_changed": {
        "name": "area_radius_changed",
        "title": "area_radius_changed",
        "summary": "The client’s area radius or heat-level notification.",
        "description": "The client’s area radius or heat-level notification. The area body contains id, name, nested city, radius in meters, and heat_level.",
        "headers": {
          "$ref": "#/components/schemas/WebhookHeaders"
        },
        "payload": {
          "$ref": "#/components/schemas/AreaRadiusChangedPayload"
        },
        "tags": [
          {
            "name": "Area"
          }
        ],
        "examples": [
          {
            "name": "area_radius_changed",
            "headers": {
              "Authorization": "Token EXAMPLE_CLIENT_TOKEN",
              "X-Miare-API-Version": "2"
            },
            "payload": {
              "event": "area_radius_changed",
              "area": {
                "id": 12,
                "name": "Sample area",
                "city": {
                  "id": 1,
                  "name": "Tehran"
                },
                "radius": 3000,
                "heat_level": "NORMAL"
              }
            }
          }
        ],
        "externalDocs": {
          "description": "Source in websocket",
          "url": "https://git.miare.ir/miare/websocket/-/blob/fea3fdd932db57d447eb35d1c22c9033914f1fd6/realtime/interfaces/webhooks/informers/v2/informer_impl.go#L72"
        }
      },
      "financial_calculated": {
        "name": "financial_calculated",
        "title": "financial_calculated",
        "summary": "Initial batch accounting completed.",
        "description": "Available for enabled client accounts with a configured webhook. financial_calculated reports initial accounting; eligible deleted trips have zero amounts. financial_adjusted reports a non-zero financial change after a course is marked invalid. Deduplicate by (batch_id, revision), retain the highest revision and use the complete total rather than reapplying cumulative changes. Revisions can arrive out of order, including before revision 0. Any non-2xx response or network failure is retried with a 10-second request timeout. Default retry delays are 30,120,300,900,1800 seconds and are configurable. Retries use the stored payload. Recover latest data using GET https://www.miare.ir/api/accounting/financial-detail/{batch_id}/ with the client token; the response omits event. Invoice PDF readiness is independent.",
        "headers": {
          "$ref": "#/components/schemas/FinancialWebhookHeaders"
        },
        "payload": {
          "$ref": "#/components/schemas/FinancialCalculatedPayload"
        },
        "tags": [
          {
            "name": "Financial"
          }
        ],
        "examples": [
          {
            "name": "financial_calculated",
            "headers": {
              "Authorization": "Token EXAMPLE_CLIENT_TOKEN"
            },
            "payload": {
              "event": "financial_calculated",
              "batch_id": "b3951922-4f3e-43dc-a051-a9b765b2cbe7",
              "revision": 0,
              "trip_ids": [
                "4f3d252a-ebbc-4147-b6e8-aba9b64200f3"
              ],
              "course_ids": [
                "0f662083-284e-4729-b34d-2479bd7b558a"
              ],
              "bill_numbers": [
                "DEL-119"
              ],
              "state": "calculated",
              "financials": {
                "total_cost": 30000,
                "details": {
                  "base_cost": 28000,
                  "cancel_cost": 0,
                  "delay_cost": 2000,
                  "return_cost": 0
                }
              },
              "changes": []
            }
          }
        ],
        "externalDocs": {
          "description": "Miare financial event contract",
          "url": "https://git.miare.ir/miare/api-docs/-/blob/696d58bf333cee875ad834836d3f5bacd0e492a0/slate/source/index.html.md#financial-events"
        }
      },
      "financial_adjusted": {
        "name": "financial_adjusted",
        "title": "financial_adjusted",
        "summary": "Batch total changed after a course was marked invalid.",
        "description": "Available for enabled client accounts with a configured webhook. financial_calculated reports initial accounting; eligible deleted trips have zero amounts. financial_adjusted reports a non-zero financial change after a course is marked invalid. Deduplicate by (batch_id, revision), retain the highest revision and use the complete total rather than reapplying cumulative changes. Revisions can arrive out of order, including before revision 0. Any non-2xx response or network failure is retried with a 10-second request timeout. Default retry delays are 30,120,300,900,1800 seconds and are configurable. Retries use the stored payload. Recover latest data using GET https://www.miare.ir/api/accounting/financial-detail/{batch_id}/ with the client token; the response omits event. Invoice PDF readiness is independent.",
        "headers": {
          "$ref": "#/components/schemas/FinancialWebhookHeaders"
        },
        "payload": {
          "$ref": "#/components/schemas/FinancialAdjustedPayload"
        },
        "tags": [
          {
            "name": "Financial"
          }
        ],
        "examples": [
          {
            "name": "financial_adjusted",
            "headers": {
              "Authorization": "Token EXAMPLE_CLIENT_TOKEN"
            },
            "payload": {
              "event": "financial_adjusted",
              "batch_id": "b3951922-4f3e-43dc-a051-a9b765b2cbe7",
              "revision": 1,
              "trip_ids": [
                "4f3d252a-ebbc-4147-b6e8-aba9b64200f3"
              ],
              "course_ids": [
                "0f662083-284e-4729-b34d-2479bd7b558a"
              ],
              "bill_numbers": [
                "DEL-119"
              ],
              "state": "changed",
              "financials": {
                "total_cost": 21000,
                "details": {
                  "base_cost": 19000,
                  "cancel_cost": 0,
                  "delay_cost": 2000,
                  "return_cost": 0
                }
              },
              "changes": [
                {
                  "type": "course_faked",
                  "course_id": "0f662083-284e-4729-b34d-2479bd7b558a",
                  "trip_id": "4f3d252a-ebbc-4147-b6e8-aba9b64200f3",
                  "bill_number": "DEL-119",
                  "previous_total_cost": 30000,
                  "change_amount": -9000,
                  "current_total_cost": 21000,
                  "occurred_at": "2026-11-11T10:30:00+03:30"
                }
              ]
            }
          }
        ],
        "externalDocs": {
          "description": "Miare financial event contract",
          "url": "https://git.miare.ir/miare/api-docs/-/blob/696d58bf333cee875ad834836d3f5bacd0e492a0/slate/source/index.html.md#financial-events"
        }
      }
    },
    "schemas": {
      "WebhookHeaders": {
        "type": "object",
        "required": [
          "Authorization",
          "X-Miare-API-Version"
        ],
        "properties": {
          "Authorization": {
            "type": "string",
            "pattern": "^Token .+",
            "description": "Client application token, sent as Token <token>."
          },
          "X-Miare-API-Version": {
            "type": "string",
            "const": "2"
          }
        }
      },
      "TripWebhookHeaders": {
        "type": "object",
        "required": [
          "X-Miare-API-Version"
        ],
        "properties": {
          "Authorization": {
            "type": "string",
            "pattern": "^Token .+",
            "description": "Normally Token <client application token>. May be omitted for clients configured for tokenless trip callbacks. Issue and area callbacks still include this header."
          },
          "X-Miare-API-Version": {
            "type": "string",
            "const": "2"
          }
        }
      },
      "WebhookTime": {
        "type": [
          "string",
          "null"
        ],
        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(Z|[+-]\\d{4})$",
        "description": "Serialized time, for example 2026-11-29T10:00:00Z or 2026-11-29T13:30:00+0330. Unset times are null."
      },
      "WebhookLocation": {
        "type": [
          "object",
          "null"
        ],
        "required": [
          "latitude",
          "longitude"
        ],
        "properties": {
          "latitude": {
            "type": "number"
          },
          "longitude": {
            "type": "number"
          }
        }
      },
      "WebhookArea": {
        "type": "object",
        "required": [
          "id",
          "name",
          "city",
          "radius",
          "heat_level"
        ],
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "city": {
            "type": "object",
            "required": [
              "id",
              "name"
            ],
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "radius": {
            "type": "integer",
            "description": "Current delivery radius, in meters."
          },
          "heat_level": {
            "type": "string",
            "description": "Current area heat-level value."
          }
        },
        "externalDocs": {
          "description": "Source in websocket",
          "url": "https://git.miare.ir/miare/websocket/-/blob/fea3fdd932db57d447eb35d1c22c9033914f1fd6/area/domain/ovl/models.go#L24"
        }
      },
      "TripArea": {
        "type": [
          "object",
          "null"
        ],
        "required": [
          "id",
          "name"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Area ID serialized as a decimal string."
          },
          "name": {
            "type": "string"
          }
        }
      },
      "Pickup": {
        "type": "object",
        "required": [
          "name",
          "phone_number",
          "address",
          "image",
          "location",
          "deadline"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "phone_number": {
            "type": "string"
          },
          "address": {
            "type": "string"
          },
          "image": {
            "type": "string"
          },
          "location": {
            "$ref": "#/components/schemas/WebhookLocation"
          },
          "deadline": {
            "$ref": "#/components/schemas/WebhookTime"
          }
        }
      },
      "Courier": {
        "type": [
          "object",
          "null"
        ],
        "required": [
          "name",
          "first_name",
          "last_name",
          "image",
          "phone_number",
          "location_updated_at",
          "location"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "first_name": {
            "type": "string"
          },
          "last_name": {
            "type": "string"
          },
          "image": {
            "type": "string"
          },
          "phone_number": {
            "type": "string"
          },
          "location_updated_at": {
            "$ref": "#/components/schemas/WebhookTime"
          },
          "location": {
            "$ref": "#/components/schemas/WebhookLocation"
          }
        },
        "description": "Null before a visible assignment. For completed/canceled trips the serializer substitutes a dummy location; do not use it as a live courier position."
      },
      "CoursePayment": {
        "type": "object",
        "required": [
          "price",
          "payment_type"
        ],
        "properties": {
          "price": {
            "type": "integer"
          },
          "payment_type": {
            "type": "string",
            "enum": [
              "cash",
              "pos",
              "unknown"
            ]
          }
        }
      },
      "ManifestItem": {
        "type": "object",
        "required": [],
        "properties": {
          "name": {
            "type": "string"
          },
          "quantity": {
            "type": "integer"
          }
        },
        "additionalProperties": true,
        "description": "Manifest objects are passed through from the original request; additional fields are retained."
      },
      "Course": {
        "type": [
          "object",
          "null"
        ],
        "required": [
          "id",
          "trip_id",
          "bill_number",
          "requires_box",
          "name",
          "phone_number",
          "address",
          "location",
          "payment",
          "manifest_items",
          "dropped_off_at",
          "tracking_url"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "trip_id": {
            "type": "string",
            "format": "uuid"
          },
          "bill_number": {
            "type": "string"
          },
          "requires_box": {
            "type": "boolean"
          },
          "name": {
            "type": "string"
          },
          "phone_number": {
            "type": "string"
          },
          "address": {
            "type": "string"
          },
          "location": {
            "$ref": "#/components/schemas/WebhookLocation"
          },
          "payment": {
            "$ref": "#/components/schemas/CoursePayment"
          },
          "manifest_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ManifestItem"
            }
          },
          "dropped_off_at": {
            "$ref": "#/components/schemas/WebhookTime"
          },
          "tracking_url": {
            "type": "string"
          },
          "is_round_course": {
            "type": "boolean",
            "description": "Included when return-course support is enabled for the client."
          }
        },
        "externalDocs": {
          "description": "Source in websocket",
          "url": "https://git.miare.ir/miare/websocket/-/blob/fea3fdd932db57d447eb35d1c22c9033914f1fd6/commons/interfaces/serializers/thirdparty/v2/serializer_impl.go#L166"
        }
      },
      "Boost": {
        "type": "object",
        "required": [
          "level",
          "amount"
        ],
        "properties": {
          "level": {
            "type": "integer"
          },
          "amount": {
            "type": "integer"
          }
        },
        "description": "Both values are zero when no applicable client boost is present."
      },
      "IssueMessage": {
        "type": "object",
        "required": [
          "id",
          "type",
          "message",
          "image_url",
          "created_at",
          "sender_type"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "text",
              "info"
            ]
          },
          "message": {
            "type": "string"
          },
          "image_url": {
            "type": "string"
          },
          "created_at": {
            "$ref": "#/components/schemas/WebhookTime"
          },
          "sender_type": {
            "type": "string",
            "enum": [
              "client",
              "miare"
            ]
          }
        }
      },
      "Trip": {
        "type": [
          "object",
          "null"
        ],
        "required": [
          "id",
          "batch_id",
          "area",
          "pickup",
          "courses",
          "courier",
          "created_at",
          "assigned_at",
          "picked_up_at",
          "delivery_cost",
          "arrived_at",
          "departed_at",
          "state",
          "boost"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Public trip hash, not the internal numeric trip ID."
          },
          "batch_id": {
            "type": "string",
            "format": "uuid",
            "description": "Current batch trip hash; can differ from id after batching."
          },
          "area": {
            "$ref": "#/components/schemas/TripArea"
          },
          "pickup": {
            "$ref": "#/components/schemas/Pickup"
          },
          "courses": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Course"
            }
          },
          "courier": {
            "$ref": "#/components/schemas/Courier"
          },
          "created_at": {
            "$ref": "#/components/schemas/WebhookTime"
          },
          "assigned_at": {
            "$ref": "#/components/schemas/WebhookTime"
          },
          "picked_up_at": {
            "$ref": "#/components/schemas/WebhookTime"
          },
          "delivery_cost": {
            "type": [
              "integer",
              "null"
            ]
          },
          "arrived_at": {
            "$ref": "#/components/schemas/WebhookTime"
          },
          "departed_at": {
            "$ref": "#/components/schemas/WebhookTime"
          },
          "state": {
            "type": "string",
            "enum": [
              "assign_queue",
              "pickup",
              "receiving",
              "departing",
              "dropoff",
              "returning",
              "delivered",
              "canceled_by_client",
              "canceled_by_miare",
              "canceled_by_delay",
              "batched"
            ],
            "description": "Current snapshot state. Availability of advanced states depends on client configuration. The event name does not fix this value."
          },
          "boost": {
            "$ref": "#/components/schemas/Boost"
          },
          "canceled_at": {
            "$ref": "#/components/schemas/WebhookTime"
          },
          "delivered_at": {
            "$ref": "#/components/schemas/WebhookTime"
          },
          "rounded_at": {
            "$ref": "#/components/schemas/WebhookTime"
          },
          "is_round_trip": {
            "type": "boolean"
          }
        },
        "description": "Full third-party trip snapshot. Optional completion/return fields depend on client configuration. Original course/trip hashes are preserved when orders are batched.",
        "externalDocs": {
          "description": "Source in websocket",
          "url": "https://git.miare.ir/miare/websocket/-/blob/fea3fdd932db57d447eb35d1c22c9033914f1fd6/commons/interfaces/serializers/thirdparty/v2/serializer_impl.go#L331"
        }
      },
      "Issue": {
        "type": [
          "object",
          "null"
        ],
        "required": [
          "picker_type",
          "state",
          "resolve_description",
          "id",
          "trip_id",
          "problem_id",
          "resolved_at",
          "reported_at",
          "reporter_type",
          "resolver_type",
          "picked_at",
          "messages"
        ],
        "properties": {
          "picker_type": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "miare",
              "client",
              null
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "reported",
              "picked",
              "resolved"
            ]
          },
          "resolve_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "trip_id": {
            "type": "string",
            "format": "uuid"
          },
          "problem_id": {
            "type": "string",
            "format": "uuid"
          },
          "resolved_at": {
            "$ref": "#/components/schemas/WebhookTime"
          },
          "reported_at": {
            "$ref": "#/components/schemas/WebhookTime"
          },
          "reporter_type": {
            "type": "string",
            "enum": [
              "client",
              "miare"
            ]
          },
          "resolver_type": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "client",
              "miare",
              null
            ]
          },
          "picked_at": {
            "$ref": "#/components/schemas/WebhookTime"
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IssueMessage"
            }
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "resolution_actions": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "Action keys offered for this delegated issue."
          },
          "resolution_deadline": {
            "$ref": "#/components/schemas/WebhookTime"
          },
          "resolution_action": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "description": "Full issue snapshot used by issue_* callbacks. Delegation fields are included only for delegated issues. Public reporter/resolver/sender roles are client or miare.",
        "externalDocs": {
          "description": "Source in websocket",
          "url": "https://git.miare.ir/miare/websocket/-/blob/fea3fdd932db57d447eb35d1c22c9033914f1fd6/commons/interfaces/serializers/thirdparty/v2/serializer_impl.go#L199"
        }
      },
      "ReportedTripIssue": {
        "type": "object",
        "required": [
          "id",
          "problem_id",
          "description",
          "reported_at",
          "resolution_actions",
          "resolution_deadline"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "problem_id": {
            "type": "string",
            "format": "uuid"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "reported_at": {
            "$ref": "#/components/schemas/WebhookTime"
          },
          "resolution_actions": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "Action keys offered for this delegated issue."
          },
          "resolution_deadline": {
            "$ref": "#/components/schemas/WebhookTime"
          }
        },
        "additionalProperties": false,
        "description": "Projection attached to trip_issue_reported. This is not the full issue_* callback snapshot."
      },
      "ResolvedTripIssue": {
        "type": "object",
        "required": [
          "id",
          "problem_id",
          "description",
          "reported_at",
          "resolution_actions",
          "resolution_deadline",
          "resolved_at",
          "resolution_action",
          "resolve_description",
          "resolver_type"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "problem_id": {
            "type": "string",
            "format": "uuid"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "reported_at": {
            "$ref": "#/components/schemas/WebhookTime"
          },
          "resolution_actions": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "Action keys offered for this delegated issue."
          },
          "resolution_deadline": {
            "$ref": "#/components/schemas/WebhookTime"
          },
          "resolved_at": {
            "$ref": "#/components/schemas/WebhookTime"
          },
          "resolution_action": {
            "type": [
              "string",
              "null"
            ]
          },
          "resolve_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "resolver_type": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "client",
              "miare",
              null
            ]
          }
        },
        "additionalProperties": false
      },
      "AddedPayload": {
        "type": "object",
        "required": [
          "event",
          "trip"
        ],
        "properties": {
          "event": {
            "type": "string",
            "const": "added"
          },
          "trip": {
            "$ref": "#/components/schemas/Trip"
          }
        }
      },
      "AssignedPayload": {
        "type": "object",
        "required": [
          "event",
          "trip"
        ],
        "properties": {
          "event": {
            "type": "string",
            "const": "assigned"
          },
          "trip": {
            "$ref": "#/components/schemas/Trip"
          }
        }
      },
      "ArrivedPayload": {
        "type": "object",
        "required": [
          "event",
          "trip"
        ],
        "properties": {
          "event": {
            "type": "string",
            "const": "arrived"
          },
          "trip": {
            "$ref": "#/components/schemas/Trip"
          }
        }
      },
      "PickedUpPayload": {
        "type": "object",
        "required": [
          "event",
          "trip"
        ],
        "properties": {
          "event": {
            "type": "string",
            "const": "picked_up"
          },
          "trip": {
            "$ref": "#/components/schemas/Trip"
          }
        }
      },
      "DepartedPayload": {
        "type": "object",
        "required": [
          "event",
          "trip"
        ],
        "properties": {
          "event": {
            "type": "string",
            "const": "departed"
          },
          "trip": {
            "$ref": "#/components/schemas/Trip"
          }
        }
      },
      "CourseDroppedOffPayload": {
        "type": "object",
        "required": [
          "event",
          "trip"
        ],
        "properties": {
          "event": {
            "type": "string",
            "const": "course_dropped_off"
          },
          "trip": {
            "$ref": "#/components/schemas/Trip"
          }
        }
      },
      "CourseAddedPayload": {
        "type": "object",
        "required": [
          "event",
          "trip"
        ],
        "properties": {
          "event": {
            "type": "string",
            "const": "course_added"
          },
          "trip": {
            "$ref": "#/components/schemas/Trip"
          }
        }
      },
      "CourseDeletedPayload": {
        "type": "object",
        "required": [
          "event",
          "trip"
        ],
        "properties": {
          "event": {
            "type": "string",
            "const": "course_deleted"
          },
          "trip": {
            "$ref": "#/components/schemas/Trip"
          }
        }
      },
      "DeliveredPayload": {
        "type": "object",
        "required": [
          "event",
          "trip"
        ],
        "properties": {
          "event": {
            "type": "string",
            "const": "delivered"
          },
          "trip": {
            "$ref": "#/components/schemas/Trip"
          }
        }
      },
      "CanceledByClientPayload": {
        "type": "object",
        "required": [
          "event",
          "trip"
        ],
        "properties": {
          "event": {
            "type": "string",
            "const": "canceled_by_client"
          },
          "trip": {
            "$ref": "#/components/schemas/Trip"
          }
        }
      },
      "CanceledByMiarePayload": {
        "type": "object",
        "required": [
          "event",
          "trip"
        ],
        "properties": {
          "event": {
            "type": "string",
            "const": "canceled_by_miare"
          },
          "trip": {
            "$ref": "#/components/schemas/Trip"
          }
        }
      },
      "TripIssueReportedPayload": {
        "type": "object",
        "required": [
          "event",
          "trip",
          "issue"
        ],
        "properties": {
          "event": {
            "type": "string",
            "const": "trip_issue_reported"
          },
          "trip": {
            "$ref": "#/components/schemas/Trip"
          },
          "issue": {
            "$ref": "#/components/schemas/ReportedTripIssue"
          }
        }
      },
      "TripIssueResolvedPayload": {
        "type": "object",
        "required": [
          "event",
          "trip",
          "issue"
        ],
        "properties": {
          "event": {
            "type": "string",
            "const": "trip_issue_resolved"
          },
          "trip": {
            "$ref": "#/components/schemas/Trip"
          },
          "issue": {
            "$ref": "#/components/schemas/ResolvedTripIssue"
          }
        }
      },
      "CourseAddedCoursePayload": {
        "type": "object",
        "required": [
          "event",
          "course"
        ],
        "properties": {
          "event": {
            "type": "string",
            "const": "course_added__course"
          },
          "course": {
            "$ref": "#/components/schemas/Course"
          }
        }
      },
      "IssueAddedPayload": {
        "type": "object",
        "required": [
          "event",
          "issue"
        ],
        "properties": {
          "event": {
            "type": "string",
            "const": "issue_added"
          },
          "issue": {
            "$ref": "#/components/schemas/Issue"
          }
        }
      },
      "IssuePickedPayload": {
        "type": "object",
        "required": [
          "event",
          "issue"
        ],
        "properties": {
          "event": {
            "type": "string",
            "const": "issue_picked"
          },
          "issue": {
            "$ref": "#/components/schemas/Issue"
          }
        }
      },
      "IssueResolvedPayload": {
        "type": "object",
        "required": [
          "event",
          "issue"
        ],
        "properties": {
          "event": {
            "type": "string",
            "const": "issue_resolved"
          },
          "issue": {
            "$ref": "#/components/schemas/Issue"
          }
        }
      },
      "IssueMessageAddedPayload": {
        "type": "object",
        "required": [
          "event",
          "issue"
        ],
        "properties": {
          "event": {
            "type": "string",
            "const": "issue_message_added"
          },
          "issue": {
            "$ref": "#/components/schemas/Issue"
          }
        }
      },
      "AreaRadiusChangedPayload": {
        "type": "object",
        "required": [
          "event",
          "area"
        ],
        "properties": {
          "event": {
            "type": "string",
            "const": "area_radius_changed"
          },
          "area": {
            "$ref": "#/components/schemas/WebhookArea"
          }
        }
      },
      "FinancialAmounts": {
        "type": "object",
        "required": [
          "total_cost",
          "details"
        ],
        "properties": {
          "total_cost": {
            "type": "integer",
            "description": "Complete batch total at this revision, in Tomans. Authoritative for reconciliation."
          },
          "details": {
            "type": "object",
            "required": [
              "base_cost",
              "cancel_cost",
              "delay_cost",
              "return_cost"
            ],
            "properties": {
              "base_cost": {
                "type": "integer",
                "description": "Base-cost component. In Tomans."
              },
              "cancel_cost": {
                "type": "integer",
                "description": "Late-cancellation component. In Tomans."
              },
              "delay_cost": {
                "type": "integer",
                "description": "Delay component. In Tomans."
              },
              "return_cost": {
                "type": "integer",
                "description": "Return component. In Tomans."
              }
            },
            "description": "Selected pricing components. These may not sum to total_cost because other pricing rules, discounts and rounding can contribute to the total."
          }
        }
      },
      "FinancialChange": {
        "type": "object",
        "required": [
          "type",
          "course_id",
          "trip_id",
          "bill_number",
          "previous_total_cost",
          "change_amount",
          "current_total_cost",
          "occurred_at"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "course_faked"
            ],
            "description": "A course was marked invalid."
          },
          "course_id": {
            "type": "string",
            "format": "uuid",
            "description": "Affected course identifier."
          },
          "trip_id": {
            "type": "string",
            "format": "uuid",
            "description": "Client-visible trip ID, preserving the original trip ID after batching."
          },
          "bill_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "Bill number; may be empty, or null if package information is absent."
          },
          "previous_total_cost": {
            "type": "integer",
            "description": "Batch total before this adjustment, in Tomans."
          },
          "change_amount": {
            "type": "integer",
            "description": "Signed difference current_total_cost - previous_total_cost, in Tomans."
          },
          "current_total_cost": {
            "type": "integer",
            "description": "Batch total immediately after this adjustment, in Tomans."
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time the course was marked invalid."
          }
        }
      },
      "FinancialEvent": {
        "type": "object",
        "required": [
          "event",
          "batch_id",
          "revision",
          "trip_ids",
          "course_ids",
          "bill_numbers",
          "state",
          "financials",
          "changes"
        ],
        "properties": {
          "event": {
            "type": "string",
            "enum": [
              "financial_calculated",
              "financial_adjusted"
            ]
          },
          "batch_id": {
            "type": "string",
            "format": "uuid",
            "description": "Stable accounting batch identifier across revisions; may differ from original trip IDs."
          },
          "revision": {
            "type": "integer",
            "description": "Per-batch revision: 0 initially; increasing positive values for adjustments.",
            "minimum": 0
          },
          "trip_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid",
              "description": "Client-visible trip ID."
            },
            "description": "Unique original client-visible trip IDs, retained after batching.",
            "uniqueItems": true
          },
          "course_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid",
              "description": "Course identifier."
            },
            "description": "Courses associated with this calculation; adjustments include invalidated courses for traceability."
          },
          "bill_numbers": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "description": "Unique non-empty bill numbers, not positionally aligned with trip_ids or course_ids.",
            "uniqueItems": true
          },
          "state": {
            "type": "string",
            "enum": [
              "calculated",
              "changed"
            ],
            "description": "Financial state, separate from trip lifecycle state."
          },
          "financials": {
            "$ref": "#/components/schemas/FinancialAmounts"
          },
          "changes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FinancialChange"
            },
            "description": "Cumulative adjustment history; empty for the initial calculation."
          }
        },
        "description": "Available for enabled client accounts with a configured webhook. financial_calculated reports initial accounting; eligible deleted trips have zero amounts. financial_adjusted reports a non-zero financial change after a course is marked invalid. Deduplicate by (batch_id, revision), retain the highest revision and use the complete total rather than reapplying cumulative changes. Revisions can arrive out of order, including before revision 0. Any non-2xx response or network failure is retried with a 10-second request timeout. Default retry delays are 30,120,300,900,1800 seconds and are configurable. Retries use the stored payload. Recover latest data using GET https://www.miare.ir/api/accounting/financial-detail/{batch_id}/ with the client token; the response omits event. Invoice PDF readiness is independent.",
        "oneOf": [
          {
            "properties": {
              "event": {
                "enum": [
                  "financial_calculated"
                ]
              },
              "state": {
                "enum": [
                  "calculated"
                ]
              },
              "revision": {
                "type": "integer",
                "enum": [
                  0
                ]
              },
              "changes": {
                "type": "array",
                "maxItems": 0
              }
            }
          },
          {
            "properties": {
              "event": {
                "enum": [
                  "financial_adjusted"
                ]
              },
              "state": {
                "enum": [
                  "changed"
                ]
              },
              "revision": {
                "type": "integer",
                "minimum": 1
              },
              "changes": {
                "type": "array",
                "minItems": 1
              }
            }
          }
        ],
        "example": {
          "event": "financial_adjusted",
          "batch_id": "b3951922-4f3e-43dc-a051-a9b765b2cbe7",
          "revision": 1,
          "trip_ids": [
            "4f3d252a-ebbc-4147-b6e8-aba9b64200f3"
          ],
          "course_ids": [
            "0f662083-284e-4729-b34d-2479bd7b558a"
          ],
          "bill_numbers": [
            "DEL-119"
          ],
          "state": "changed",
          "financials": {
            "total_cost": 21000,
            "details": {
              "base_cost": 19000,
              "cancel_cost": 0,
              "delay_cost": 2000,
              "return_cost": 0
            }
          },
          "changes": [
            {
              "type": "course_faked",
              "course_id": "0f662083-284e-4729-b34d-2479bd7b558a",
              "trip_id": "4f3d252a-ebbc-4147-b6e8-aba9b64200f3",
              "bill_number": "DEL-119",
              "previous_total_cost": 30000,
              "change_amount": -9000,
              "current_total_cost": 21000,
              "occurred_at": "2026-11-11T10:30:00+03:30"
            }
          ]
        }
      },
      "FinancialWebhookHeaders": {
        "type": "object",
        "properties": {
          "Authorization": {
            "type": "string",
            "description": "Your client application token, prefixed with Token.",
            "pattern": "^Token .+"
          }
        },
        "required": [
          "Authorization"
        ],
        "description": "Financial callbacks omit X-Miare-API-Version. revision is a batch accounting revision, not an API version."
      },
      "FinancialCalculatedPayload": {
        "allOf": [
          {
            "$ref": "#/components/schemas/FinancialEvent"
          },
          {
            "type": "object",
            "properties": {
              "event": {
                "const": "financial_calculated"
              }
            }
          }
        ]
      },
      "FinancialAdjustedPayload": {
        "allOf": [
          {
            "$ref": "#/components/schemas/FinancialEvent"
          },
          {
            "type": "object",
            "properties": {
              "event": {
                "const": "financial_adjusted"
              }
            }
          }
        ]
      }
    }
  },
  "x-source-repository": "https://git.miare.ir/miare/websocket",
  "x-source-commit": "fea3fdd932db57d447eb35d1c22c9033914f1fd6",
  "x-accounting-documentation-source": {
    "url": "https://git.miare.ir/miare/api-docs/-/blob/696d58bf333cee875ad834836d3f5bacd0e492a0/slate/source/index.html.md",
    "sha256": "97ccf84ab08faa9f57df9bbf959c9a940274c5843b5243b503f22f597329aa62"
  }
}
