{
  "openapi": "3.1.0",
  "info": {
    "title": "Polisync API",
    "version": "1.0.0",
    "summary": "Connect other software to your Polisync data.",
    "description": "The Polisync public API lets an agency read and write its customers, policies, renewals and claims from its own systems, and receive signed webhooks when things change. It is available on the Enterprise plan. Authenticate with an API key created under Settings, Developers, and send it as `Authorization: Bearer <key>`. See https://polisync.in/developers for guides.",
    "contact": {
      "name": "Polisync",
      "email": "hello@polisync.in",
      "url": "https://polisync.in/developers"
    }
  },
  "servers": [
    {
      "url": "https://app.polisync.in/api/public/v1",
      "description": "Production"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Connection",
      "description": "Check that your key works."
    },
    {
      "name": "Customers",
      "description": "People and companies you insure."
    },
    {
      "name": "Policies",
      "description": "Insurance policies, with nominees."
    },
    {
      "name": "Renewals",
      "description": "The renewal tracker."
    },
    {
      "name": "Claims",
      "description": "Claims, their timeline and IRDAI deadlines."
    },
    {
      "name": "Agencies",
      "description": "Your agency codes and licences."
    },
    {
      "name": "Insurers",
      "description": "The shared insurer directory."
    },
    {
      "name": "Webhooks",
      "description": "Events Polisync sends to your endpoint."
    }
  ],
  "paths": {
    "/me": {
      "get": {
        "operationId": "getMe",
        "tags": [
          "Connection"
        ],
        "summary": "Check your connection",
        "description": "Confirms the key works and shows the workspace it belongs to and what it is allowed to do. A good first call.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Me"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, or the plan does not include API access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/customers": {
      "get": {
        "operationId": "listCustomers",
        "tags": [
          "Customers"
        ],
        "summary": "List customers",
        "description": "PAN is returned masked unless the key has the customer:pan scope.",
        "x-required-scope": "customer:read",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "default": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 100000
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 20,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "order",
            "in": "query",
            "required": false,
            "schema": {
              "default": "desc",
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            }
          },
          {
            "name": "updatedSince",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "Field to sort by.",
            "schema": {
              "default": "createdAt",
              "type": "string",
              "enum": [
                "createdAt",
                "updatedAt",
                "name"
              ]
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Matches part of the name, email or phone number.",
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "email",
            "in": "query",
            "required": false,
            "description": "Exact email address (case-insensitive). Useful to avoid creating duplicates.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "phone",
            "in": "query",
            "required": false,
            "description": "Exact phone number in +91 format.",
            "schema": {
              "type": "string",
              "maxLength": 20
            }
          },
          {
            "name": "agencyId",
            "in": "query",
            "required": false,
            "description": "Only customers of the agency with this id.",
            "schema": {
              "type": "string",
              "maxLength": 40
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Only customers with this status.",
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "inactive"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "pagination"
                  ],
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Customer"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, or the plan does not include API access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createCustomer",
        "tags": [
          "Customers"
        ],
        "summary": "Create a customer",
        "description": "Adds a customer. You must send consentGiven: true to confirm the customer agreed to their data being stored, as India's DPDP Act requires. Polisync records that the consent came through the API, with the key and the caller's IP address.\n\nPhone numbers must be Indian mobile numbers in +91 format. Disposable email addresses are rejected.\n\nSearch by email or phone first if you want to avoid duplicates.",
        "x-required-scope": "customer:create",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Makes a retry safe: the first successful response is stored for 24 hours and returned for the same key and body.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 200
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "individual",
                      "company"
                    ],
                    "description": "individual for a person, company for a business"
                  },
                  "phone": {
                    "type": "string",
                    "pattern": "^\\+91[6-9]\\d{9}$",
                    "description": "Indian mobile number in +91 format, for example +919876543210"
                  },
                  "altPhone": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\+91[6-9]\\d{9}$",
                        "description": "A second mobile number in +91 format"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "email": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200,
                        "format": "email",
                        "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
                        "description": "Disposable email addresses are rejected"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "dateOfBirth": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                        "description": "YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "gender": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "male",
                          "female",
                          "other"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "address": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "country": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 5
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "city": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 100
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "state": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 100
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "pin": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 10
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "pan": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[A-Z]{5}\\d{4}[A-Z]$",
                        "description": "PAN in capitals, for example ABCDE1234F"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "agencyId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 40,
                        "description": "Id of one of your agencies"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "consentGiven": {
                    "type": "boolean",
                    "const": true,
                    "description": "Must be true. You confirm the customer agreed to their data being stored (India's DPDP Act)."
                  }
                },
                "required": [
                  "name",
                  "type",
                  "phone",
                  "consentGiven"
                ],
                "additionalProperties": false
              },
              "example": {
                "name": "Ramesh Patel",
                "type": "individual",
                "phone": "+919876543210",
                "email": "ramesh.patel@gmail.com",
                "dateOfBirth": "1985-03-14",
                "city": "Surat",
                "state": "Gujarat",
                "agencyId": "cmv1a2b3c0002xyzagency",
                "consentGiven": true
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Customer"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, or the plan does not include API access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Clashes with existing data, or the Idempotency-Key was reused.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "A field is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/customers/{id}": {
      "get": {
        "operationId": "getCustomer",
        "tags": [
          "Customers"
        ],
        "summary": "Get a customer",
        "x-required-scope": "customer:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The customer id.",
            "schema": {
              "type": "string"
            },
            "example": "cmv1a2b3c0001xyzcustomer"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Customer"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, or the plan does not include API access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The record does not exist in your workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateCustomer",
        "tags": [
          "Customers"
        ],
        "summary": "Update a customer",
        "description": "Send only the fields you want to change. Send null to clear an optional field.",
        "x-required-scope": "customer:update",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The customer id.",
            "schema": {
              "type": "string"
            },
            "example": "cmv1a2b3c0001xyzcustomer"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 200
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "individual",
                      "company"
                    ],
                    "description": "individual for a person, company for a business"
                  },
                  "phone": {
                    "type": "string",
                    "pattern": "^\\+91[6-9]\\d{9}$",
                    "description": "Indian mobile number in +91 format, for example +919876543210"
                  },
                  "altPhone": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\+91[6-9]\\d{9}$",
                        "description": "A second mobile number in +91 format"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "email": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200,
                        "format": "email",
                        "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
                        "description": "Disposable email addresses are rejected"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "dateOfBirth": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                        "description": "YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "gender": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "male",
                          "female",
                          "other"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "address": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "country": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 5
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "city": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 100
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "state": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 100
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "pin": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 10
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "pan": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[A-Z]{5}\\d{4}[A-Z]$",
                        "description": "PAN in capitals, for example ABCDE1234F"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "agencyId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 40,
                        "description": "Id of one of your agencies"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "additionalProperties": false
              },
              "example": {
                "city": "Ahmedabad",
                "email": null
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Customer"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, or the plan does not include API access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The record does not exist in your workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "A field is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/policies": {
      "get": {
        "operationId": "listPolicies",
        "tags": [
          "Policies"
        ],
        "summary": "List policies",
        "description": "Nominees are left out of lists to keep them small. Fetch one policy to see them.",
        "x-required-scope": "policy:read",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "default": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 100000
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 20,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "order",
            "in": "query",
            "required": false,
            "schema": {
              "default": "desc",
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            }
          },
          {
            "name": "updatedSince",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "Field to sort by.",
            "schema": {
              "default": "createdAt",
              "type": "string",
              "enum": [
                "createdAt",
                "updatedAt",
                "expiryDate"
              ]
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Matches part of the policy number or plan name.",
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "customerId",
            "in": "query",
            "required": false,
            "description": "Only policies of the customer with this id.",
            "schema": {
              "type": "string",
              "maxLength": 40
            }
          },
          {
            "name": "agencyId",
            "in": "query",
            "required": false,
            "description": "Only policies of the agency with this id.",
            "schema": {
              "type": "string",
              "maxLength": 40
            }
          },
          {
            "name": "insurerId",
            "in": "query",
            "required": false,
            "description": "Only policies with the insurer with this id.",
            "schema": {
              "type": "string",
              "maxLength": 40
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Only policies with this status.",
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "expired",
                "cancelled"
              ]
            }
          },
          {
            "name": "insuranceType",
            "in": "query",
            "required": false,
            "description": "Only this type of insurance.",
            "schema": {
              "type": "string",
              "enum": [
                "life",
                "health",
                "motor",
                "pa",
                "wc",
                "travel",
                "other"
              ]
            }
          },
          {
            "name": "expiryFrom",
            "in": "query",
            "required": false,
            "description": "Expiry date on or after this day (YYYY-MM-DD).",
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "expiryTo",
            "in": "query",
            "required": false,
            "description": "Expiry date on or before this day (YYYY-MM-DD).",
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "pagination"
                  ],
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Policy"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, or the plan does not include API access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createPolicy",
        "tags": [
          "Policies"
        ],
        "summary": "Create a policy",
        "description": "Adds a policy and opens its renewal automatically. The customer and agency must already exist in your workspace, and the insurer id comes from GET /insurers. Your plan's policy limit applies.\n\npolicyNumber must be unique in your workspace; a duplicate returns 409 conflict.\n\nTo renew a general insurance policy, create the new policy with renewFromPolicyId set to the old one. The old policy is closed and linked.",
        "x-required-scope": "policy:create",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Makes a retry safe: the first successful response is stored for 24 hours and returned for the same key and body.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "agencyId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40,
                    "description": "Id of one of your agencies. It must be active."
                  },
                  "customerId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40,
                    "description": "Id of one of your customers"
                  },
                  "policyNumber": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 50,
                    "description": "Unique within your workspace"
                  },
                  "insuranceType": {
                    "type": "string",
                    "enum": [
                      "life",
                      "health",
                      "motor",
                      "pa",
                      "wc",
                      "travel",
                      "other"
                    ]
                  },
                  "insurerId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40,
                    "description": "Id from GET /insurers"
                  },
                  "planName": {
                    "type": "string",
                    "maxLength": 200,
                    "description": "The insurer's product name"
                  },
                  "premium": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 100000000000,
                    "description": "Rupees"
                  },
                  "sumInsured": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 100000000000,
                    "description": "Rupees"
                  },
                  "firstYearCommission": {
                    "anyOf": [
                      {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 100000000000,
                        "description": "Rupees"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "startDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                    "description": "YYYY-MM-DD"
                  },
                  "expiryDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                    "description": "YYYY-MM-DD. Must be after startDate."
                  },
                  "paymentMode": {
                    "type": "string",
                    "enum": [
                      "monthly",
                      "quarterly",
                      "half_yearly",
                      "annual",
                      "single"
                    ],
                    "description": "How the premium is paid. Defaults to annual."
                  },
                  "notes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 1000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "typeFields": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {},
                    "description": "Extra details for the insurance type, such as a vehicle number"
                  },
                  "nominees": {
                    "maxItems": 10,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "dateOfBirth": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "relation": {
                          "type": "string",
                          "enum": [
                            "spouse",
                            "child",
                            "parent",
                            "sibling",
                            "other"
                          ]
                        },
                        "sharePercent": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100,
                          "description": "Percent of the benefit. All nominees on a policy must total 100."
                        },
                        "phone": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\+91[6-9]\\d{9}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "name",
                        "relation",
                        "sharePercent"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "shareWithPolicyholder": {
                    "type": "boolean",
                    "description": "Show the policy in the customer portal. Needs a plan with the portal and a customer email."
                  },
                  "renewFromPolicyId": {
                    "description": "The policy this one renews (general insurance). The old one is closed and linked.",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40
                  }
                },
                "required": [
                  "agencyId",
                  "customerId",
                  "policyNumber",
                  "insuranceType",
                  "insurerId",
                  "premium",
                  "sumInsured",
                  "startDate",
                  "expiryDate"
                ],
                "additionalProperties": false
              },
              "example": {
                "agencyId": "cmv1a2b3c0002xyzagency",
                "customerId": "cmv1a2b3c0001xyzcustomer",
                "policyNumber": "HLT-2026-004512",
                "insuranceType": "health",
                "insurerId": "cmr23hrx5000nxemeinsurer",
                "planName": "Family Health Optima",
                "premium": 18500,
                "sumInsured": 1000000,
                "startDate": "2026-11-01",
                "expiryDate": "2027-10-31",
                "paymentMode": "annual",
                "nominees": [
                  {
                    "name": "Sunita Patel",
                    "relation": "spouse",
                    "sharePercent": 100
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Policy"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, or the plan does not include API access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Clashes with existing data, or the Idempotency-Key was reused.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "A field is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/policies/{id}": {
      "get": {
        "operationId": "getPolicy",
        "tags": [
          "Policies"
        ],
        "summary": "Get a policy",
        "x-required-scope": "policy:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The policy id.",
            "schema": {
              "type": "string"
            },
            "example": "cmv1a2b3c0003xyzpolicy"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Policy"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, or the plan does not include API access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The record does not exist in your workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updatePolicy",
        "tags": [
          "Policies"
        ],
        "summary": "Update a policy",
        "description": "Send only the fields you want to change. Changing expiryDate also moves the open renewal. If you send nominees, they replace the existing ones.",
        "x-required-scope": "policy:update",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The policy id.",
            "schema": {
              "type": "string"
            },
            "example": "cmv1a2b3c0003xyzpolicy"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "agencyId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40
                  },
                  "customerId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40
                  },
                  "policyNumber": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 50,
                    "description": "Unique within your workspace"
                  },
                  "insuranceType": {
                    "type": "string",
                    "enum": [
                      "life",
                      "health",
                      "motor",
                      "pa",
                      "wc",
                      "travel",
                      "other"
                    ]
                  },
                  "insurerId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40,
                    "description": "Id from GET /insurers"
                  },
                  "planName": {
                    "type": "string",
                    "maxLength": 200,
                    "description": "The insurer's product name"
                  },
                  "premium": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 100000000000,
                    "description": "Rupees"
                  },
                  "sumInsured": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 100000000000,
                    "description": "Rupees"
                  },
                  "firstYearCommission": {
                    "anyOf": [
                      {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 100000000000,
                        "description": "Rupees"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "startDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                    "description": "YYYY-MM-DD"
                  },
                  "expiryDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                    "description": "YYYY-MM-DD. Must be after startDate."
                  },
                  "paymentMode": {
                    "type": "string",
                    "enum": [
                      "monthly",
                      "quarterly",
                      "half_yearly",
                      "annual",
                      "single"
                    ],
                    "description": "How the premium is paid. Defaults to annual."
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "expired",
                      "cancelled"
                    ]
                  },
                  "notes": {
                    "type": "string",
                    "maxLength": 1000
                  },
                  "typeFields": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {},
                    "description": "Extra details for the insurance type, such as a vehicle number"
                  },
                  "nominees": {
                    "maxItems": 10,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "dateOfBirth": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "relation": {
                          "type": "string",
                          "enum": [
                            "spouse",
                            "child",
                            "parent",
                            "sibling",
                            "other"
                          ]
                        },
                        "sharePercent": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100,
                          "description": "Percent of the benefit. All nominees on a policy must total 100."
                        },
                        "phone": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\+91[6-9]\\d{9}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "name",
                        "relation",
                        "sharePercent"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "shareWithPolicyholder": {
                    "type": "boolean",
                    "description": "Show the policy in the customer portal. Needs a plan with the portal and a customer email."
                  }
                },
                "additionalProperties": false
              },
              "example": {
                "premium": 19000,
                "status": "cancelled"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Policy"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, or the plan does not include API access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The record does not exist in your workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Clashes with existing data, or the Idempotency-Key was reused.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "A field is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/renewals": {
      "get": {
        "operationId": "listRenewals",
        "tags": [
          "Renewals"
        ],
        "summary": "List renewals",
        "description": "The renewal tracker. Renewals are created and advanced by Polisync; you read them here and record them in the app or by updating the policy.",
        "x-required-scope": "renewal:read",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "default": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 100000
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 20,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "order",
            "in": "query",
            "required": false,
            "schema": {
              "default": "desc",
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            }
          },
          {
            "name": "updatedSince",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "Field to sort by. Expiry date sorts soonest first unless you set order.",
            "schema": {
              "default": "expiryDate",
              "type": "string",
              "enum": [
                "expiryDate",
                "updatedAt"
              ]
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "description": "active is the working book, history is renewed and lapsed, all is everything.",
            "schema": {
              "default": "active",
              "type": "string",
              "enum": [
                "active",
                "history",
                "all"
              ]
            }
          },
          {
            "name": "policyId",
            "in": "query",
            "required": false,
            "description": "Only renewals of the policy with this id.",
            "schema": {
              "type": "string",
              "maxLength": 40
            }
          },
          {
            "name": "expiryFrom",
            "in": "query",
            "required": false,
            "description": "Due on or after this day (YYYY-MM-DD).",
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "expiryTo",
            "in": "query",
            "required": false,
            "description": "Due on or before this day (YYYY-MM-DD).",
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "pagination"
                  ],
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Renewal"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, or the plan does not include API access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/claims": {
      "get": {
        "operationId": "listClaims",
        "tags": [
          "Claims"
        ],
        "summary": "List claims",
        "x-required-scope": "claim:read",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "default": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 100000
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 20,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "order",
            "in": "query",
            "required": false,
            "schema": {
              "default": "desc",
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            }
          },
          {
            "name": "updatedSince",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "Field to sort by.",
            "schema": {
              "default": "createdAt",
              "type": "string",
              "enum": [
                "createdAt",
                "updatedAt",
                "incidentDate",
                "nextFollowUpAt"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "open means still being worked, closed means settled or closed, or give one exact status.",
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "open",
                    "closed"
                  ]
                },
                {
                  "type": "string",
                  "enum": [
                    "reported",
                    "documents_pending",
                    "submitted",
                    "under_review",
                    "query_raised",
                    "approved",
                    "settled",
                    "rejected",
                    "escalated",
                    "closed"
                  ]
                }
              ]
            }
          },
          {
            "name": "claimType",
            "in": "query",
            "required": false,
            "description": "Only this type of claim.",
            "schema": {
              "type": "string",
              "enum": [
                "health_cashless",
                "health_reimbursement",
                "life_death",
                "life_maturity",
                "motor_own_damage",
                "motor_third_party",
                "motor_theft",
                "other"
              ]
            }
          },
          {
            "name": "policyId",
            "in": "query",
            "required": false,
            "description": "Only claims on the policy with this id.",
            "schema": {
              "type": "string",
              "maxLength": 40
            }
          },
          {
            "name": "customerId",
            "in": "query",
            "required": false,
            "description": "Only claims of the customer with this id.",
            "schema": {
              "type": "string",
              "maxLength": 40
            }
          },
          {
            "name": "agencyId",
            "in": "query",
            "required": false,
            "description": "Only claims of the agency with this id.",
            "schema": {
              "type": "string",
              "maxLength": 40
            }
          },
          {
            "name": "overdue",
            "in": "query",
            "required": false,
            "description": "Only claims where the insurer has passed an IRDAI deadline.",
            "schema": {
              "type": "string",
              "enum": [
                "true"
              ]
            }
          },
          {
            "name": "followUpDue",
            "in": "query",
            "required": false,
            "description": "Only open claims whose follow-up date is today or earlier.",
            "schema": {
              "type": "string",
              "enum": [
                "true"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "pagination"
                  ],
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Claim"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, or the plan does not include API access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createClaim",
        "tags": [
          "Claims"
        ],
        "summary": "Report a claim",
        "description": "Logs a claim against a policy. The customer and agency come from the policy. The claim is assigned to the person who created the API key. The insurer, not Polisync, decides a claim; Polisync tracks the documents, follow-ups and IRDAI deadlines.\n\nclaimType must suit the policy: a health policy takes health_cashless or health_reimbursement (or other).",
        "x-required-scope": "claim:create",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Makes a retry safe: the first successful response is stored for 24 hours and returned for the same key and body.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "policyId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "claimType": {
                    "type": "string",
                    "enum": [
                      "health_cashless",
                      "health_reimbursement",
                      "life_death",
                      "life_maturity",
                      "motor_own_damage",
                      "motor_third_party",
                      "motor_theft",
                      "other"
                    ]
                  },
                  "incidentDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "claimNumber": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 60
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "intimatedAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "submittedAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "surveyReportAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "underInvestigation": {
                    "type": "boolean"
                  },
                  "amountClaimed": {
                    "anyOf": [
                      {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 100000000000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "amountApproved": {
                    "anyOf": [
                      {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 100000000000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "amountSettled": {
                    "anyOf": [
                      {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 100000000000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "rejectionReason": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 1000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "providerName": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 150
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "handlerName": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 150
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "handlerContact": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 150
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "description": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 2000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "nextFollowUpAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "reported",
                      "documents_pending",
                      "submitted",
                      "under_review",
                      "query_raised",
                      "approved",
                      "settled",
                      "rejected",
                      "escalated",
                      "closed"
                    ]
                  }
                },
                "required": [
                  "policyId",
                  "claimType",
                  "incidentDate"
                ],
                "additionalProperties": false
              },
              "example": {
                "policyId": "cmv1a2b3c0003xyzpolicy",
                "claimType": "health_reimbursement",
                "incidentDate": "2026-10-20",
                "intimatedAt": "2026-10-21",
                "submittedAt": "2026-10-22",
                "amountClaimed": 85000,
                "providerName": "City Hospital",
                "description": "Hospitalised for 3 days"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Claim"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, or the plan does not include API access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "A field is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/claims/{id}": {
      "get": {
        "operationId": "getClaim",
        "tags": [
          "Claims"
        ],
        "summary": "Get a claim",
        "x-required-scope": "claim:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The claim id.",
            "schema": {
              "type": "string"
            },
            "example": "cmv1a2b3c0006xyzclaim"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Claim"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, or the plan does not include API access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The record does not exist in your workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateClaim",
        "tags": [
          "Claims"
        ],
        "summary": "Update a claim",
        "description": "Send only the fields you want to change. Changing status adds an entry to the claim's timeline, and settled or closed stamp their dates automatically. The deadline clocks are recalculated from the dates you send.",
        "x-required-scope": "claim:update",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The claim id.",
            "schema": {
              "type": "string"
            },
            "example": "cmv1a2b3c0006xyzclaim"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "claimNumber": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 60
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "intimatedAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "submittedAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "surveyReportAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "underInvestigation": {
                    "type": "boolean"
                  },
                  "amountClaimed": {
                    "anyOf": [
                      {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 100000000000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "amountApproved": {
                    "anyOf": [
                      {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 100000000000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "amountSettled": {
                    "anyOf": [
                      {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 100000000000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "rejectionReason": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 1000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "providerName": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 150
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "handlerName": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 150
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "handlerContact": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 150
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "description": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 2000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "nextFollowUpAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "reported",
                      "documents_pending",
                      "submitted",
                      "under_review",
                      "query_raised",
                      "approved",
                      "settled",
                      "rejected",
                      "escalated",
                      "closed"
                    ]
                  },
                  "statusNote": {
                    "type": "string",
                    "maxLength": 1000
                  },
                  "incidentDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  }
                },
                "additionalProperties": false
              },
              "example": {
                "status": "approved",
                "amountApproved": 80000,
                "statusNote": "TPA approved the claim"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Claim"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, or the plan does not include API access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The record does not exist in your workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "A field is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/claims/{id}/events": {
      "get": {
        "operationId": "listClaimEvents",
        "tags": [
          "Claims"
        ],
        "summary": "Get a claim's timeline",
        "description": "Status changes, edits, notes and calls, newest first (up to 200).",
        "x-required-scope": "claim:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The claim id.",
            "schema": {
              "type": "string"
            },
            "example": "cmv1a2b3c0006xyzclaim"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ClaimEvent"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, or the plan does not include API access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The record does not exist in your workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "addClaimEvent",
        "tags": [
          "Claims"
        ],
        "summary": "Add a note to a claim",
        "description": "Adds a note, call log or follow-up to the timeline. You can set the next follow-up date in the same request.",
        "x-required-scope": "claim:update",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The claim id.",
            "schema": {
              "type": "string"
            },
            "example": "cmv1a2b3c0006xyzclaim"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Makes a retry safe: the first successful response is stored for 24 hours and returned for the same key and body.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "note",
                      "call",
                      "follow_up"
                    ]
                  },
                  "note": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "nextFollowUpAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "type",
                  "note"
                ],
                "additionalProperties": false
              },
              "example": {
                "type": "call",
                "note": "Spoke to the TPA. Payment expected this week.",
                "nextFollowUpAt": "2026-10-30"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/ClaimEvent"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, or the plan does not include API access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The record does not exist in your workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "A field is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/agencies": {
      "get": {
        "operationId": "listAgencies",
        "tags": [
          "Agencies"
        ],
        "summary": "List agencies",
        "x-required-scope": "agency:read",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "default": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 100000
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 20,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "order",
            "in": "query",
            "required": false,
            "schema": {
              "default": "desc",
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            }
          },
          {
            "name": "updatedSince",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "Field to sort by.",
            "schema": {
              "default": "createdAt",
              "type": "string",
              "enum": [
                "createdAt",
                "updatedAt",
                "name"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Only agencies with this status.",
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "inactive"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "pagination"
                  ],
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Agency"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, or the plan does not include API access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/agencies/{id}": {
      "get": {
        "operationId": "getAgency",
        "tags": [
          "Agencies"
        ],
        "summary": "Get an agency",
        "x-required-scope": "agency:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The agency id.",
            "schema": {
              "type": "string"
            },
            "example": "cmv1a2b3c0002xyzagency"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Agency"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, or the plan does not include API access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The record does not exist in your workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/insurers": {
      "get": {
        "operationId": "listInsurers",
        "tags": [
          "Insurers"
        ],
        "summary": "List insurers",
        "description": "The shared insurer directory. Use the id as insurerId when you create a policy. Any valid key can read it.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Insurer"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, invalid, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, or the plan does not include API access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {
    "customer.created": {
      "post": {
        "summary": "customer.created",
        "description": "A customer was added (in the app, by import, or through the API).",
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEvent"
              },
              "example": {
                "id": "evt_5f1c2a9e7b3d4c6a8e0f1b2c3d4e5f60",
                "type": "customer.created",
                "createdAt": "2026-10-26T09:41:00.000Z",
                "data": {
                  "object": {
                    "id": "cmv1a2b3c0001xyzcustomer",
                    "name": "Ramesh Patel",
                    "type": "individual",
                    "phone": "+919876543210",
                    "altPhone": null,
                    "email": "ramesh.patel@gmail.com",
                    "dateOfBirth": "1985-03-14",
                    "gender": "male",
                    "address": "12 Shanti Nagar",
                    "city": "Surat",
                    "state": "Gujarat",
                    "pin": "395007",
                    "country": "IN",
                    "pan": "ABCDE****F",
                    "agencyId": "cmv1a2b3c0002xyzagency",
                    "status": "active",
                    "consentGiven": true,
                    "consentDate": "2026-10-26T09:30:00.000Z",
                    "createdAt": "2026-10-26T09:30:00.000Z",
                    "updatedAt": "2026-10-26T09:30:00.000Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Return any 2xx within 5 seconds to acknowledge the event."
          }
        }
      }
    },
    "customer.updated": {
      "post": {
        "summary": "customer.updated",
        "description": "A customer's details were changed.",
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEvent"
              },
              "example": {
                "id": "evt_5f1c2a9e7b3d4c6a8e0f1b2c3d4e5f60",
                "type": "customer.updated",
                "createdAt": "2026-10-26T09:41:00.000Z",
                "data": {
                  "object": {
                    "id": "cmv1a2b3c0001xyzcustomer",
                    "name": "Ramesh Patel",
                    "type": "individual",
                    "phone": "+919876543210",
                    "altPhone": null,
                    "email": "ramesh.patel@gmail.com",
                    "dateOfBirth": "1985-03-14",
                    "gender": "male",
                    "address": "12 Shanti Nagar",
                    "city": "Surat",
                    "state": "Gujarat",
                    "pin": "395007",
                    "country": "IN",
                    "pan": "ABCDE****F",
                    "agencyId": "cmv1a2b3c0002xyzagency",
                    "status": "active",
                    "consentGiven": true,
                    "consentDate": "2026-10-26T09:30:00.000Z",
                    "createdAt": "2026-10-26T09:30:00.000Z",
                    "updatedAt": "2026-10-26T09:30:00.000Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Return any 2xx within 5 seconds to acknowledge the event."
          }
        }
      }
    },
    "customer.deleted": {
      "post": {
        "summary": "customer.deleted",
        "description": "A customer, with their policies and claims, was deleted.",
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEvent"
              },
              "example": {
                "id": "evt_5f1c2a9e7b3d4c6a8e0f1b2c3d4e5f60",
                "type": "customer.deleted",
                "createdAt": "2026-10-26T09:41:00.000Z",
                "data": {
                  "object": {
                    "id": "cmv1a2b3c0001xyzcustomer",
                    "deleted": true
                  },
                  "deletedPolicyIds": [
                    "cmv1a2b3c0003xyzpolicy"
                  ]
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Return any 2xx within 5 seconds to acknowledge the event."
          }
        }
      }
    },
    "policy.created": {
      "post": {
        "summary": "policy.created",
        "description": "A policy was added.",
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEvent"
              },
              "example": {
                "id": "evt_5f1c2a9e7b3d4c6a8e0f1b2c3d4e5f60",
                "type": "policy.created",
                "createdAt": "2026-10-26T09:41:00.000Z",
                "data": {
                  "object": {
                    "id": "cmv1a2b3c0003xyzpolicy",
                    "policyNumber": "HLT-2026-004512",
                    "insuranceType": "health",
                    "customerId": "cmv1a2b3c0001xyzcustomer",
                    "agencyId": "cmv1a2b3c0002xyzagency",
                    "insurerId": "cmr23hrx5000nxemeinsurer",
                    "insurerName": "Star Health and Allied Insurance Co. Ltd.",
                    "planName": "Family Health Optima",
                    "premium": 18500,
                    "sumInsured": 1000000,
                    "firstYearCommission": 2775,
                    "startDate": "2026-11-01",
                    "expiryDate": "2027-10-31",
                    "paymentMode": "annual",
                    "status": "active",
                    "notes": null,
                    "typeFields": {},
                    "nominees": [
                      {
                        "id": "cmv1a2b3c0004xyznominee",
                        "name": "Sunita Patel",
                        "dateOfBirth": "1988-07-02",
                        "relation": "spouse",
                        "sharePercent": 100,
                        "phone": "+919876500001"
                      }
                    ],
                    "createdAt": "2026-10-26T09:41:00.000Z",
                    "updatedAt": "2026-10-26T09:41:00.000Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Return any 2xx within 5 seconds to acknowledge the event."
          }
        }
      }
    },
    "policy.updated": {
      "post": {
        "summary": "policy.updated",
        "description": "A policy was changed, including status and expiry date.",
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEvent"
              },
              "example": {
                "id": "evt_5f1c2a9e7b3d4c6a8e0f1b2c3d4e5f60",
                "type": "policy.updated",
                "createdAt": "2026-10-26T09:41:00.000Z",
                "data": {
                  "object": {
                    "id": "cmv1a2b3c0003xyzpolicy",
                    "policyNumber": "HLT-2026-004512",
                    "insuranceType": "health",
                    "customerId": "cmv1a2b3c0001xyzcustomer",
                    "agencyId": "cmv1a2b3c0002xyzagency",
                    "insurerId": "cmr23hrx5000nxemeinsurer",
                    "insurerName": "Star Health and Allied Insurance Co. Ltd.",
                    "planName": "Family Health Optima",
                    "premium": 18500,
                    "sumInsured": 1000000,
                    "firstYearCommission": 2775,
                    "startDate": "2026-11-01",
                    "expiryDate": "2027-10-31",
                    "paymentMode": "annual",
                    "status": "active",
                    "notes": null,
                    "typeFields": {},
                    "nominees": [
                      {
                        "id": "cmv1a2b3c0004xyznominee",
                        "name": "Sunita Patel",
                        "dateOfBirth": "1988-07-02",
                        "relation": "spouse",
                        "sharePercent": 100,
                        "phone": "+919876500001"
                      }
                    ],
                    "createdAt": "2026-10-26T09:41:00.000Z",
                    "updatedAt": "2026-10-26T09:41:00.000Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Return any 2xx within 5 seconds to acknowledge the event."
          }
        }
      }
    },
    "policy.deleted": {
      "post": {
        "summary": "policy.deleted",
        "description": "A policy was deleted.",
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEvent"
              },
              "example": {
                "id": "evt_5f1c2a9e7b3d4c6a8e0f1b2c3d4e5f60",
                "type": "policy.deleted",
                "createdAt": "2026-10-26T09:41:00.000Z",
                "data": {
                  "object": {
                    "id": "cmv1a2b3c0003xyzpolicy",
                    "deleted": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Return any 2xx within 5 seconds to acknowledge the event."
          }
        }
      }
    },
    "policy.expiring": {
      "post": {
        "summary": "policy.expiring",
        "description": "A policy is 30, 7 or 0 days from expiry.",
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEvent"
              },
              "example": {
                "id": "evt_5f1c2a9e7b3d4c6a8e0f1b2c3d4e5f60",
                "type": "policy.expiring",
                "createdAt": "2026-10-26T09:41:00.000Z",
                "data": {
                  "object": {
                    "id": "cmv1a2b3c0003xyzpolicy",
                    "policyNumber": "HLT-2026-004512",
                    "insuranceType": "health",
                    "customerId": "cmv1a2b3c0001xyzcustomer",
                    "agencyId": "cmv1a2b3c0002xyzagency",
                    "insurerId": "cmr23hrx5000nxemeinsurer",
                    "insurerName": "Star Health and Allied Insurance Co. Ltd.",
                    "planName": "Family Health Optima",
                    "premium": 18500,
                    "sumInsured": 1000000,
                    "firstYearCommission": 2775,
                    "startDate": "2026-11-01",
                    "expiryDate": "2027-10-31",
                    "paymentMode": "annual",
                    "status": "active",
                    "notes": null,
                    "typeFields": {},
                    "nominees": [
                      {
                        "id": "cmv1a2b3c0004xyznominee",
                        "name": "Sunita Patel",
                        "dateOfBirth": "1988-07-02",
                        "relation": "spouse",
                        "sharePercent": 100,
                        "phone": "+919876500001"
                      }
                    ],
                    "createdAt": "2026-10-26T09:41:00.000Z",
                    "updatedAt": "2026-10-26T09:41:00.000Z"
                  },
                  "daysUntilExpiry": 7
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Return any 2xx within 5 seconds to acknowledge the event."
          }
        }
      }
    },
    "renewal.recorded": {
      "post": {
        "summary": "renewal.recorded",
        "description": "A renewal or premium payment was recorded.",
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEvent"
              },
              "example": {
                "id": "evt_5f1c2a9e7b3d4c6a8e0f1b2c3d4e5f60",
                "type": "renewal.recorded",
                "createdAt": "2026-10-26T09:41:00.000Z",
                "data": {
                  "object": {
                    "id": "cmv1a2b3c0005xyzrenewal",
                    "policyId": "cmv1a2b3c0003xyzpolicy",
                    "policyNumber": "HLT-2026-004512",
                    "customerId": "cmv1a2b3c0001xyzcustomer",
                    "insuranceType": "health",
                    "expiryDate": "2027-10-31",
                    "daysLeft": 370,
                    "status": "active",
                    "stage": "upcoming",
                    "mode": "reissue",
                    "graceDaysLeft": 30,
                    "renewedAt": null,
                    "renewedPolicyId": null,
                    "commissionEarned": null,
                    "createdAt": "2026-10-26T09:41:00.000Z",
                    "updatedAt": "2026-10-26T09:41:00.000Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Return any 2xx within 5 seconds to acknowledge the event."
          }
        }
      }
    },
    "renewal.lapsed": {
      "post": {
        "summary": "renewal.lapsed",
        "description": "A renewal lapsed because the grace period ended.",
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEvent"
              },
              "example": {
                "id": "evt_5f1c2a9e7b3d4c6a8e0f1b2c3d4e5f60",
                "type": "renewal.lapsed",
                "createdAt": "2026-10-26T09:41:00.000Z",
                "data": {
                  "object": {
                    "id": "cmv1a2b3c0005xyzrenewal",
                    "policyId": "cmv1a2b3c0003xyzpolicy",
                    "policyNumber": "HLT-2026-004512",
                    "customerId": "cmv1a2b3c0001xyzcustomer",
                    "insuranceType": "health",
                    "expiryDate": "2027-10-31",
                    "daysLeft": 370,
                    "status": "active",
                    "stage": "upcoming",
                    "mode": "reissue",
                    "graceDaysLeft": 30,
                    "renewedAt": null,
                    "renewedPolicyId": null,
                    "commissionEarned": null,
                    "createdAt": "2026-10-26T09:41:00.000Z",
                    "updatedAt": "2026-10-26T09:41:00.000Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Return any 2xx within 5 seconds to acknowledge the event."
          }
        }
      }
    },
    "claim.created": {
      "post": {
        "summary": "claim.created",
        "description": "A claim was reported.",
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEvent"
              },
              "example": {
                "id": "evt_5f1c2a9e7b3d4c6a8e0f1b2c3d4e5f60",
                "type": "claim.created",
                "createdAt": "2026-10-26T09:41:00.000Z",
                "data": {
                  "object": {
                    "id": "cmv1a2b3c0006xyzclaim",
                    "policyId": "cmv1a2b3c0003xyzpolicy",
                    "customerId": "cmv1a2b3c0001xyzcustomer",
                    "agencyId": "cmv1a2b3c0002xyzagency",
                    "claimType": "health_reimbursement",
                    "claimTypeLabel": "Health: reimbursement",
                    "status": "submitted",
                    "claimNumber": "CLM-884213",
                    "incidentDate": "2026-10-20",
                    "intimatedAt": "2026-10-21",
                    "submittedAt": "2026-10-22",
                    "surveyReportAt": null,
                    "underInvestigation": false,
                    "amountClaimed": 85000,
                    "amountApproved": null,
                    "amountSettled": null,
                    "settledAt": null,
                    "rejectionReason": null,
                    "providerName": "City Hospital",
                    "handlerName": null,
                    "handlerContact": null,
                    "description": "Hospitalised for 3 days",
                    "nextFollowUpAt": "2026-10-30",
                    "closedAt": null,
                    "deadlines": [
                      {
                        "key": "health_reimbursement_settle",
                        "label": "Insurer to settle",
                        "rule": "Within 15 days of the claim being submitted",
                        "startsOn": "2026-10-22",
                        "dueOn": "2026-11-06",
                        "daysLeft": 11,
                        "state": "running",
                        "interestDue": false
                      }
                    ],
                    "createdAt": "2026-10-21T08:15:00.000Z",
                    "updatedAt": "2026-10-22T10:02:00.000Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Return any 2xx within 5 seconds to acknowledge the event."
          }
        }
      }
    },
    "claim.status_changed": {
      "post": {
        "summary": "claim.status_changed",
        "description": "A claim moved to a new status.",
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEvent"
              },
              "example": {
                "id": "evt_5f1c2a9e7b3d4c6a8e0f1b2c3d4e5f60",
                "type": "claim.status_changed",
                "createdAt": "2026-10-26T09:41:00.000Z",
                "data": {
                  "object": {
                    "id": "cmv1a2b3c0006xyzclaim",
                    "policyId": "cmv1a2b3c0003xyzpolicy",
                    "customerId": "cmv1a2b3c0001xyzcustomer",
                    "agencyId": "cmv1a2b3c0002xyzagency",
                    "claimType": "health_reimbursement",
                    "claimTypeLabel": "Health: reimbursement",
                    "status": "submitted",
                    "claimNumber": "CLM-884213",
                    "incidentDate": "2026-10-20",
                    "intimatedAt": "2026-10-21",
                    "submittedAt": "2026-10-22",
                    "surveyReportAt": null,
                    "underInvestigation": false,
                    "amountClaimed": 85000,
                    "amountApproved": null,
                    "amountSettled": null,
                    "settledAt": null,
                    "rejectionReason": null,
                    "providerName": "City Hospital",
                    "handlerName": null,
                    "handlerContact": null,
                    "description": "Hospitalised for 3 days",
                    "nextFollowUpAt": "2026-10-30",
                    "closedAt": null,
                    "deadlines": [
                      {
                        "key": "health_reimbursement_settle",
                        "label": "Insurer to settle",
                        "rule": "Within 15 days of the claim being submitted",
                        "startsOn": "2026-10-22",
                        "dueOn": "2026-11-06",
                        "daysLeft": 11,
                        "state": "running",
                        "interestDue": false
                      }
                    ],
                    "createdAt": "2026-10-21T08:15:00.000Z",
                    "updatedAt": "2026-10-22T10:02:00.000Z"
                  },
                  "previousStatus": "reported"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Return any 2xx within 5 seconds to acknowledge the event."
          }
        }
      }
    },
    "claim.follow_up_due": {
      "post": {
        "summary": "claim.follow_up_due",
        "description": "A claim's follow-up date has arrived.",
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEvent"
              },
              "example": {
                "id": "evt_5f1c2a9e7b3d4c6a8e0f1b2c3d4e5f60",
                "type": "claim.follow_up_due",
                "createdAt": "2026-10-26T09:41:00.000Z",
                "data": {
                  "object": {
                    "id": "cmv1a2b3c0006xyzclaim",
                    "policyId": "cmv1a2b3c0003xyzpolicy",
                    "customerId": "cmv1a2b3c0001xyzcustomer",
                    "agencyId": "cmv1a2b3c0002xyzagency",
                    "claimType": "health_reimbursement",
                    "claimTypeLabel": "Health: reimbursement",
                    "status": "submitted",
                    "claimNumber": "CLM-884213",
                    "incidentDate": "2026-10-20",
                    "intimatedAt": "2026-10-21",
                    "submittedAt": "2026-10-22",
                    "surveyReportAt": null,
                    "underInvestigation": false,
                    "amountClaimed": 85000,
                    "amountApproved": null,
                    "amountSettled": null,
                    "settledAt": null,
                    "rejectionReason": null,
                    "providerName": "City Hospital",
                    "handlerName": null,
                    "handlerContact": null,
                    "description": "Hospitalised for 3 days",
                    "nextFollowUpAt": "2026-10-30",
                    "closedAt": null,
                    "deadlines": [
                      {
                        "key": "health_reimbursement_settle",
                        "label": "Insurer to settle",
                        "rule": "Within 15 days of the claim being submitted",
                        "startsOn": "2026-10-22",
                        "dueOn": "2026-11-06",
                        "daysLeft": 11,
                        "state": "running",
                        "interestDue": false
                      }
                    ],
                    "createdAt": "2026-10-21T08:15:00.000Z",
                    "updatedAt": "2026-10-22T10:02:00.000Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Return any 2xx within 5 seconds to acknowledge the event."
          }
        }
      }
    },
    "claim.deadline_overdue": {
      "post": {
        "summary": "claim.deadline_overdue",
        "description": "The insurer passed an IRDAI deadline on a claim.",
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEvent"
              },
              "example": {
                "id": "evt_5f1c2a9e7b3d4c6a8e0f1b2c3d4e5f60",
                "type": "claim.deadline_overdue",
                "createdAt": "2026-10-26T09:41:00.000Z",
                "data": {
                  "object": {
                    "id": "cmv1a2b3c0006xyzclaim",
                    "policyId": "cmv1a2b3c0003xyzpolicy",
                    "customerId": "cmv1a2b3c0001xyzcustomer",
                    "agencyId": "cmv1a2b3c0002xyzagency",
                    "claimType": "health_reimbursement",
                    "claimTypeLabel": "Health: reimbursement",
                    "status": "submitted",
                    "claimNumber": "CLM-884213",
                    "incidentDate": "2026-10-20",
                    "intimatedAt": "2026-10-21",
                    "submittedAt": "2026-10-22",
                    "surveyReportAt": null,
                    "underInvestigation": false,
                    "amountClaimed": 85000,
                    "amountApproved": null,
                    "amountSettled": null,
                    "settledAt": null,
                    "rejectionReason": null,
                    "providerName": "City Hospital",
                    "handlerName": null,
                    "handlerContact": null,
                    "description": "Hospitalised for 3 days",
                    "nextFollowUpAt": "2026-10-30",
                    "closedAt": null,
                    "deadlines": [
                      {
                        "key": "health_reimbursement_settle",
                        "label": "Insurer to settle",
                        "rule": "Within 15 days of the claim being submitted",
                        "startsOn": "2026-10-22",
                        "dueOn": "2026-11-06",
                        "daysLeft": 11,
                        "state": "running",
                        "interestDue": false
                      }
                    ],
                    "createdAt": "2026-10-21T08:15:00.000Z",
                    "updatedAt": "2026-10-22T10:02:00.000Z"
                  },
                  "deadline": "health_reimbursement_settle"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Return any 2xx within 5 seconds to acknowledge the event."
          }
        }
      }
    },
    "ping": {
      "post": {
        "summary": "ping",
        "description": "Sent by the Send test event button.",
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEvent"
              },
              "example": {
                "id": "evt_5f1c2a9e7b3d4c6a8e0f1b2c3d4e5f60",
                "type": "ping",
                "createdAt": "2026-10-26T09:41:00.000Z",
                "data": {
                  "message": "This is a test event from Polisync.",
                  "endpointId": "cmv1a2b3c0008xyzendpoint"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Acknowledge with any 2xx."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "An API key (psk_live_...). Create one under Settings, Developers. Keep it secret."
      }
    },
    "headers": {
      "X-Request-Id": {
        "description": "Identifies the request. Quote it if you contact support.",
        "schema": {
          "type": "string"
        }
      },
      "X-RateLimit-Limit": {
        "description": "Requests allowed per minute for this key.",
        "schema": {
          "type": "integer"
        }
      },
      "X-RateLimit-Remaining": {
        "description": "Requests left in the current minute.",
        "schema": {
          "type": "integer"
        }
      },
      "X-RateLimit-Reset": {
        "description": "Unix time when the limit resets.",
        "schema": {
          "type": "integer"
        }
      }
    },
    "schemas": {
      "Customer": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Polisync id of the customer"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "individual",
              "company"
            ]
          },
          "phone": {
            "type": "string",
            "description": "Mobile number in +91 format"
          },
          "altPhone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Stored in lowercase"
          },
          "dateOfBirth": {
            "anyOf": [
              {
                "type": "string",
                "description": "Date, YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "gender": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "male",
                  "female",
                  "other"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "address": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "city": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "state": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "pin": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "country": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "ISO country code, IN by default"
          },
          "pan": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "PAN, masked as ABCDE****F unless the key has the full PAN scope"
          },
          "agencyId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "inactive"
            ]
          },
          "consentGiven": {
            "type": "boolean",
            "description": "DPDP consent recorded for this customer"
          },
          "consentDate": {
            "anyOf": [
              {
                "type": "string",
                "description": "ISO 8601 timestamp, UTC"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "description": "ISO 8601 timestamp, UTC"
          },
          "updatedAt": {
            "type": "string",
            "description": "ISO 8601 timestamp, UTC"
          }
        },
        "required": [
          "id",
          "name",
          "type",
          "phone",
          "altPhone",
          "email",
          "dateOfBirth",
          "gender",
          "address",
          "city",
          "state",
          "pin",
          "country",
          "pan",
          "agencyId",
          "status",
          "consentGiven",
          "consentDate",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false,
        "description": "A customer (policyholder)."
      },
      "Nominee": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Polisync id of the nominee"
          },
          "name": {
            "type": "string"
          },
          "dateOfBirth": {
            "anyOf": [
              {
                "type": "string",
                "description": "Date, YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "relation": {
            "type": "string",
            "enum": [
              "spouse",
              "child",
              "parent",
              "sibling",
              "other"
            ]
          },
          "sharePercent": {
            "type": "number",
            "description": "Share of the benefit. All nominees on a policy total 100."
          },
          "phone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "name",
          "dateOfBirth",
          "relation",
          "sharePercent",
          "phone"
        ],
        "additionalProperties": false,
        "description": "A nominee on a policy."
      },
      "Policy": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Polisync id of the policy"
          },
          "policyNumber": {
            "type": "string",
            "description": "Unique within your workspace"
          },
          "insuranceType": {
            "type": "string",
            "enum": [
              "life",
              "health",
              "motor",
              "pa",
              "wc",
              "travel",
              "other"
            ]
          },
          "customerId": {
            "type": "string"
          },
          "agencyId": {
            "type": "string"
          },
          "insurerId": {
            "type": "string",
            "description": "Id from GET /insurers"
          },
          "insurerName": {
            "type": "string"
          },
          "planName": {
            "type": "string"
          },
          "premium": {
            "type": "number",
            "description": "Rupees"
          },
          "sumInsured": {
            "type": "number",
            "description": "Rupees"
          },
          "firstYearCommission": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Rupees"
          },
          "startDate": {
            "type": "string",
            "description": "Date, YYYY-MM-DD"
          },
          "expiryDate": {
            "type": "string",
            "description": "Expiry date, or the next premium due date for a continuing life policy"
          },
          "paymentMode": {
            "type": "string",
            "enum": [
              "monthly",
              "quarterly",
              "half_yearly",
              "annual",
              "single"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "expired",
              "cancelled"
            ]
          },
          "notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "typeFields": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              {
                "type": "null"
              }
            ],
            "description": "Extra details that depend on the insurance type, such as vehicle number"
          },
          "nominees": {
            "description": "Included when you fetch one policy or write one; left out of lists",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "Polisync id of the nominee"
                },
                "name": {
                  "type": "string"
                },
                "dateOfBirth": {
                  "anyOf": [
                    {
                      "type": "string",
                      "description": "Date, YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "relation": {
                  "type": "string",
                  "enum": [
                    "spouse",
                    "child",
                    "parent",
                    "sibling",
                    "other"
                  ]
                },
                "sharePercent": {
                  "type": "number",
                  "description": "Share of the benefit. All nominees on a policy total 100."
                },
                "phone": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "name",
                "dateOfBirth",
                "relation",
                "sharePercent",
                "phone"
              ],
              "additionalProperties": false,
              "description": "A nominee on a policy."
            }
          },
          "createdAt": {
            "type": "string",
            "description": "ISO 8601 timestamp, UTC"
          },
          "updatedAt": {
            "type": "string",
            "description": "ISO 8601 timestamp, UTC"
          }
        },
        "required": [
          "id",
          "policyNumber",
          "insuranceType",
          "customerId",
          "agencyId",
          "insurerId",
          "insurerName",
          "planName",
          "premium",
          "sumInsured",
          "firstYearCommission",
          "startDate",
          "expiryDate",
          "paymentMode",
          "status",
          "notes",
          "typeFields",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false,
        "description": "An insurance policy."
      },
      "Agency": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Polisync id of the agency"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "corporate",
              "non_corporate"
            ]
          },
          "agentName": {
            "type": "string"
          },
          "agentCode": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "insurerId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "address": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "city": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "state": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "pin": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "country": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "inactive"
            ]
          },
          "createdAt": {
            "type": "string",
            "description": "ISO 8601 timestamp, UTC"
          },
          "updatedAt": {
            "type": "string",
            "description": "ISO 8601 timestamp, UTC"
          }
        },
        "required": [
          "id",
          "name",
          "type",
          "agentName",
          "agentCode",
          "insurerId",
          "address",
          "city",
          "state",
          "pin",
          "country",
          "status",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false,
        "description": "An agency: the licence or code you sell under."
      },
      "Insurer": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Polisync id of the insurer"
          },
          "name": {
            "type": "string"
          },
          "types": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Insurance types the insurer offers"
          },
          "website": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "supportEmail": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "carePhone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "types",
          "website",
          "supportEmail",
          "carePhone",
          "status"
        ],
        "additionalProperties": false,
        "description": "An insurer from the shared Polisync directory."
      },
      "Renewal": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Polisync id of the renewal"
          },
          "policyId": {
            "type": "string"
          },
          "policyNumber": {
            "type": "string"
          },
          "customerId": {
            "type": "string"
          },
          "insuranceType": {
            "type": "string",
            "enum": [
              "life",
              "health",
              "motor",
              "pa",
              "wc",
              "travel",
              "other"
            ]
          },
          "expiryDate": {
            "type": "string",
            "description": "The due date of this cycle"
          },
          "daysLeft": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Days until due, never below 0"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "renewed",
              "lapsed"
            ]
          },
          "stage": {
            "type": "string",
            "enum": [
              "upcoming",
              "due_soon",
              "in_grace",
              "overdue",
              "renewed_on_time",
              "renewed_late",
              "lapsed"
            ],
            "description": "Where the renewal stands, worked out from the dates and the grace period"
          },
          "mode": {
            "type": "string",
            "enum": [
              "continuing",
              "reissue"
            ],
            "description": "continuing is life (same policy, next premium), reissue is general insurance (a new policy each year)"
          },
          "graceDaysLeft": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "renewedAt": {
            "anyOf": [
              {
                "type": "string",
                "description": "Date, YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "renewedPolicyId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "For reissued policies, the new policy"
          },
          "commissionEarned": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "description": "ISO 8601 timestamp, UTC"
          },
          "updatedAt": {
            "type": "string",
            "description": "ISO 8601 timestamp, UTC"
          }
        },
        "required": [
          "id",
          "policyId",
          "policyNumber",
          "customerId",
          "insuranceType",
          "expiryDate",
          "daysLeft",
          "status",
          "stage",
          "mode",
          "graceDaysLeft",
          "renewedAt",
          "renewedPolicyId",
          "commissionEarned",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false,
        "description": "One renewal or premium cycle of a policy."
      },
      "Deadline": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "rule": {
            "type": "string",
            "description": "The IRDAI timeline in words"
          },
          "startsOn": {
            "anyOf": [
              {
                "type": "string",
                "description": "Date, YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ],
            "description": "The date the clock starts from; null until you enter it"
          },
          "dueOn": {
            "anyOf": [
              {
                "type": "string",
                "description": "Date, YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "daysLeft": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ],
            "description": "Negative once overdue"
          },
          "state": {
            "type": "string",
            "enum": [
              "waiting",
              "running",
              "due_soon",
              "overdue",
              "stopped"
            ]
          },
          "interestDue": {
            "type": "boolean",
            "description": "True once overdue: interest at the bank rate plus 2% is payable"
          }
        },
        "required": [
          "key",
          "label",
          "rule",
          "startsOn",
          "dueOn",
          "daysLeft",
          "state",
          "interestDue"
        ],
        "additionalProperties": false,
        "description": "An insurer deadline worked out from the claim's dates."
      },
      "Claim": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Polisync id of the claim"
          },
          "policyId": {
            "type": "string"
          },
          "customerId": {
            "type": "string"
          },
          "agencyId": {
            "type": "string"
          },
          "claimType": {
            "type": "string",
            "enum": [
              "health_cashless",
              "health_reimbursement",
              "life_death",
              "life_maturity",
              "motor_own_damage",
              "motor_third_party",
              "motor_theft",
              "other"
            ]
          },
          "claimTypeLabel": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "reported",
              "documents_pending",
              "submitted",
              "under_review",
              "query_raised",
              "approved",
              "settled",
              "rejected",
              "escalated",
              "closed"
            ]
          },
          "claimNumber": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The insurer's claim number"
          },
          "incidentDate": {
            "type": "string",
            "description": "Date, YYYY-MM-DD"
          },
          "intimatedAt": {
            "anyOf": [
              {
                "type": "string",
                "description": "Date, YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the insurer was told"
          },
          "submittedAt": {
            "anyOf": [
              {
                "type": "string",
                "description": "Date, YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the documents were submitted"
          },
          "surveyReportAt": {
            "anyOf": [
              {
                "type": "string",
                "description": "Date, YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "underInvestigation": {
            "type": "boolean"
          },
          "amountClaimed": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "amountApproved": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "amountSettled": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "settledAt": {
            "anyOf": [
              {
                "type": "string",
                "description": "Date, YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "rejectionReason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "providerName": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Hospital or garage"
          },
          "handlerName": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "TPA, surveyor or insurer officer"
          },
          "handlerContact": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "nextFollowUpAt": {
            "anyOf": [
              {
                "type": "string",
                "description": "Date, YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "closedAt": {
            "anyOf": [
              {
                "type": "string",
                "description": "Date, YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "deadlines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "rule": {
                  "type": "string",
                  "description": "The IRDAI timeline in words"
                },
                "startsOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "description": "Date, YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "The date the clock starts from; null until you enter it"
                },
                "dueOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "description": "Date, YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "daysLeft": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Negative once overdue"
                },
                "state": {
                  "type": "string",
                  "enum": [
                    "waiting",
                    "running",
                    "due_soon",
                    "overdue",
                    "stopped"
                  ]
                },
                "interestDue": {
                  "type": "boolean",
                  "description": "True once overdue: interest at the bank rate plus 2% is payable"
                }
              },
              "required": [
                "key",
                "label",
                "rule",
                "startsOn",
                "dueOn",
                "daysLeft",
                "state",
                "interestDue"
              ],
              "additionalProperties": false,
              "description": "An insurer deadline worked out from the claim's dates."
            }
          },
          "createdAt": {
            "type": "string",
            "description": "ISO 8601 timestamp, UTC"
          },
          "updatedAt": {
            "type": "string",
            "description": "ISO 8601 timestamp, UTC"
          }
        },
        "required": [
          "id",
          "policyId",
          "customerId",
          "agencyId",
          "claimType",
          "claimTypeLabel",
          "status",
          "claimNumber",
          "incidentDate",
          "intimatedAt",
          "submittedAt",
          "surveyReportAt",
          "underInvestigation",
          "amountClaimed",
          "amountApproved",
          "amountSettled",
          "settledAt",
          "rejectionReason",
          "providerName",
          "handlerName",
          "handlerContact",
          "description",
          "nextFollowUpAt",
          "closedAt",
          "deadlines",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false,
        "description": "A claim being tracked."
      },
      "ClaimEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Polisync id of the timeline entry"
          },
          "type": {
            "type": "string",
            "enum": [
              "created",
              "status_change",
              "note",
              "call",
              "follow_up",
              "document_added",
              "document_removed",
              "field_update"
            ]
          },
          "fromStatus": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "toStatus": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "note": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "description": "ISO 8601 timestamp, UTC"
          }
        },
        "required": [
          "id",
          "type",
          "fromStatus",
          "toStatus",
          "note",
          "createdAt"
        ],
        "additionalProperties": false,
        "description": "One entry in a claim's timeline."
      },
      "Me": {
        "type": "object",
        "properties": {
          "workspace": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "plan": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "key": {
            "type": "object",
            "properties": {
              "name": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "prefix": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "expiresAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "description": "ISO 8601 timestamp, UTC"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "scopes": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "name",
              "prefix",
              "expiresAt",
              "scopes"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "workspace",
          "plan",
          "key"
        ],
        "additionalProperties": false,
        "description": "The workspace and API key making the request."
      },
      "Error": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "const": false
          },
          "error": {
            "type": "string",
            "description": "A message for people. It may change; do not match on it."
          },
          "code": {
            "type": "string",
            "description": "A stable code to match on, such as validation_error"
          },
          "details": {
            "description": "Per-field problems, on validation errors",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              },
              "required": [
                "field",
                "message"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "success",
          "error",
          "code"
        ],
        "additionalProperties": false,
        "description": "Every failed request returns this shape."
      },
      "Pagination": {
        "type": "object",
        "properties": {
          "total": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "page": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "limit": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "totalPages": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "total",
          "page",
          "limit",
          "totalPages"
        ],
        "additionalProperties": false
      },
      "WebhookEvent": {
        "type": "object",
        "description": "The envelope of every webhook request body.",
        "required": [
          "id",
          "type",
          "createdAt",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Event id, evt_... The same on retries."
          },
          "type": {
            "type": "string",
            "enum": [
              "ping",
              "customer.created",
              "customer.updated",
              "customer.deleted",
              "policy.created",
              "policy.updated",
              "policy.deleted",
              "policy.expiring",
              "renewal.recorded",
              "renewal.lapsed",
              "claim.created",
              "claim.status_changed",
              "claim.follow_up_due",
              "claim.deadline_overdue"
            ]
          },
          "createdAt": {
            "type": "string",
            "description": "ISO 8601 timestamp, UTC"
          },
          "data": {
            "type": "object",
            "description": "Event data. Most events carry the changed record as data.object."
          }
        }
      }
    }
  },
  "x-error-codes": [
    {
      "status": 400,
      "code": "invalid_json",
      "meaning": "The request body is not valid JSON."
    },
    {
      "status": 401,
      "code": "unauthorized",
      "meaning": "The API key is missing, invalid, expired or revoked."
    },
    {
      "status": 403,
      "code": "forbidden",
      "meaning": "The key does not have the scope this endpoint needs."
    },
    {
      "status": 403,
      "code": "plan_required",
      "meaning": "The workspace's plan does not include API access (Enterprise)."
    },
    {
      "status": 403,
      "code": "account_suspended",
      "meaning": "The workspace is suspended."
    },
    {
      "status": 404,
      "code": "not_found",
      "meaning": "The record does not exist in your workspace."
    },
    {
      "status": 409,
      "code": "conflict",
      "meaning": "The request clashes with existing data, such as a duplicate policy number."
    },
    {
      "status": 409,
      "code": "idempotency_conflict",
      "meaning": "That Idempotency-Key was already used with a different request."
    },
    {
      "status": 409,
      "code": "idempotency_in_progress",
      "meaning": "A request with that Idempotency-Key is still running. Retry shortly."
    },
    {
      "status": 413,
      "code": "payload_too_large",
      "meaning": "The request body is over 1 MB."
    },
    {
      "status": 422,
      "code": "validation_error",
      "meaning": "A field is missing or invalid. The details array names each one."
    },
    {
      "status": 403,
      "code": "plan_limit_reached",
      "meaning": "Your plan's limit for customers or policies is full."
    },
    {
      "status": 429,
      "code": "rate_limited",
      "meaning": "Too many requests. Wait for the number of seconds in the Retry-After header."
    },
    {
      "status": 500,
      "code": "server_error",
      "meaning": "Something went wrong on our side. Retry; if it persists, contact support."
    }
  ],
  "x-examples": {
    "Customer": {
      "id": "cmv1a2b3c0001xyzcustomer",
      "name": "Ramesh Patel",
      "type": "individual",
      "phone": "+919876543210",
      "altPhone": null,
      "email": "ramesh.patel@gmail.com",
      "dateOfBirth": "1985-03-14",
      "gender": "male",
      "address": "12 Shanti Nagar",
      "city": "Surat",
      "state": "Gujarat",
      "pin": "395007",
      "country": "IN",
      "pan": "ABCDE****F",
      "agencyId": "cmv1a2b3c0002xyzagency",
      "status": "active",
      "consentGiven": true,
      "consentDate": "2026-10-26T09:30:00.000Z",
      "createdAt": "2026-10-26T09:30:00.000Z",
      "updatedAt": "2026-10-26T09:30:00.000Z"
    },
    "Nominee": {
      "id": "cmv1a2b3c0004xyznominee",
      "name": "Sunita Patel",
      "dateOfBirth": "1988-07-02",
      "relation": "spouse",
      "sharePercent": 100,
      "phone": "+919876500001"
    },
    "Policy": {
      "id": "cmv1a2b3c0003xyzpolicy",
      "policyNumber": "HLT-2026-004512",
      "insuranceType": "health",
      "customerId": "cmv1a2b3c0001xyzcustomer",
      "agencyId": "cmv1a2b3c0002xyzagency",
      "insurerId": "cmr23hrx5000nxemeinsurer",
      "insurerName": "Star Health and Allied Insurance Co. Ltd.",
      "planName": "Family Health Optima",
      "premium": 18500,
      "sumInsured": 1000000,
      "firstYearCommission": 2775,
      "startDate": "2026-11-01",
      "expiryDate": "2027-10-31",
      "paymentMode": "annual",
      "status": "active",
      "notes": null,
      "typeFields": {},
      "nominees": [
        {
          "id": "cmv1a2b3c0004xyznominee",
          "name": "Sunita Patel",
          "dateOfBirth": "1988-07-02",
          "relation": "spouse",
          "sharePercent": 100,
          "phone": "+919876500001"
        }
      ],
      "createdAt": "2026-10-26T09:41:00.000Z",
      "updatedAt": "2026-10-26T09:41:00.000Z"
    },
    "Agency": {
      "id": "cmv1a2b3c0002xyzagency",
      "name": "Patel Insurance Services",
      "type": "non_corporate",
      "agentName": "Ramesh Patel",
      "agentCode": "AG-10442",
      "insurerId": null,
      "address": "Ring Road",
      "city": "Surat",
      "state": "Gujarat",
      "pin": "395002",
      "country": "IN",
      "status": "active",
      "createdAt": "2026-01-12T05:00:00.000Z",
      "updatedAt": "2026-01-12T05:00:00.000Z"
    },
    "Insurer": {
      "id": "cmr23hrx5000nxemeinsurer",
      "name": "Star Health and Allied Insurance Co. Ltd.",
      "types": [
        "health"
      ],
      "website": "https://www.starhealth.in",
      "supportEmail": null,
      "carePhone": null,
      "status": "active"
    },
    "Renewal": {
      "id": "cmv1a2b3c0005xyzrenewal",
      "policyId": "cmv1a2b3c0003xyzpolicy",
      "policyNumber": "HLT-2026-004512",
      "customerId": "cmv1a2b3c0001xyzcustomer",
      "insuranceType": "health",
      "expiryDate": "2027-10-31",
      "daysLeft": 370,
      "status": "active",
      "stage": "upcoming",
      "mode": "reissue",
      "graceDaysLeft": 30,
      "renewedAt": null,
      "renewedPolicyId": null,
      "commissionEarned": null,
      "createdAt": "2026-10-26T09:41:00.000Z",
      "updatedAt": "2026-10-26T09:41:00.000Z"
    },
    "Deadline": {
      "key": "health_reimbursement_settle",
      "label": "Insurer to settle",
      "rule": "Within 15 days of the claim being submitted",
      "startsOn": "2026-10-22",
      "dueOn": "2026-11-06",
      "daysLeft": 11,
      "state": "running",
      "interestDue": false
    },
    "Claim": {
      "id": "cmv1a2b3c0006xyzclaim",
      "policyId": "cmv1a2b3c0003xyzpolicy",
      "customerId": "cmv1a2b3c0001xyzcustomer",
      "agencyId": "cmv1a2b3c0002xyzagency",
      "claimType": "health_reimbursement",
      "claimTypeLabel": "Health: reimbursement",
      "status": "submitted",
      "claimNumber": "CLM-884213",
      "incidentDate": "2026-10-20",
      "intimatedAt": "2026-10-21",
      "submittedAt": "2026-10-22",
      "surveyReportAt": null,
      "underInvestigation": false,
      "amountClaimed": 85000,
      "amountApproved": null,
      "amountSettled": null,
      "settledAt": null,
      "rejectionReason": null,
      "providerName": "City Hospital",
      "handlerName": null,
      "handlerContact": null,
      "description": "Hospitalised for 3 days",
      "nextFollowUpAt": "2026-10-30",
      "closedAt": null,
      "deadlines": [
        {
          "key": "health_reimbursement_settle",
          "label": "Insurer to settle",
          "rule": "Within 15 days of the claim being submitted",
          "startsOn": "2026-10-22",
          "dueOn": "2026-11-06",
          "daysLeft": 11,
          "state": "running",
          "interestDue": false
        }
      ],
      "createdAt": "2026-10-21T08:15:00.000Z",
      "updatedAt": "2026-10-22T10:02:00.000Z"
    },
    "ClaimEvent": {
      "id": "cmv1a2b3c0007xyzevent",
      "type": "status_change",
      "fromStatus": "reported",
      "toStatus": "submitted",
      "note": "Submitted to the TPA",
      "createdAt": "2026-10-22T10:02:00.000Z"
    },
    "Me": {
      "workspace": "Patel Insurance Services",
      "plan": "Enterprise",
      "key": {
        "name": "Website enquiry form",
        "prefix": "psk_live_ab12",
        "expiresAt": "2027-01-24T00:00:00.000Z",
        "scopes": [
          "customer:read",
          "customer:create",
          "policy:read"
        ]
      }
    }
  }
}