{
  "openapi": "3.0.3",
  "info": {
    "title": "CasePrimus.ai API",
    "description": "Monitor litigation across India for the companies and people you work with. Use this API to keep a watchlist of entities, review the court cases discovered for them, track monitored cases, look up a single case on demand, and search a company's court-case history.\n\n**Authentication.** Send your API key in the `X-CasePrimus-Api-Key` header. Create keys from the Developer console in your CasePrimus.ai dashboard.\n\n**Rate limit.** Your plan allows a number of API requests per minute (300 unless your plan says otherwise), counted per account across all of your API keys. Most calls count as 1 request. Actions that fetch live court data (case lookup, order download, summarization, discovery, refresh, export) count as 10, and bulk imports count as 50. Every response carries `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. Over the limit you get `429` with `Retry-After` (seconds); wait that long and retry. The Historical Search API has its own limit, described on its endpoints.\n\n**Products.** Your plan includes some or all of Watchlist, Live Case Lookup, Order Downloads, AI Summaries and Historical Search. A call to a product your plan does not include is refused with `403` `PRODUCT_NOT_IN_PLAN` (code 61470); nothing is charged. Contact CasePrimus to add it to your plan.\n",
    "version": "1.0.0",
    "x-source-hash": "7d433ecaa7cdddac"
  },
  "servers": [
    {
      "url": "https://api.caseprimus.ai/api/caseprimus/v1",
      "description": "Production"
    }
  ],
  "security": [
    {
      "apiKeyAuth": []
    }
  ],
  "tags": [
    {
      "name": "Watchlist",
      "description": "Companies/persons being monitored, the cases discovered/tracked against them, and the review queue candidates sit in before becoming a real tracked case."
    },
    {
      "name": "Live Case Lookup",
      "description": "One-time, on-demand case lookups by case number/CNR - no ongoing monitoring, no watchlist entity required. Includes per-order document fetch and an AI case summary, both billed independently of adding the case to the watchlist (which still downloads and summarizes every order automatically, via the Watchlist endpoints above)."
    },
    {
      "name": "Historical Search",
      "description": "Search a company's court-case history without adding it to a watchlist. A search returns its first 100 cases in the same call, with a `searchId` and a `nextPageToken`; each further call returns the next 100. A page is fetched only when it is asked for, and a case is never returned twice. Results are deleted 7 days after the search is created. Billed per delivered page or per search, depending on the account's plan.\n"
    }
  ],
  "paths": {
    "/watchlist/entities": {
      "post": {
        "tags": [
          "Watchlist"
        ],
        "summary": "Add entity to watchlist",
        "description": "Adds a company or person to the account's watchlist. For a BUSINESS entity, this also generates AI name variations to search for (best-effort, it never blocks the response) and, if fetchHistoricalCases is true, starts a one-time historical court-case lookup across our verification data partners. The lookup runs in the background: results arrive later as candidates, readable through POST /watchlist/entities/{id}/candidates/search, not in this response. Requires watchlist.write.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateEntityRequest"
              },
              "examples": {
                "default": {
                  "summary": "Example",
                  "value": {
                    "name": "MakeMyTrip India Private Limited",
                    "entityType": "BUSINESS",
                    "monitoredCourts": [
                      "ALL"
                    ],
                    "fetchHistoricalCases": true
                  }
                },
                "success": {
                  "summary": "Success",
                  "value": {
                    "name": "Acme Traders Pvt Ltd",
                    "entityType": "BUSINESS",
                    "monitoredCourts": [
                      "ALL"
                    ],
                    "fetchHistoricalCases": false
                  }
                },
                "malformed_input": {
                  "summary": "Error: malformed input",
                  "value": {
                    "name": "S",
                    "entityType": "BUSINESS"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Entity created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateEntityResponse"
                },
                "examples": {
                  "success": {
                    "summary": "Success",
                    "value": {
                      "_id": "CPWLE0exampledemo0001"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "default": {
                    "summary": "Example",
                    "value": {
                      "httpStatusCode": 400,
                      "code": 60001,
                      "message": "Malformed data or missing required parameter values",
                      "appError": true
                    }
                  },
                  "malformed_input": {
                    "summary": "Error: malformed input",
                    "value": {
                      "httpStatusCode": 400,
                      "code": 60001,
                      "message": "Malformed data or missing required parameter values",
                      "appError": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing/invalid/expired access token."
          },
          "403": {
            "description": "Caller lacks the watchlist.write permission."
          }
        },
        "operationId": "addEntityToWatchlist",
        "x-slug": "add-entity-to-watchlist",
        "x-group": "Watchlist"
      }
    },
    "/watchlist/entities/search": {
      "post": {
        "tags": [
          "Watchlist"
        ],
        "summary": "Search watchlist entities",
        "description": "Searches the watchlist entities you can see: those in your account and those shared with you. Archived entities are not returned. Use $filter for exact matches (for example status), $like for case-insensitive substring matches on a field such as name, $sort to order the results, and $skip with $limit (up to 100) to page through them. Requires watchlist.read.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SearchRequest"
              },
              "examples": {
                "success": {
                  "summary": "Success",
                  "value": {
                    "$filter": {},
                    "$skip": 0,
                    "$limit": 10
                  }
                },
                "no_matches": {
                  "summary": "No matches",
                  "value": {
                    "$like": {
                      "name": "no-such-company"
                    },
                    "$skip": 0,
                    "$limit": 10
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Matching entities.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EntitySearchResponse"
                },
                "examples": {
                  "success": {
                    "summary": "Success",
                    "value": {
                      "recordsFiltered": 1,
                      "records": [
                        {
                          "_id": "CPWLE0exampledemo0001",
                          "number": 100001,
                          "accountId": "CPA0exampledemo0001",
                          "name": "Acme Traders Pvt Ltd",
                          "entityType": "BUSINESS",
                          "fatherName": null,
                          "birthDate": null,
                          "location": "Mumbai, Maharashtra",
                          "registrationNumber": "U12345MH2015PTC100001",
                          "monitoredCourts": [
                            "ALL"
                          ],
                          "status": "ACTIVE",
                          "nameVariations": [],
                          "lastCourtSyncAt": 1757500000000,
                          "sharedWith": [],
                          "created": 1757000000000,
                          "createdBy": "CPU0exampledemo0001",
                          "updated": null,
                          "updatedBy": null
                        }
                      ]
                    }
                  },
                  "no_matches": {
                    "summary": "No matches",
                    "value": {
                      "recordsFiltered": 0,
                      "records": []
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Caller lacks the watchlist.read permission."
          }
        },
        "operationId": "searchWatchlistEntities",
        "x-slug": "search-watchlist-entities",
        "x-group": "Watchlist"
      }
    },
    "/watchlist/entities/{id}": {
      "get": {
        "tags": [
          "Watchlist"
        ],
        "summary": "Get a watchlist entity",
        "description": "Returns a single watchlist entity by its id, including risk fields computed from its active cases. You can read entities that belong to your account or have been shared with you or your team.\n",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "CPWLE0abc123"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The entity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WatchlistEntityDetail"
                },
                "examples": {
                  "success": {
                    "summary": "Success",
                    "value": {
                      "_id": "CPWLE0exampledemo0001",
                      "number": 100001,
                      "accountId": "CPA0exampledemo0001",
                      "name": "Acme Traders Pvt Ltd",
                      "entityType": "BUSINESS",
                      "fatherName": null,
                      "birthDate": null,
                      "location": "Mumbai, Maharashtra",
                      "registrationNumber": "U12345MH2015PTC100001",
                      "monitoredCourts": [
                        "ALL"
                      ],
                      "status": "ACTIVE",
                      "nameVariations": [
                        "Acme Traders Private Limited",
                        "Acme Traders"
                      ],
                      "lastCourtSyncAt": 1757500000000,
                      "sharedWith": [],
                      "created": 1757000000000,
                      "createdBy": "CPU0exampledemo0001",
                      "updated": null,
                      "updatedBy": null,
                      "riskLevel": "MODERATE",
                      "riskCounts": {
                        "VERY_HIGH": 0,
                        "HIGH": 1,
                        "MODERATE": 2,
                        "LOW": 1,
                        "UNCLASSIFIED": 0
                      },
                      "caseCount": 4
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Entity does not exist.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "Error: entity not found",
                    "value": {
                      "httpStatusCode": 400,
                      "code": 60400,
                      "message": "Watchlist entity does not exist",
                      "appError": true
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "This entity has not been shared with you."
          }
        },
        "operationId": "getAWatchlistEntity",
        "x-slug": "get-a-watchlist-entity",
        "x-group": "Watchlist"
      },
      "put": {
        "tags": [
          "Watchlist"
        ],
        "summary": "Update a watchlist entity",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "CPWLE0abc123"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateEntityRequest"
              },
              "examples": {
                "success": {
                  "summary": "Success",
                  "value": {
                    "name": "Acme Traders Pvt Ltd",
                    "entityType": "BUSINESS",
                    "location": "Bengaluru",
                    "Karnataka": null
                  }
                },
                "not_found": {
                  "summary": "Error: entity not found",
                  "value": {
                    "name": "Acme Traders Pvt Ltd",
                    "entityType": "BUSINESS"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Entity updated.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "examples": {
                  "success": {
                    "summary": "Success",
                    "value": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Entity does not exist, or malformed input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "Error: entity not found",
                    "value": {
                      "httpStatusCode": 400,
                      "code": 60400,
                      "message": "Watchlist entity does not exist",
                      "appError": true
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "This entity has not been shared with you."
          }
        },
        "description": "Updates the details of a watchlist entity. name and entityType are required. Send every optional detail you want to keep: optional fields you leave out, such as fatherName, birthDate, location, registrationNumber and monitoredCourts, are cleared. Requires watchlist.write.\n",
        "operationId": "updateAWatchlistEntity",
        "x-slug": "update-a-watchlist-entity",
        "x-group": "Watchlist"
      },
      "delete": {
        "tags": [
          "Watchlist"
        ],
        "summary": "Stop monitoring an entity",
        "description": "Stops monitoring an entity. The entity is archived: it is kept for audit and not physically removed, and it no longer appears in entity searches.\n",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "CPWLE0abc123"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Entity archived.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "examples": {
                  "success": {
                    "summary": "Success",
                    "value": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Entity does not exist.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "Error: entity not found",
                    "value": {
                      "httpStatusCode": 400,
                      "code": 60400,
                      "message": "Watchlist entity does not exist",
                      "appError": true
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "This entity has not been shared with you."
          }
        },
        "operationId": "stopMonitoringAnEntity",
        "x-slug": "stop-monitoring-an-entity",
        "x-group": "Watchlist"
      }
    },
    "/watchlist/entities/{id}/candidates/search": {
      "post": {
        "tags": [
          "Watchlist"
        ],
        "summary": "Search discovered case candidates for an entity",
        "description": "Customer's own view of court-case candidates found against this company. tab is required:\n  - historical: candidates the customer can decide on directly, no\n    CasePrimus review needed (one-time fetchHistoricalCases results,\n    plus any daily-discovery candidate the customer already declined).\n  - pendingReview: daily-discovery candidates CasePrimus has approved,\n    awaiting the customer's decision.\nCases already added to the watchlist are not a candidates tab at all - list those via POST /watchlist/cases/search instead.\n",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "CPWLE0abc123"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CandidatesSearchRequest"
              },
              "examples": {
                "success": {
                  "summary": "Success",
                  "value": {
                    "tab": "pendingReview",
                    "$skip": 0,
                    "$limit": 10
                  }
                },
                "malformed_input": {
                  "summary": "Error: missing tab",
                  "value": {
                    "$skip": 0,
                    "$limit": 10
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Matching candidates.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CandidateSearchResponse"
                },
                "examples": {
                  "success": {
                    "summary": "Success",
                    "value": {
                      "recordsFiltered": 1,
                      "records": [
                        {
                          "_id": "CPWLCC0exampledemo0001",
                          "number": 400001,
                          "accountId": "CPA0exampledemo0001",
                          "watchlistEntityId": "CPWLE0exampledemo0001",
                          "rawMatch": {
                            "court": "District Court, Delhi",
                            "parties": {
                              "respondent": "Jane Doe"
                            }
                          },
                          "caseIdentifier": {
                            "courtType": "DC",
                            "cnr": "DLCT010098762024"
                          },
                          "status": "APPROVED",
                          "discoveryMode": "ONGOING",
                          "customerDecision": null,
                          "promotedCaseId": null,
                          "created": 1757550000000,
                          "updated": null
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Entity does not exist, or missing/invalid tab.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "malformed_input": {
                    "summary": "Error: missing tab",
                    "value": {
                      "httpStatusCode": 400,
                      "code": 60001,
                      "message": "Malformed data or missing required parameter values",
                      "appError": true
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "This entity has not been shared with you."
          }
        },
        "operationId": "searchDiscoveredCaseCandidatesForAnEntity",
        "x-slug": "search-entity-candidates",
        "x-group": "Watchlist"
      }
    },
    "/watchlist/candidates/{id}/promote": {
      "post": {
        "tags": [
          "Watchlist"
        ],
        "summary": "Add a candidate to the watchlist",
        "description": "Confirms a discovered case candidate as a tracked case. The case becomes ACTIVE and starts being monitored; if it is already tracked, the existing record is linked instead of duplicated. A candidate can be confirmed when it came from a historical search (discoveryMode HISTORICAL), or from ongoing monitoring (discoveryMode ONGOING) once CasePrimus has approved it (status APPROVED). Available on accounts where your own team reviews new cases. Where the CasePrimus team reviews new cases for you, they confirm candidates instead.\n",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "CPWLCC0abc123"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Candidate promoted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "caseId": {
                      "type": "string",
                      "example": "CPWLC0abc123"
                    },
                    "linkedExisting": {
                      "type": "boolean",
                      "description": "true if this case was already tracked (possibly against a different company) and this entity was just linked to it, rather than a new case being created."
                    }
                  }
                },
                "examples": {
                  "success": {
                    "summary": "Success",
                    "value": {
                      "caseId": "CPWLC0exampledemo0002",
                      "linkedExisting": false
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Candidate does not exist, is not approved yet, or has already been promoted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "notApproved": {
                    "value": {
                      "httpStatusCode": 400,
                      "code": 60411,
                      "message": "This candidate has not been approved yet",
                      "appError": true
                    }
                  },
                  "alreadyPromoted": {
                    "value": {
                      "httpStatusCode": 400,
                      "code": 60412,
                      "message": "This candidate has already been added to the watchlist",
                      "appError": true
                    }
                  },
                  "already_promoted": {
                    "summary": "Error: already promoted",
                    "value": {
                      "httpStatusCode": 400,
                      "code": 60412,
                      "message": "This candidate has already been added to the watchlist",
                      "appError": true
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "The entity this candidate belongs to has not been shared with you, or the CasePrimus team does this for your account instead.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "httpStatusCode": 403,
                  "code": 60413,
                  "message": "Adding this candidate to the watchlist is not allowed for your account's monitoring pack",
                  "appError": true
                }
              }
            }
          }
        },
        "operationId": "addACandidateToTheWatchlist",
        "x-slug": "add-a-candidate-to-the-watchlist",
        "x-group": "Watchlist"
      }
    },
    "/watchlist/candidates/{id}/decline": {
      "post": {
        "tags": [
          "Watchlist"
        ],
        "summary": "Decline a candidate",
        "description": "Declines a discovered case candidate: your \"no\" to it. The candidate moves to the historical tab rather than being removed, so it stays visible. Available on accounts where your own team reviews new cases, with the same eligibility as confirming a candidate. A candidate can only be decided once.\n",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "CPWLCC0abc123"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Candidate declined.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "examples": {
                  "success": {
                    "summary": "Success",
                    "value": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Candidate does not exist, is not approved yet, or has already been decided on.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "default": {
                    "summary": "Example",
                    "value": {
                      "httpStatusCode": 400,
                      "code": 60415,
                      "message": "You've already made a decision on this candidate",
                      "appError": true
                    }
                  },
                  "already_decided": {
                    "summary": "Error: already decided",
                    "value": {
                      "httpStatusCode": 400,
                      "code": 60415,
                      "message": "You've already made a decision on this candidate",
                      "appError": true
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "The entity this candidate belongs to has not been shared with you, or the CasePrimus team does this for your account instead."
          }
        },
        "operationId": "declineACandidate",
        "x-slug": "decline-a-candidate",
        "x-group": "Watchlist"
      }
    },
    "/watchlist/cases": {
      "post": {
        "tags": [
          "Watchlist"
        ],
        "summary": "Add a case to the watchlist",
        "description": "Adds a case to the watchlist, either manually or by confirming a match from a case search (pass its result as snapshot). If the same case is already tracked, identified by its case identifier, the entity is linked to the existing record instead of creating a duplicate, and the response has linkedExisting true. On accounts where the CasePrimus team reviews new cases, a newly created case starts as PENDING_BACKOFFICE_REVIEW instead of ACTIVE until it is reviewed. Requires case.write.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCaseRequest"
              },
              "examples": {
                "success": {
                  "summary": "Success",
                  "value": {
                    "caseIdentifier": {
                      "courtType": "DC",
                      "cnr": "DLCT010012342020"
                    },
                    "watchlistEntityId": "CPWLE0exampledemo0001"
                  }
                },
                "entity_not_found": {
                  "summary": "Error: referenced entity not found",
                  "value": {
                    "caseIdentifier": {
                      "courtType": "DC",
                      "cnr": "DLCT010012342020"
                    },
                    "watchlistEntityId": "CPWLE0doesnotexist"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Case added (or linked to an existing tracked case).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateCaseResponse"
                },
                "examples": {
                  "success": {
                    "summary": "Success",
                    "value": {
                      "_id": "CPWLC0exampledemo0001",
                      "status": "ACTIVE",
                      "linkedExisting": false
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed input, or the referenced watchlistEntityId does not exist.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "entity_not_found": {
                    "summary": "Error: referenced entity not found",
                    "value": {
                      "httpStatusCode": 400,
                      "code": 60400,
                      "message": "Watchlist entity does not exist",
                      "appError": true
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Caller lacks the case.write permission."
          }
        },
        "operationId": "addACaseToTheWatchlist",
        "x-slug": "add-a-case-to-the-watchlist",
        "x-group": "Watchlist"
      }
    },
    "/case-lookup": {
      "post": {
        "tags": [
          "Live Case Lookup"
        ],
        "summary": "Look up a case by its identifier",
        "description": "Direct case-number/CNR lookup - one-time, on-demand, not tied to any watchlist entity. The required identifier fields depend on courtType, see CaseIdentifier. Every order on the case is tagged with an `orderId` (stable for this search) - use it with POST /case-lookup/orders/download to get that order's document. `attachment` is always null on this response - the raw court-site reference is never exposed directly, only orderId is. The full result (including this searchId) is stored so the order downloads can look orders up later without re-running the lookup - see CasePrimusCaseSearchHistory. `latestSummary` is the most recently generated AI summary for this case (see POST /case-lookup/summarize), or null if none has ever been generated - a fresh lookup/refresh doesn't clear a previously generated summary. Requires case.write (no resource to scope a team override against, same as /watchlist/cases).\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "caseIdentifier"
                ],
                "properties": {
                  "caseIdentifier": {
                    "$ref": "#/components/schemas/CaseIdentifier"
                  }
                }
              },
              "examples": {
                "success": {
                  "summary": "Success",
                  "value": {
                    "caseIdentifier": {
                      "courtType": "DC",
                      "cnr": "DLCT010012342020"
                    }
                  }
                },
                "lookup_failed": {
                  "summary": "Error: lookup failed",
                  "value": {
                    "caseIdentifier": {
                      "courtType": "DC",
                      "cnr": "DLCT099999999999"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Case details found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "The unified case details for the case, plus a top-level searchId, a latestSummary (nullable), and an orderId on every order.",
                  "additionalProperties": true
                },
                "examples": {
                  "success": {
                    "summary": "Success",
                    "value": {
                      "searchId": "CPCSH0exampledemo0001",
                      "latestSummary": null,
                      "cnr": "DLCT010012342020",
                      "courtType": "DC",
                      "parties": {
                        "petitioner": "Acme Traders Pvt Ltd",
                        "respondent": "Jane Doe"
                      },
                      "court": "District Court, Delhi",
                      "stage": "Arguments",
                      "filingDate": "10-01-2020",
                      "orders": [
                        {
                          "orderId": "a1b2c3d4e5f6",
                          "number": "3",
                          "orderDate": "16-05-2017",
                          "judge": "Hon'ble Judge Example",
                          "orderType": null,
                          "attachment": null
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed caseIdentifier for the given courtType.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Caller lacks the case.write permission."
          },
          "500": {
            "description": "The underlying case lookup failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "default": {
                    "summary": "Example",
                    "value": {
                      "httpStatusCode": 500,
                      "code": 60406,
                      "message": "Could not look up this case right now, please try again shortly",
                      "appError": true
                    }
                  },
                  "lookup_failed": {
                    "summary": "Error: lookup failed",
                    "value": {
                      "httpStatusCode": 500,
                      "code": 60406,
                      "message": "Could not look up this case right now, please try again shortly",
                      "appError": true
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "lookUpACaseByItsIdentifier",
        "x-slug": "look-up-a-case-by-its-identifier",
        "x-group": "Live Case Lookup"
      }
    },
    "/case-lookup/orders/download": {
      "post": {
        "tags": [
          "Live Case Lookup"
        ],
        "summary": "Download Case Order",
        "description": "Returns a link to ONE order's document - the same answer for every court. Pass the `searchId` a prior POST /case-lookup call returned and the `orderId` (from that response's `orders[]`). The `url` is a short-lived (5 minutes) signed link to CasePrimus's own private storage, generated fresh on every call - never store it. Requires case.write. The order also appears in the account's Downloads panel.\n\nThe document is the court's order with a **CasePrimus provenance strip down the left margin of every page**: CasePrimus, the case, when it was retrieved, a reference (`CP-...`) that identifies the retrieval in CasePrimus's records, and a plain statement that it is **not a certified copy**. Nothing else on the page is changed.\n\nDistrict Court orders, and orders already downloaded, answer at once. For every other court (High Court, Supreme Court, consumer commissions, NCLT, NCLAT, GSTAT, DRT, DRAT, CESTAT) the document can only be fetched inside a court-site session, so it is downloaded by a background function and this call **waits for it** (up to 55 seconds; a failed court search is retried a few times automatically). You never get a job to poll from this endpoint: you get the `url`, or an error.\n\nErrors: **503** `ORDER_DOWNLOAD_NOT_READY` (with `Retry-After`) if the court download is still running after 55 seconds - send the SAME request again; it joins the download that is already running, so nothing is fetched or charged twice. **422** `ORDER_DOWNLOAD_FAILED` if the court has no document for the order (`details.reason` says why). **404** `ORDER_NOT_FOUND` if the `orderId` is not one of that case's orders.\n\nBilling: for District Court one order-download unit is counted per request; for the other courts a unit is counted only when the order is actually delivered, and asking again for an order already downloaded is not counted again.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "searchId",
                  "orderId"
                ],
                "properties": {
                  "searchId": {
                    "type": "string",
                    "example": "CPCSH0exampledemo0001"
                  },
                  "orderId": {
                    "type": "string",
                    "example": "a1b2c3d4e5f6"
                  }
                }
              },
              "examples": {
                "success": {
                  "summary": "Success: the link",
                  "value": {
                    "searchId": "CPCSH0exampledemo0001",
                    "orderId": "a1b2c3d4e5f6"
                  }
                },
                "not_ready": {
                  "summary": "503: the court download is still running - send the same request again",
                  "value": {
                    "searchId": "CPCSH0exampledemo0001",
                    "orderId": "b2c3d4e5f6a1"
                  }
                },
                "download_failed": {
                  "summary": "422: the court has no document for this order",
                  "value": {
                    "searchId": "CPCSH0exampledemo0001",
                    "orderId": "c3d4e5f6a1b2"
                  }
                },
                "order_not_found": {
                  "summary": "Error: not an order of this case",
                  "value": {
                    "searchId": "CPCSH0exampledemo0001",
                    "orderId": "notanorder"
                  }
                },
                "search_not_found": {
                  "summary": "Error: search record not found",
                  "value": {
                    "searchId": "CPCSH0doesnotexist",
                    "orderId": "a1b2c3d4e5f6"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The order's document.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "orderId": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string",
                      "description": "Signed link, valid for 5 minutes. Never store it."
                    }
                  }
                },
                "examples": {
                  "success": {
                    "summary": "Success: the link",
                    "value": {
                      "orderId": "a1b2c3d4e5f6",
                      "url": "https://files.example.com/dlct010012342020-9f8e7d6c5b4a.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Expires=300&X-Amz-Signature=..."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed input, this search record does not exist, or this court's orders cannot be downloaded right now.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "search_not_found": {
                    "summary": "Error: search record not found",
                    "value": {
                      "httpStatusCode": 400,
                      "code": 60436,
                      "message": "This search record does not exist",
                      "appError": true
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Caller lacks the case.write permission."
          },
          "404": {
            "description": "The orderId is not one of this case's orders.",
            "content": {
              "application/json": {
                "examples": {
                  "order_not_found": {
                    "summary": "Error: not an order of this case",
                    "value": {
                      "httpStatusCode": 404,
                      "code": 60434,
                      "message": "No matching order was found for the number and date provided",
                      "appError": true
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "The court has no document for this order (`details.reason`).",
            "content": {
              "application/json": {
                "examples": {
                  "download_failed": {
                    "summary": "422: the court has no document for this order",
                    "value": {
                      "httpStatusCode": 422,
                      "code": 60433,
                      "message": "Could not download this order right now, please try again shortly",
                      "appError": true,
                      "details": {
                        "reason": "The court site did not provide a document for this order"
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Still being downloaded after 55 seconds. Send the same request again (`Retry-After`).",
            "content": {
              "application/json": {
                "examples": {
                  "not_ready": {
                    "summary": "503: the court download is still running - send the same request again",
                    "value": {
                      "httpStatusCode": 503,
                      "code": 61469,
                      "message": "This order is still being downloaded from the court. Send the same request again in a few seconds - nothing is charged until it is delivered",
                      "appError": true,
                      "details": {
                        "retryAfterSeconds": 5
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "downloadCaseOrder",
        "x-slug": "download-case-order",
        "x-group": "Live Case Lookup"
      }
    },
    "/case-lookup/summarize": {
      "post": {
        "tags": [
          "Live Case Lookup"
        ],
        "summary": "Generate an AI case summary and risk level, on demand",
        "description": "CasePrimus's AI summarization - resolves every order's document itself and produces a case summary, risk justification, and risk level, for a case that's only been looked up via POST /case-lookup, not added to the watchlist. Takes the searchId from that lookup (or GET /case-lookup/{searchId}) - reads the already-fetched case details straight off that record rather than re-fetching live. Returns immediately with an `_id` - poll GET /case-lookup/summarize/{id} for the result. Every call starts a new summary (use this again to regenerate) - the most recently generated one for a case is also returned as `latestSummary` on POST /case-lookup and GET /case-lookup/{searchId} themselves, so a customer doesn't need to keep track of summary ids across requests. Requires case.write.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "searchId"
                ],
                "properties": {
                  "searchId": {
                    "type": "string",
                    "description": "The _id returned by POST /case-lookup or GET /case-lookup/{searchId}."
                  }
                }
              },
              "examples": {
                "success": {
                  "summary": "Success",
                  "value": {
                    "searchId": "CPCSH0exampledemo0001"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Summarization job queued (or completed immediately for a case with no orders to read).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "PENDING",
                        "COMPLETE",
                        "FAILED"
                      ]
                    }
                  }
                },
                "examples": {
                  "success": {
                    "summary": "Success",
                    "value": {
                      "_id": "CPCSS0exampledemo0001",
                      "status": "PENDING"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed input, or the underlying case lookup failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Caller lacks the case.write permission."
          }
        },
        "operationId": "generateAnAiCaseSummaryAndRiskLevelOnDemand",
        "x-slug": "generate-ai-case-summary",
        "x-group": "Live Case Lookup"
      }
    },
    "/case-lookup/summarize/{id}": {
      "get": {
        "tags": [
          "Live Case Lookup"
        ],
        "summary": "Poll an on-demand case summary",
        "description": "orderSummaries/riskLevel/caseSummary are returned on every poll (not just once COMPLETE) so per-order progress shows up as each order's own summary finishes. Requires case.read.\n",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current summarization status.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "PENDING",
                        "COMPLETE",
                        "FAILED"
                      ]
                    },
                    "riskLevel": {
                      "type": "string",
                      "nullable": true
                    },
                    "caseSummary": {
                      "type": "string",
                      "nullable": true
                    },
                    "riskJustification": {
                      "type": "string",
                      "nullable": true
                    },
                    "orderSummaries": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "error": {
                      "type": "string",
                      "nullable": true
                    }
                  }
                },
                "examples": {
                  "pending": {
                    "summary": "Still processing",
                    "value": {
                      "_id": "CPCSS0exampledemo0001",
                      "status": "PENDING",
                      "riskLevel": null,
                      "caseSummary": null,
                      "riskJustification": null,
                      "orderSummaries": [
                        {
                          "orderNumber": "1",
                          "status": "COMPLETE",
                          "summary": "Interim order granting a short adjournment."
                        },
                        {
                          "orderNumber": "2",
                          "status": "PENDING"
                        }
                      ],
                      "error": null
                    }
                  },
                  "success": {
                    "summary": "Success",
                    "value": {
                      "_id": "CPCSS0exampledemo0001",
                      "status": "COMPLETE",
                      "riskLevel": "MODERATE",
                      "caseSummary": "A commercial dispute currently at the arguments stage.",
                      "riskJustification": "Multiple interim orders indicate active contestation, but no adverse final order yet.",
                      "orderSummaries": [
                        {
                          "orderNumber": "1",
                          "status": "COMPLETE",
                          "summary": "Interim order granting a short adjournment."
                        }
                      ],
                      "error": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "This summary request does not exist.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "Error: summary request not found",
                    "value": {
                      "httpStatusCode": 400,
                      "code": 60435,
                      "message": "This case summary request does not exist",
                      "appError": true
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Caller lacks the case.read permission."
          }
        },
        "operationId": "pollAnOnDemandCaseSummary",
        "x-slug": "poll-ai-case-summary",
        "x-group": "Live Case Lookup"
      }
    },
    "/case-lookup/case-types": {
      "get": {
        "tags": [
          "Live Case Lookup"
        ],
        "summary": "List case types and benches for a court type",
        "description": "Returns the options for the lookup form's court-specific fields. The identifier you need to provide (establishmentCode, caseType, and so on) varies by courtType. District Courts return an empty array: no bench or case type is needed, the CNR alone is enough. Requires case.read.\n",
        "parameters": [
          {
            "name": "courtType",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "DC",
                "HC",
                "SC",
                "CC",
                "NCLT",
                "NCLAT",
                "GSTAT",
                "DRT",
                "DRAT",
                "CESTAT"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Valid options for this court type.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "state": {
                        "type": "string",
                        "nullable": true
                      },
                      "court": {
                        "type": "string",
                        "nullable": true
                      },
                      "bench": {
                        "type": "string",
                        "nullable": true
                      },
                      "establishmentCode": {
                        "type": "string",
                        "nullable": true
                      },
                      "caseTypes": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "examples": {
                  "success": {
                    "summary": "Success",
                    "value": [
                      {
                        "state": "Delhi",
                        "court": "High Court of Delhi",
                        "bench": "Principal Bench",
                        "establishmentCode": "DLHC01",
                        "caseTypes": [
                          {
                            "name": "Civil Writ Petition",
                            "code": "CWP"
                          }
                        ]
                      }
                    ]
                  }
                }
              }
            }
          },
          "403": {
            "description": "Caller lacks the case.read permission."
          }
        },
        "operationId": "listCaseTypesAndBenchesForACourtType",
        "x-slug": "list-case-types",
        "x-group": "Live Case Lookup"
      }
    },
    "/case-lookup/recent": {
      "get": {
        "tags": [
          "Live Case Lookup"
        ],
        "summary": "Recent case-number lookups",
        "description": "Last 10 DISTINCT cases looked up by anyone on this account (account- wide, not per-user) - one row per case, not per fetch: searching (or Discovery-candidate \"Fetch Live Data\"-ing) the same case again updates fetchCount/lastFetchedAt on the same row rather than adding a new one. Shown inline on the Live Case Lookup page in place of a separate history page. `caseIdentifier` is the original request object (courtType + whichever identifier field that court type needed) - it's what makes a row clickable, resubmitting the exact same lookup rather than guessing one back together from `query`'s display label. Requires case.read.\n",
        "responses": {
          "200": {
            "description": "Up to 10 most recently fetched cases.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string"
                      },
                      "query": {
                        "type": "string"
                      },
                      "caseIdentifier": {
                        "$ref": "#/components/schemas/CaseIdentifier"
                      },
                      "resultCount": {
                        "type": "integer",
                        "nullable": true
                      },
                      "fetchCount": {
                        "type": "integer",
                        "description": "How many times this case has been fetched (Live Case Lookup or a Discovery candidate's Fetch Live Data - same underlying row either way)."
                      },
                      "lastFetchedAt": {
                        "type": "integer",
                        "description": "Epoch ms of the most recent fetch - what the UI actually sorts/displays by."
                      },
                      "created": {
                        "type": "integer",
                        "description": "Epoch ms of the FIRST fetch."
                      }
                    }
                  }
                },
                "examples": {
                  "success": {
                    "summary": "Success",
                    "value": [
                      {
                        "_id": "CPCSH0exampledemo0001",
                        "query": "DLCT010012342020",
                        "caseIdentifier": {
                          "courtType": "DC",
                          "cnr": "DLCT010012342020"
                        },
                        "resultCount": 1,
                        "fetchCount": 3,
                        "lastFetchedAt": 1757000000000,
                        "created": 1756000000000
                      }
                    ]
                  }
                }
              }
            }
          },
          "403": {
            "description": "Caller lacks the case.read permission."
          }
        },
        "operationId": "recentCaseNumberLookups",
        "x-slug": "recent-case-number-lookups",
        "x-group": "Live Case Lookup"
      }
    },
    "/case-lookup/{searchId}": {
      "get": {
        "tags": [
          "Live Case Lookup"
        ],
        "summary": "Read back a previously looked-up case",
        "description": "Reads back a case you looked up earlier, exactly as it was stored. No new lookup is made. Any order you already downloaded comes back with a freshly signed, short-lived download url (valid for 300 seconds) and downloadedAt; an order that was never downloaded has attachment null, as in a fresh lookup. To get current live data instead, call POST /case-lookup again with the same caseIdentifier (a refresh): that updates this record (lastFetchedAt and fetchCount) rather than creating a new one. Requires case.read.\n",
        "parameters": [
          {
            "name": "searchId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The stored case details, as last fetched.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Same shape as POST /case-lookup's own response (including latestSummary), plus lastFetchedAt/fetchCount.",
                  "additionalProperties": true
                },
                "examples": {
                  "success": {
                    "summary": "Success",
                    "value": {
                      "searchId": "CPCSH0exampledemo0001",
                      "lastFetchedAt": 1757000000000,
                      "fetchCount": 2,
                      "latestSummary": {
                        "_id": "CPCSS0exampledemo0001",
                        "status": "COMPLETE",
                        "riskLevel": "MODERATE",
                        "caseSummary": "A commercial dispute currently at the arguments stage.",
                        "riskJustification": "Multiple interim orders indicate active contestation, but no adverse final order yet.",
                        "orderSummaries": [],
                        "error": null,
                        "generatedAt": 1757000000000
                      },
                      "cnr": "DLCT010012342020",
                      "courtType": "DC",
                      "orders": [
                        {
                          "orderId": "a1b2c3d4e5f6",
                          "number": "3",
                          "orderDate": "16-05-2017",
                          "attachment": "https://files.example.com/dlct010012342020-9f8e7d6c5b4a.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Expires=300&X-Amz-Signature=...",
                          "downloadedAt": 1757000000000
                        },
                        {
                          "orderId": "b2c3d4e5f6a1",
                          "number": "4",
                          "orderDate": "20-05-2017",
                          "attachment": null,
                          "downloadedAt": null
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "This search record does not exist.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "Error: search record not found",
                    "value": {
                      "httpStatusCode": 400,
                      "code": 60436,
                      "message": "This search record does not exist",
                      "appError": true
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Caller lacks the case.read permission."
          }
        },
        "operationId": "readBackAPreviouslyLookedUpCase",
        "x-slug": "read-back-a-previously-looked-up-case",
        "x-group": "Live Case Lookup"
      }
    },
    "/watchlist/cases/search": {
      "post": {
        "tags": [
          "Watchlist"
        ],
        "summary": "Search watchlist cases",
        "description": "Requires case.read. Only cases visible to the caller (own + shared) are returned; archived cases are excluded. Also how the \"Monitored\" tab of a company's case list is populated (filter by watchlistEntityIds).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SearchRequest"
              },
              "examples": {
                "default": {
                  "summary": "Example",
                  "value": {
                    "$filter": {
                      "watchlistEntityIds": "CPWLE0abc123"
                    }
                  }
                },
                "success": {
                  "summary": "Success",
                  "value": {
                    "$filter": {
                      "watchlistEntityIds": "CPWLE0exampledemo0001"
                    },
                    "$skip": 0,
                    "$limit": 10
                  }
                },
                "no_matches": {
                  "summary": "No matches",
                  "value": {
                    "$filter": {
                      "watchlistEntityIds": "CPWLE0doesnotexist"
                    },
                    "$skip": 0,
                    "$limit": 10
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Matching cases.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseSearchResponse"
                },
                "examples": {
                  "success": {
                    "summary": "Success",
                    "value": {
                      "recordsFiltered": 1,
                      "records": [
                        {
                          "_id": "CPWLC0exampledemo0001",
                          "number": 200001,
                          "accountId": "CPA0exampledemo0001",
                          "watchlistEntityIds": [
                            "CPWLE0exampledemo0001"
                          ],
                          "caseIdentifier": {
                            "courtType": "DC",
                            "cnr": "DLCT010012342020"
                          },
                          "snapshot": {
                            "parties": {
                              "petitioner": "Acme Traders Pvt Ltd",
                              "respondent": "Jane Doe"
                            },
                            "court": "District Court, Delhi",
                            "stage": "Arguments"
                          },
                          "riskLevel": "MODERATE",
                          "status": "ACTIVE",
                          "reviewedAt": null,
                          "sharedWith": [],
                          "created": 1757000000000,
                          "createdBy": "CPU0exampledemo0001",
                          "updated": null,
                          "updatedBy": null
                        }
                      ]
                    }
                  },
                  "no_matches": {
                    "summary": "No matches",
                    "value": {
                      "recordsFiltered": 0,
                      "records": []
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Caller lacks the case.read permission."
          }
        },
        "operationId": "searchWatchlistCases",
        "x-slug": "search-watchlist-cases",
        "x-group": "Watchlist"
      }
    },
    "/watchlist/cases/{id}": {
      "get": {
        "tags": [
          "Watchlist"
        ],
        "summary": "Get a watchlist case",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "CPWLC0abc123"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The case.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WatchlistCase"
                },
                "examples": {
                  "success": {
                    "summary": "Success",
                    "value": {
                      "_id": "CPWLC0exampledemo0001",
                      "number": 200001,
                      "accountId": "CPA0exampledemo0001",
                      "watchlistEntityIds": [
                        "CPWLE0exampledemo0001"
                      ],
                      "caseIdentifier": {
                        "courtType": "DC",
                        "cnr": "DLCT010012342020"
                      },
                      "snapshot": {
                        "parties": {
                          "petitioner": "Acme Traders Pvt Ltd",
                          "respondent": "Jane Doe"
                        },
                        "court": "District Court, Delhi",
                        "stage": "Arguments"
                      },
                      "riskLevel": "MODERATE",
                      "status": "ACTIVE",
                      "reviewedAt": null,
                      "sharedWith": [],
                      "created": 1757000000000,
                      "createdBy": "CPU0exampledemo0001",
                      "updated": null,
                      "updatedBy": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Case does not exist.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "Error: case not found",
                    "value": {
                      "httpStatusCode": 400,
                      "code": 60401,
                      "message": "Watchlist case does not exist",
                      "appError": true
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "This case has not been shared with you."
          }
        },
        "description": "Returns a single tracked case by its id, including its case identifier, status, risk level and the entities it is linked to.\n",
        "operationId": "getAWatchlistCase",
        "x-slug": "get-a-watchlist-case",
        "x-group": "Watchlist"
      },
      "put": {
        "tags": [
          "Watchlist"
        ],
        "summary": "Update a watchlist case",
        "description": "Changes a case's riskLevel and/or status. For example, change the status to stop tracking a case without fully archiving it, or correct a risk classification by hand.\n",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "CPWLC0abc123"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "riskLevel": {
                    "type": "string",
                    "enum": [
                      "VERY_HIGH",
                      "HIGH",
                      "MODERATE",
                      "LOW",
                      "UNCLASSIFIED"
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "ACTIVE",
                      "PENDING_BACKOFFICE_REVIEW",
                      "REJECTED",
                      "ARCHIVED"
                    ]
                  }
                }
              },
              "examples": {
                "success": {
                  "summary": "Success",
                  "value": {
                    "riskLevel": "HIGH"
                  }
                },
                "not_found": {
                  "summary": "Error: case not found",
                  "value": {
                    "riskLevel": "HIGH"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Case updated.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "examples": {
                  "success": {
                    "summary": "Success",
                    "value": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Case does not exist.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "Error: case not found",
                    "value": {
                      "httpStatusCode": 400,
                      "code": 60401,
                      "message": "Watchlist case does not exist",
                      "appError": true
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "This case has not been shared with you."
          }
        },
        "operationId": "updateAWatchlistCase",
        "x-slug": "update-a-watchlist-case",
        "x-group": "Watchlist"
      },
      "delete": {
        "tags": [
          "Watchlist"
        ],
        "summary": "Stop monitoring a case",
        "description": "Stops monitoring a case. The case is archived rather than physically removed.\n",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "CPWLC0abc123"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Case archived.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "examples": {
                  "success": {
                    "summary": "Success",
                    "value": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Case does not exist.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "not_found": {
                    "summary": "Error: case not found",
                    "value": {
                      "httpStatusCode": 400,
                      "code": 60401,
                      "message": "Watchlist case does not exist",
                      "appError": true
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "This case has not been shared with you."
          }
        },
        "operationId": "stopMonitoringACase",
        "x-slug": "stop-monitoring-a-case",
        "x-group": "Watchlist"
      }
    },
    "/historical-search": {
      "get": {
        "tags": [
          "Historical Search"
        ],
        "summary": "List recent searches",
        "description": "This account's searches, newest first, with their status and counts. Requires historicalSearch.read. Does not contact a data source.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            },
            "description": "How many searches to return."
          }
        ],
        "responses": {
          "200": {
            "description": "Searches.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "searches": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/HistoricalSearchSummary"
                      }
                    }
                  }
                },
                "examples": {
                  "success": {
                    "summary": "Success",
                    "value": {
                      "searches": [
                        {
                          "searchId": "CPHS0exampledemo0001",
                          "mode": "SYNC",
                          "status": "ACTIVE",
                          "name": "Acme Logistics Private Limited",
                          "partyType": "BOTH",
                          "filters": {
                            "caseStatus": "ALL"
                          },
                          "clientReference": "vendor-onboarding-4821",
                          "delivered": 100,
                          "warnings": [],
                          "createdAt": 1791600000000,
                          "expiresAt": 1792204800000
                        },
                        {
                          "searchId": "CPHS0exampledemo0002",
                          "status": "COMPLETE",
                          "name": "Bluestar Foods Limited",
                          "partyType": "BOTH",
                          "filters": {
                            "caseStatus": "ALL"
                          },
                          "clientReference": null,
                          "delivered": 42,
                          "warnings": [],
                          "createdAt": 1791513600000,
                          "expiresAt": 1792118400000
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Caller lacks historicalSearch.read."
          }
        },
        "operationId": "listRecentSearches",
        "x-slug": "list-recent-searches",
        "x-group": "Historical Search"
      },
      "post": {
        "tags": [
          "Historical Search"
        ],
        "summary": "Start a historical search",
        "description": "Starts a search for a company and returns its first page in the same call: exactly 100 cases (fewer only when that is all there is), a `searchId`, and a `nextPageToken` (null when there is nothing more). Requires historicalSearch.write.\n\nOrder: newest filing date first from the primary source; further cases that source did not return follow. A case found by both sources is returned once.\n\nIf the page cannot be assembled within 60 seconds the call returns 503 with `Retry-After`; the error `details` carry the `searchId` and a `nextPageToken` to carry on with. Nothing is delivered or charged in that case. The same `clientReference` with the same request within 24 hours returns the same search and first page again without a new charge.\n\nLimited to the account's requests per minute (default 60): over it, 429 with `Retry-After` and `X-RateLimit-*` headers.\n\n**Asynchronous mode.** Send `\"mode\": \"ASYNC\"` to have the whole result set collected in the background instead of paging it yourself - for when you want everything in one go. The call returns `202` straight away with the `searchId` and `status: RUNNING`; no results yet. When the search finishes its status becomes `COMPLETE` (everything the sources could give, up to the results-per-search cap of your plan) or `FAILED` (nothing is stored and nothing is charged - start it again). Find out by polling `GET /historical-search/{searchId}` or, better, by subscribing a webhook to `historical_search.finished`. Once COMPLETE, read the results page by page (`GET /historical-search/{searchId}/results`, first page = no token) or download them as one JSON file (`GET /historical-search/{searchId}/download`). Reading is free: an asynchronous search is billed once, when it completes, and a failed one is never billed. Results and file are kept for 7 days from completion. Available on per-search plans (or when your plan has it switched on); at most 3 asynchronous searches collect at once per account. `DELETE` on a running search cancels it.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 255,
                    "description": "The company's name."
                  },
                  "entityType": {
                    "type": "string",
                    "enum": [
                      "BUSINESS"
                    ],
                    "description": "BUSINESS only. A person is refused with PERSON_SEARCH_NOT_SUPPORTED."
                  },
                  "registrationNumber": {
                    "type": "string",
                    "nullable": true,
                    "maxLength": 64,
                    "description": "Optional, e.g. CIN. Sharpens matching."
                  },
                  "location": {
                    "type": "string",
                    "nullable": true,
                    "description": "Optional address. Sharpens matching."
                  },
                  "nameVariations": {
                    "type": "array",
                    "maxItems": 25,
                    "items": {
                      "type": "string"
                    },
                    "description": "Other spellings of the name. Added to any generated ones."
                  },
                  "autoNameVariations": {
                    "type": "boolean",
                    "default": true,
                    "description": "Generate further spellings of the name (adds a few seconds to the first call)."
                  },
                  "partyType": {
                    "type": "string",
                    "enum": [
                      "PETITIONER",
                      "RESPONDENT",
                      "BOTH"
                    ],
                    "default": "BOTH",
                    "description": "The side the company must be on."
                  },
                  "filters": {
                    "type": "object",
                    "description": "Fixed for the life of the search. Applied by the data sources, so a narrower search costs less.",
                    "properties": {
                      "fromYear": {
                        "type": "integer",
                        "minimum": 1950,
                        "nullable": true,
                        "description": "Cases filed in this year or later."
                      },
                      "toYear": {
                        "type": "integer",
                        "minimum": 1950,
                        "nullable": true,
                        "description": "Cases filed in this year or earlier."
                      },
                      "caseStatus": {
                        "type": "string",
                        "enum": [
                          "ALL",
                          "PENDING",
                          "DISPOSED"
                        ],
                        "default": "ALL"
                      }
                    }
                  },
                  "clientReference": {
                    "type": "string",
                    "maxLength": 50,
                    "description": "Your own reference. Also makes a repeated start call safe to retry."
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "SYNC",
                      "ASYNC"
                    ],
                    "default": "SYNC",
                    "description": "SYNC (default) returns the first page now and you page through the rest. ASYNC collects every result in the background: the call returns 202 with the searchId and you are told when it is COMPLETE (see the endpoint description). ASYNC needs a plan that has it (per-search plans do); otherwise 403."
                  }
                }
              },
              "examples": {
                "success": {
                  "summary": "First page (3 of the 100 results shown)",
                  "value": {
                    "name": "Acme Logistics Private Limited",
                    "entityType": "BUSINESS",
                    "registrationNumber": "U63090MH2012PTC123456",
                    "partyType": "BOTH",
                    "filters": {
                      "caseStatus": "ALL"
                    },
                    "clientReference": "vendor-onboarding-4821"
                  }
                },
                "filtered_complete": {
                  "summary": "Pending cases from 2020, as respondent - everything fits one page",
                  "value": {
                    "name": "Acme Logistics Private Limited",
                    "partyType": "RESPONDENT",
                    "filters": {
                      "fromYear": 2020,
                      "caseStatus": "PENDING"
                    }
                  }
                },
                "page_not_ready": {
                  "summary": "503: first page not ready in time - carry on with the searchId and nextPageToken",
                  "value": {
                    "name": "Acme Logistics Private Limited",
                    "entityType": "BUSINESS",
                    "registrationNumber": "U63090MH2012PTC123456",
                    "partyType": "BOTH",
                    "filters": {
                      "caseStatus": "ALL"
                    },
                    "clientReference": "vendor-onboarding-4821"
                  }
                },
                "async_started": {
                  "summary": "Asynchronous: accepted - collection runs in the background (202)",
                  "value": {
                    "name": "Acme Logistics Private Limited",
                    "mode": "ASYNC",
                    "partyType": "BOTH",
                    "filters": {
                      "caseStatus": "ALL"
                    },
                    "clientReference": "vendor-onboarding-4821"
                  }
                },
                "async_not_available": {
                  "summary": "Error: asynchronous collection is not available on this plan",
                  "value": {
                    "name": "Acme Logistics Private Limited",
                    "mode": "ASYNC",
                    "partyType": "BOTH",
                    "filters": {
                      "caseStatus": "ALL"
                    },
                    "clientReference": "vendor-onboarding-4821"
                  }
                },
                "async_too_many_running": {
                  "summary": "Error: too many asynchronous searches are still collecting",
                  "value": {
                    "name": "Acme Logistics Private Limited",
                    "mode": "ASYNC",
                    "partyType": "BOTH",
                    "filters": {
                      "caseStatus": "ALL"
                    },
                    "clientReference": "vendor-onboarding-4821"
                  }
                },
                "person_not_supported": {
                  "summary": "Error: a person, not a company",
                  "value": {
                    "name": "Rahul Sharma",
                    "entityType": "PERSON"
                  }
                },
                "invalid_filter": {
                  "summary": "Error: filters not valid",
                  "value": {
                    "name": "Acme Logistics Private Limited",
                    "filters": {
                      "fromYear": 2025,
                      "toYear": 2020
                    }
                  }
                },
                "no_provider": {
                  "summary": "Error: no data source enabled for the account",
                  "value": {
                    "name": "Acme Logistics Private Limited",
                    "entityType": "BUSINESS",
                    "registrationNumber": "U63090MH2012PTC123456",
                    "partyType": "BOTH",
                    "filters": {
                      "caseStatus": "ALL"
                    },
                    "clientReference": "vendor-onboarding-4821"
                  }
                },
                "quota_exceeded": {
                  "summary": "Error: the plan's search allowance is used up",
                  "value": {
                    "name": "Acme Logistics Private Limited",
                    "entityType": "BUSINESS",
                    "registrationNumber": "U63090MH2012PTC123456",
                    "partyType": "BOTH",
                    "filters": {
                      "caseStatus": "ALL"
                    },
                    "clientReference": "vendor-onboarding-4821"
                  }
                },
                "rate_limited": {
                  "summary": "Error: too many requests",
                  "value": {
                    "name": "Acme Logistics Private Limited",
                    "entityType": "BUSINESS",
                    "registrationNumber": "U63090MH2012PTC123456",
                    "partyType": "BOTH",
                    "filters": {
                      "caseStatus": "ALL"
                    },
                    "clientReference": "vendor-onboarding-4821"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The first page (mode SYNC).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HistoricalSearchPage"
                },
                "examples": {
                  "success": {
                    "summary": "First page (3 of the 100 results shown)",
                    "value": {
                      "searchId": "CPHS0exampledemo0001",
                      "mode": "SYNC",
                      "status": "ACTIVE",
                      "name": "Acme Logistics Private Limited",
                      "partyType": "BOTH",
                      "filters": {
                        "caseStatus": "ALL"
                      },
                      "clientReference": "vendor-onboarding-4821",
                      "delivered": 100,
                      "warnings": [],
                      "createdAt": 1791600000000,
                      "expiresAt": 1792204800000,
                      "pageSize": 100,
                      "results": [
                        {
                          "caseRef": "CR0hc7f3a91e",
                          "caseIdentifier": {
                            "courtType": "HC",
                            "cnr": "KAHC010123452024"
                          },
                          "identifierStatus": "CONFIRMED",
                          "courtType": "HC",
                          "court": "High Court of Karnataka",
                          "state": "Karnataka",
                          "district": null,
                          "bench": "Bengaluru",
                          "caseType": "WP",
                          "caseTypeName": "Writ Petition",
                          "caseNature": "Civil",
                          "caseNumber": "WP/12345/2024",
                          "cnrNumber": "KAHC010123452024",
                          "filingNumber": "WP/45120/2024",
                          "registrationNumber": "WP/12345/2024",
                          "filingDate": "2024-03-18",
                          "filingYear": 2024,
                          "registrationDate": "2024-03-21",
                          "caseStatus": "PENDING",
                          "nextHearingDate": "2026-11-04",
                          "decisionDate": null,
                          "natureOfDisposal": null,
                          "petitioner": "K. Ramesh Babu",
                          "respondent": "The State of Karnataka",
                          "partyRole": "RESPONDENT",
                          "matchedParty": "Acme Logistics Pvt. Ltd",
                          "petitioners": [
                            "K. Ramesh Babu"
                          ],
                          "respondents": [
                            "The State of Karnataka",
                            "The Principal Secretary, Revenue Department",
                            "The Deputy Commissioner",
                            "Acme Logistics Pvt. Ltd",
                            "Indian Oil Corporation Ltd"
                          ],
                          "partyCountTruncated": false
                        },
                        {
                          "caseRef": "CR0dc21b5c07",
                          "caseIdentifier": {
                            "courtType": "DC",
                            "cnr": "DLST010012342023"
                          },
                          "identifierStatus": "CONFIRMED",
                          "courtType": "DC",
                          "court": "Saket District Court, Delhi",
                          "state": "Delhi",
                          "district": "South Delhi",
                          "bench": null,
                          "caseType": "CS",
                          "caseTypeName": "Civil Suit (Commercial)",
                          "caseNature": "Civil",
                          "caseNumber": "CS/1234/2023",
                          "cnrNumber": "DLST010012342023",
                          "filingNumber": "1234/2023",
                          "registrationNumber": "CS/1234/2023",
                          "filingDate": "2023-06-02",
                          "filingYear": 2023,
                          "registrationDate": "2023-06-05",
                          "caseStatus": "DISPOSED",
                          "nextHearingDate": null,
                          "decisionDate": "2025-01-29",
                          "natureOfDisposal": "Decreed",
                          "petitioner": "BLUELINE FREIGHT SERVICES",
                          "respondent": "ACME LOGISTICS PRIVATE LIMITED",
                          "partyRole": "RESPONDENT",
                          "matchedParty": "ACME LOGISTICS PRIVATE LIMITED",
                          "petitioners": [
                            "BLUELINE FREIGHT SERVICES"
                          ],
                          "respondents": [
                            "ACME LOGISTICS PRIVATE LIMITED"
                          ],
                          "partyCountTruncated": false
                        },
                        {
                          "caseRef": "CR0it88e0d412",
                          "caseIdentifier": null,
                          "identifierStatus": "NEEDS_CONFIRMATION",
                          "courtType": "ITAT",
                          "court": "Income Tax Appellate Tribunal, Mumbai",
                          "state": "Maharashtra",
                          "district": null,
                          "bench": "Mumbai",
                          "caseType": "ITA",
                          "caseTypeName": "Income Tax Appeal",
                          "caseNature": "Tax",
                          "caseNumber": "ITA/2210/MUM/2022",
                          "cnrNumber": null,
                          "filingNumber": null,
                          "registrationNumber": null,
                          "filingDate": "2022-09-14",
                          "filingYear": 2022,
                          "registrationDate": null,
                          "caseStatus": "PENDING",
                          "nextHearingDate": null,
                          "decisionDate": null,
                          "natureOfDisposal": null,
                          "petitioner": "ACME LOGISTICS PRIVATE LIMITED",
                          "respondent": "DCIT CIRCLE 4(1)",
                          "partyRole": "PETITIONER",
                          "matchedParty": "ACME LOGISTICS PRIVATE LIMITED",
                          "petitioners": [
                            "ACME LOGISTICS PRIVATE LIMITED"
                          ],
                          "respondents": [
                            "DCIT CIRCLE 4(1)"
                          ],
                          "partyCountTruncated": false
                        }
                      ],
                      "nextPageToken": "eyJzIjoiQ1BIUzBzYW5kYm94ZGVtbzAwMDEiLCJwIjoxMDB9.Qk3x9Wf2mT8aYb1c"
                    }
                  },
                  "filtered_complete": {
                    "summary": "Pending cases from 2020, as respondent - everything fits one page",
                    "value": {
                      "searchId": "CPHS0exampledemo0001",
                      "mode": "SYNC",
                      "status": "COMPLETE",
                      "name": "Acme Logistics Private Limited",
                      "partyType": "RESPONDENT",
                      "filters": {
                        "fromYear": 2020,
                        "caseStatus": "PENDING"
                      },
                      "clientReference": null,
                      "delivered": 2,
                      "warnings": [],
                      "createdAt": 1791600000000,
                      "expiresAt": 1792204800000,
                      "pageSize": 100,
                      "results": [
                        {
                          "caseRef": "CR0dc21b5c07",
                          "caseIdentifier": {
                            "courtType": "DC",
                            "cnr": "DLST010012342023"
                          },
                          "identifierStatus": "CONFIRMED",
                          "courtType": "DC",
                          "court": "Saket District Court, Delhi",
                          "state": "Delhi",
                          "district": "South Delhi",
                          "bench": null,
                          "caseType": "CS",
                          "caseTypeName": "Civil Suit (Commercial)",
                          "caseNature": "Civil",
                          "caseNumber": "CS/1234/2023",
                          "cnrNumber": "DLST010012342023",
                          "filingNumber": "1234/2023",
                          "registrationNumber": "CS/1234/2023",
                          "filingDate": "2023-06-02",
                          "filingYear": 2023,
                          "registrationDate": "2023-06-05",
                          "caseStatus": "PENDING",
                          "nextHearingDate": null,
                          "decisionDate": null,
                          "natureOfDisposal": null,
                          "petitioner": "BLUELINE FREIGHT SERVICES",
                          "respondent": "ACME LOGISTICS PRIVATE LIMITED",
                          "partyRole": "RESPONDENT",
                          "matchedParty": "ACME LOGISTICS PRIVATE LIMITED",
                          "petitioners": [
                            "BLUELINE FREIGHT SERVICES"
                          ],
                          "respondents": [
                            "ACME LOGISTICS PRIVATE LIMITED"
                          ],
                          "partyCountTruncated": false
                        },
                        {
                          "caseRef": "CR0hc7f3a91e",
                          "caseIdentifier": {
                            "courtType": "HC",
                            "cnr": "KAHC010123452024"
                          },
                          "identifierStatus": "CONFIRMED",
                          "courtType": "HC",
                          "court": "High Court of Karnataka",
                          "state": "Karnataka",
                          "district": null,
                          "bench": "Bengaluru",
                          "caseType": "WP",
                          "caseTypeName": "Writ Petition",
                          "caseNature": "Civil",
                          "caseNumber": "WP/12345/2024",
                          "cnrNumber": "KAHC010123452024",
                          "filingNumber": "WP/45120/2024",
                          "registrationNumber": "WP/12345/2024",
                          "filingDate": "2024-03-18",
                          "filingYear": 2024,
                          "registrationDate": "2024-03-21",
                          "caseStatus": "PENDING",
                          "nextHearingDate": "2026-11-04",
                          "decisionDate": null,
                          "natureOfDisposal": null,
                          "petitioner": "K. Ramesh Babu",
                          "respondent": "The State of Karnataka",
                          "partyRole": "RESPONDENT",
                          "matchedParty": "Acme Logistics Pvt. Ltd",
                          "petitioners": [
                            "K. Ramesh Babu"
                          ],
                          "respondents": [
                            "The State of Karnataka",
                            "The Principal Secretary, Revenue Department",
                            "The Deputy Commissioner",
                            "Acme Logistics Pvt. Ltd",
                            "Indian Oil Corporation Ltd"
                          ],
                          "partyCountTruncated": false
                        }
                      ],
                      "nextPageToken": null
                    }
                  }
                }
              }
            }
          },
          "202": {
            "description": "Accepted (mode ASYNC). The search is RUNNING; there are no results yet.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HistoricalSearchSummary"
                },
                "examples": {
                  "async_started": {
                    "summary": "Asynchronous: accepted - collection runs in the background (202)",
                    "value": {
                      "searchId": "CPHS0exampleasync01",
                      "mode": "ASYNC",
                      "status": "RUNNING",
                      "name": "Acme Logistics Private Limited",
                      "partyType": "BOTH",
                      "filters": {
                        "caseStatus": "ALL"
                      },
                      "clientReference": "vendor-onboarding-4821",
                      "delivered": 0,
                      "warnings": [],
                      "createdAt": 1791936000000,
                      "expiresAt": 1792566000000,
                      "collected": 0,
                      "completedAt": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input, filters or party type, or a person search.",
            "content": {
              "application/json": {
                "examples": {
                  "person_not_supported": {
                    "summary": "Error: a person, not a company",
                    "value": {
                      "httpStatusCode": 400,
                      "code": 60405,
                      "message": "Real-time court search is only available for company entities - add cases for a person entity manually",
                      "appError": true
                    }
                  },
                  "invalid_filter": {
                    "summary": "Error: filters not valid",
                    "value": {
                      "httpStatusCode": 400,
                      "code": 61454,
                      "message": "The search filters are not valid",
                      "appError": true
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "The plan's search allowance is used up.",
            "content": {
              "application/json": {
                "examples": {
                  "quota_exceeded": {
                    "summary": "Error: the plan's search allowance is used up",
                    "value": {
                      "httpStatusCode": 402,
                      "code": 61455,
                      "message": "Your plan's search allowance has been used up",
                      "appError": true
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Caller lacks historicalSearch.write, or (mode ASYNC) asynchronous collection is not available on the plan.",
            "content": {
              "application/json": {
                "examples": {
                  "async_not_available": {
                    "summary": "Error: asynchronous collection is not available on this plan",
                    "value": {
                      "httpStatusCode": 403,
                      "code": 61465,
                      "message": "Asynchronous collection is not available on your plan. Page through the results with a normal search instead",
                      "appError": true
                    }
                  },
                  "no_provider": {
                    "summary": "Error: no data source enabled for the account",
                    "value": {
                      "httpStatusCode": 403,
                      "code": 61456,
                      "message": "No data source is enabled for this account",
                      "appError": true
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests for this account, or (mode ASYNC) too many asynchronous searches still collecting. See `Retry-After`.",
            "content": {
              "application/json": {
                "examples": {
                  "async_too_many_running": {
                    "summary": "Error: too many asynchronous searches are still collecting",
                    "value": {
                      "httpStatusCode": 429,
                      "code": 61466,
                      "message": "Too many of your searches are still being collected. Wait for one to finish, then start another",
                      "appError": true,
                      "details": {
                        "retryAfterSeconds": 60
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "Error: too many requests",
                    "value": {
                      "httpStatusCode": 429,
                      "code": 61457,
                      "message": "Too many requests - slow down and retry after the indicated time",
                      "appError": true
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The page could not be assembled in time. Retry; nothing was delivered or charged.",
            "content": {
              "application/json": {
                "examples": {
                  "page_not_ready": {
                    "summary": "503: first page not ready in time - carry on with the searchId and nextPageToken",
                    "value": {
                      "httpStatusCode": 503,
                      "code": 61452,
                      "message": "This page could not be assembled in time. Nothing was delivered or charged - retry with the same page token",
                      "appError": true,
                      "details": {
                        "retryAfterSeconds": 3,
                        "searchId": "CPHS0exampledemo0001",
                        "nextPageToken": "eyJzIjoiQ1BIUzBzYW5kYm94ZGVtbzAwMDEiLCJwIjowfQ.Zm2p0Lr7Vx5nEa9d"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "startAHistoricalSearch",
        "x-slug": "start-a-historical-search",
        "x-group": "Historical Search"
      }
    },
    "/historical-search/{searchId}": {
      "get": {
        "tags": [
          "Historical Search"
        ],
        "summary": "Status of a search",
        "description": "Status and counters. `status` is ACTIVE (more may exist), COMPLETE (every source read to its end or to the results-per-search cap) or EXPIRED (the results have been deleted; only the counts remain). An asynchronous search (`mode: ASYNC`) is RUNNING while it collects, then COMPLETE or FAILED; `collected` is how many results are stored so far (final once COMPLETE) and a FAILED search carries a `failureReason`. Does not contact a data source. Requires historicalSearch.read.\n",
        "parameters": [
          {
            "name": "searchId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The search.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HistoricalSearchSummary"
                },
                "examples": {
                  "active": {
                    "summary": "Success: more results available",
                    "value": {
                      "searchId": "CPHS0exampledemo0001",
                      "mode": "SYNC",
                      "status": "ACTIVE",
                      "name": "Acme Logistics Private Limited",
                      "partyType": "BOTH",
                      "filters": {
                        "caseStatus": "ALL"
                      },
                      "clientReference": "vendor-onboarding-4821",
                      "delivered": 100,
                      "warnings": [],
                      "createdAt": 1791600000000,
                      "expiresAt": 1792204800000
                    }
                  },
                  "complete": {
                    "summary": "Complete: every source read to its end",
                    "value": {
                      "searchId": "CPHS0exampledemo0001",
                      "mode": "SYNC",
                      "status": "COMPLETE",
                      "name": "Acme Logistics Private Limited",
                      "partyType": "BOTH",
                      "filters": {
                        "caseStatus": "ALL"
                      },
                      "clientReference": "vendor-onboarding-4821",
                      "delivered": 137,
                      "warnings": [],
                      "createdAt": 1791600000000,
                      "expiresAt": 1792204800000
                    }
                  },
                  "async_running": {
                    "summary": "Asynchronous: still collecting",
                    "value": {
                      "searchId": "CPHS0exampleasync01",
                      "mode": "ASYNC",
                      "status": "RUNNING",
                      "name": "Acme Logistics Private Limited",
                      "partyType": "BOTH",
                      "filters": {
                        "caseStatus": "ALL"
                      },
                      "clientReference": "vendor-onboarding-4821",
                      "delivered": 0,
                      "warnings": [],
                      "createdAt": 1791936000000,
                      "expiresAt": 1792566000000,
                      "collected": 1240,
                      "completedAt": null
                    }
                  },
                  "async_complete": {
                    "summary": "Asynchronous: complete - read the pages or download the file",
                    "value": {
                      "searchId": "CPHS0exampleasync01",
                      "mode": "ASYNC",
                      "status": "COMPLETE",
                      "name": "Acme Logistics Private Limited",
                      "partyType": "BOTH",
                      "filters": {
                        "caseStatus": "ALL"
                      },
                      "clientReference": "vendor-onboarding-4821",
                      "delivered": 1843,
                      "warnings": [],
                      "createdAt": 1791936000000,
                      "expiresAt": 1792544400000,
                      "collected": 1843,
                      "completedAt": 1791939600000
                    }
                  },
                  "async_failed": {
                    "summary": "Asynchronous: failed - nothing stored, nothing charged",
                    "value": {
                      "searchId": "CPHS0exampleasync01",
                      "mode": "ASYNC",
                      "status": "FAILED",
                      "name": "Acme Logistics Private Limited",
                      "partyType": "BOTH",
                      "filters": {
                        "caseStatus": "ALL"
                      },
                      "clientReference": "vendor-onboarding-4821",
                      "delivered": 0,
                      "warnings": [],
                      "createdAt": 1791936000000,
                      "expiresAt": 1792026000000,
                      "collected": 0,
                      "completedAt": 1791939600000,
                      "failureReason": "A data source was unavailable for too long. Nothing was charged - please start the search again later."
                    }
                  },
                  "expired": {
                    "summary": "Expired: results deleted, counts remain",
                    "value": {
                      "searchId": "CPHS0exampledemo0001",
                      "mode": "SYNC",
                      "status": "EXPIRED",
                      "name": "Acme Logistics Private Limited",
                      "partyType": "BOTH",
                      "filters": {
                        "caseStatus": "ALL"
                      },
                      "clientReference": "vendor-onboarding-4821",
                      "delivered": 137,
                      "warnings": [],
                      "createdAt": 1790908800000,
                      "expiresAt": 1791513600000
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Unknown or deleted search.",
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "Error: unknown or deleted search",
                    "value": {
                      "httpStatusCode": 404,
                      "code": 61449,
                      "message": "This search was not found",
                      "appError": true
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "statusOfASearch",
        "x-slug": "status-of-a-search",
        "x-group": "Historical Search"
      },
      "delete": {
        "tags": [
          "Historical Search"
        ],
        "summary": "Delete a search now",
        "description": "Deletes the search's results immediately. Only the minimal record needed for billing remains. On an asynchronous search that is still collecting this also cancels it (nothing is charged). Requires historicalSearch.write.",
        "parameters": [
          {
            "name": "searchId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted.",
            "content": {
              "application/json": {
                "examples": {
                  "success": {
                    "summary": "Success",
                    "value": {}
                  }
                }
              }
            }
          },
          "404": {
            "description": "Unknown or already deleted search.",
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "Error: unknown or already deleted search",
                    "value": {
                      "httpStatusCode": 404,
                      "code": 61449,
                      "message": "This search was not found",
                      "appError": true
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "deleteASearchNow",
        "x-slug": "delete-a-search-now",
        "x-group": "Historical Search"
      }
    },
    "/historical-search/{searchId}/results": {
      "get": {
        "tags": [
          "Historical Search"
        ],
        "summary": "Next page of a search",
        "description": "Returns the next 100 cases after `pageToken`. Without a `pageToken` it returns the first page again, so a search's first page can be read at any time while the search is kept (7 days) - it is the same page the start call returned, with no new fetch and no new charge. Exactly 100, except the last page; a short or empty page is never returned while more exist. A case is never returned twice. Repeating a call with the same token returns the same page again with no new fetch and no new charge, so it is safe to retry.\n\nThe end is `nextPageToken: null` with `status: COMPLETE`. If the page cannot be assembled within 60 seconds the call returns 503 with `Retry-After` and nothing changes: retry with the same token. Another request already running on this search returns 409.\n\nAn asynchronous search can be read only once it is COMPLETE (409 before that); reading its pages is free. Expired searches (older than 7 days) return 410. Requires historicalSearch.read.\n",
        "parameters": [
          {
            "name": "searchId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "pageToken",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "The `nextPageToken` of the previous page. Leave it out to get the FIRST page again (the page the start call returned has no token of its own)."
          }
        ],
        "responses": {
          "200": {
            "description": "The page.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HistoricalSearchPage"
                },
                "examples": {
                  "first_page_again": {
                    "summary": "The first page again - no pageToken (read it any time within 7 days; free)",
                    "value": {
                      "searchId": "CPHS0exampledemo0001",
                      "mode": "SYNC",
                      "status": "ACTIVE",
                      "name": "Acme Logistics Private Limited",
                      "partyType": "BOTH",
                      "filters": {
                        "caseStatus": "ALL"
                      },
                      "clientReference": "vendor-onboarding-4821",
                      "delivered": 100,
                      "warnings": [],
                      "createdAt": 1791600000000,
                      "expiresAt": 1792204800000,
                      "pageSize": 100,
                      "results": [
                        {
                          "caseRef": "CR0hc7f3a91e",
                          "caseIdentifier": {
                            "courtType": "HC",
                            "cnr": "KAHC010123452024"
                          },
                          "identifierStatus": "CONFIRMED",
                          "courtType": "HC",
                          "court": "High Court of Karnataka",
                          "state": "Karnataka",
                          "district": null,
                          "bench": "Bengaluru",
                          "caseType": "WP",
                          "caseTypeName": "Writ Petition",
                          "caseNature": "Civil",
                          "caseNumber": "WP/12345/2024",
                          "cnrNumber": "KAHC010123452024",
                          "filingNumber": "WP/45120/2024",
                          "registrationNumber": "WP/12345/2024",
                          "filingDate": "2024-03-18",
                          "filingYear": 2024,
                          "registrationDate": "2024-03-21",
                          "caseStatus": "PENDING",
                          "nextHearingDate": "2026-11-04",
                          "decisionDate": null,
                          "natureOfDisposal": null,
                          "petitioner": "K. Ramesh Babu",
                          "respondent": "The State of Karnataka",
                          "partyRole": "RESPONDENT",
                          "matchedParty": "Acme Logistics Pvt. Ltd",
                          "petitioners": [
                            "K. Ramesh Babu"
                          ],
                          "respondents": [
                            "The State of Karnataka",
                            "The Principal Secretary, Revenue Department",
                            "The Deputy Commissioner",
                            "Acme Logistics Pvt. Ltd",
                            "Indian Oil Corporation Ltd"
                          ],
                          "partyCountTruncated": false
                        },
                        {
                          "caseRef": "CR0dc21b5c07",
                          "caseIdentifier": {
                            "courtType": "DC",
                            "cnr": "DLST010012342023"
                          },
                          "identifierStatus": "CONFIRMED",
                          "courtType": "DC",
                          "court": "Saket District Court, Delhi",
                          "state": "Delhi",
                          "district": "South Delhi",
                          "bench": null,
                          "caseType": "CS",
                          "caseTypeName": "Civil Suit (Commercial)",
                          "caseNature": "Civil",
                          "caseNumber": "CS/1234/2023",
                          "cnrNumber": "DLST010012342023",
                          "filingNumber": "1234/2023",
                          "registrationNumber": "CS/1234/2023",
                          "filingDate": "2023-06-02",
                          "filingYear": 2023,
                          "registrationDate": "2023-06-05",
                          "caseStatus": "DISPOSED",
                          "nextHearingDate": null,
                          "decisionDate": "2025-01-29",
                          "natureOfDisposal": "Decreed",
                          "petitioner": "BLUELINE FREIGHT SERVICES",
                          "respondent": "ACME LOGISTICS PRIVATE LIMITED",
                          "partyRole": "RESPONDENT",
                          "matchedParty": "ACME LOGISTICS PRIVATE LIMITED",
                          "petitioners": [
                            "BLUELINE FREIGHT SERVICES"
                          ],
                          "respondents": [
                            "ACME LOGISTICS PRIVATE LIMITED"
                          ],
                          "partyCountTruncated": false
                        },
                        {
                          "caseRef": "CR0it88e0d412",
                          "caseIdentifier": null,
                          "identifierStatus": "NEEDS_CONFIRMATION",
                          "courtType": "ITAT",
                          "court": "Income Tax Appellate Tribunal, Mumbai",
                          "state": "Maharashtra",
                          "district": null,
                          "bench": "Mumbai",
                          "caseType": "ITA",
                          "caseTypeName": "Income Tax Appeal",
                          "caseNature": "Tax",
                          "caseNumber": "ITA/2210/MUM/2022",
                          "cnrNumber": null,
                          "filingNumber": null,
                          "registrationNumber": null,
                          "filingDate": "2022-09-14",
                          "filingYear": 2022,
                          "registrationDate": null,
                          "caseStatus": "PENDING",
                          "nextHearingDate": null,
                          "decisionDate": null,
                          "natureOfDisposal": null,
                          "petitioner": "ACME LOGISTICS PRIVATE LIMITED",
                          "respondent": "DCIT CIRCLE 4(1)",
                          "partyRole": "PETITIONER",
                          "matchedParty": "ACME LOGISTICS PRIVATE LIMITED",
                          "petitioners": [
                            "ACME LOGISTICS PRIVATE LIMITED"
                          ],
                          "respondents": [
                            "DCIT CIRCLE 4(1)"
                          ],
                          "partyCountTruncated": false
                        }
                      ],
                      "nextPageToken": "eyJzIjoiQ1BIUzBzYW5kYm94ZGVtbzAwMDEiLCJwIjoxMDB9.Qk3x9Wf2mT8aYb1c"
                    }
                  },
                  "success": {
                    "summary": "Next page (3 of the 100 results shown)",
                    "value": {
                      "searchId": "CPHS0exampledemo0001",
                      "mode": "SYNC",
                      "status": "ACTIVE",
                      "name": "Acme Logistics Private Limited",
                      "partyType": "BOTH",
                      "filters": {
                        "caseStatus": "ALL"
                      },
                      "clientReference": "vendor-onboarding-4821",
                      "delivered": 200,
                      "warnings": [],
                      "createdAt": 1791600000000,
                      "expiresAt": 1792204800000,
                      "pageSize": 100,
                      "results": [
                        {
                          "caseRef": "CR0dc21b5c07",
                          "caseIdentifier": {
                            "courtType": "DC",
                            "cnr": "DLST010012342023"
                          },
                          "identifierStatus": "CONFIRMED",
                          "courtType": "DC",
                          "court": "Saket District Court, Delhi",
                          "state": "Delhi",
                          "district": "South Delhi",
                          "bench": null,
                          "caseType": "CS",
                          "caseTypeName": "Civil Suit (Commercial)",
                          "caseNature": "Civil",
                          "caseNumber": "CS/1234/2023",
                          "cnrNumber": "DLST010012342023",
                          "filingNumber": "1234/2023",
                          "registrationNumber": "CS/1234/2023",
                          "filingDate": "2023-06-02",
                          "filingYear": 2023,
                          "registrationDate": "2023-06-05",
                          "caseStatus": "DISPOSED",
                          "nextHearingDate": null,
                          "decisionDate": "2025-01-29",
                          "natureOfDisposal": "Decreed",
                          "petitioner": "BLUELINE FREIGHT SERVICES",
                          "respondent": "ACME LOGISTICS PRIVATE LIMITED",
                          "partyRole": "RESPONDENT",
                          "matchedParty": "ACME LOGISTICS PRIVATE LIMITED",
                          "petitioners": [
                            "BLUELINE FREIGHT SERVICES"
                          ],
                          "respondents": [
                            "ACME LOGISTICS PRIVATE LIMITED"
                          ],
                          "partyCountTruncated": false
                        },
                        {
                          "caseRef": "CR0it88e0d412",
                          "caseIdentifier": null,
                          "identifierStatus": "NEEDS_CONFIRMATION",
                          "courtType": "ITAT",
                          "court": "Income Tax Appellate Tribunal, Mumbai",
                          "state": "Maharashtra",
                          "district": null,
                          "bench": "Mumbai",
                          "caseType": "ITA",
                          "caseTypeName": "Income Tax Appeal",
                          "caseNature": "Tax",
                          "caseNumber": "ITA/2210/MUM/2022",
                          "cnrNumber": null,
                          "filingNumber": null,
                          "registrationNumber": null,
                          "filingDate": "2022-09-14",
                          "filingYear": 2022,
                          "registrationDate": null,
                          "caseStatus": "PENDING",
                          "nextHearingDate": null,
                          "decisionDate": null,
                          "natureOfDisposal": null,
                          "petitioner": "ACME LOGISTICS PRIVATE LIMITED",
                          "respondent": "DCIT CIRCLE 4(1)",
                          "partyRole": "PETITIONER",
                          "matchedParty": "ACME LOGISTICS PRIVATE LIMITED",
                          "petitioners": [
                            "ACME LOGISTICS PRIVATE LIMITED"
                          ],
                          "respondents": [
                            "DCIT CIRCLE 4(1)"
                          ],
                          "partyCountTruncated": false
                        },
                        {
                          "caseRef": "CR0hc7f3a91e",
                          "caseIdentifier": {
                            "courtType": "HC",
                            "cnr": "KAHC010123452024"
                          },
                          "identifierStatus": "CONFIRMED",
                          "courtType": "HC",
                          "court": "High Court of Karnataka",
                          "state": "Karnataka",
                          "district": null,
                          "bench": "Bengaluru",
                          "caseType": "WP",
                          "caseTypeName": "Writ Petition",
                          "caseNature": "Civil",
                          "caseNumber": "WP/12345/2024",
                          "cnrNumber": "KAHC010123452024",
                          "filingNumber": "WP/45120/2024",
                          "registrationNumber": "WP/12345/2024",
                          "filingDate": "2024-03-18",
                          "filingYear": 2024,
                          "registrationDate": "2024-03-21",
                          "caseStatus": "PENDING",
                          "nextHearingDate": "2026-11-04",
                          "decisionDate": null,
                          "natureOfDisposal": null,
                          "petitioner": "K. Ramesh Babu",
                          "respondent": "The State of Karnataka",
                          "partyRole": "RESPONDENT",
                          "matchedParty": "Acme Logistics Pvt. Ltd",
                          "petitioners": [
                            "K. Ramesh Babu"
                          ],
                          "respondents": [
                            "The State of Karnataka",
                            "The Principal Secretary, Revenue Department",
                            "The Deputy Commissioner",
                            "Acme Logistics Pvt. Ltd",
                            "Indian Oil Corporation Ltd"
                          ],
                          "partyCountTruncated": false
                        }
                      ],
                      "nextPageToken": "eyJzIjoiQ1BIUzBzYW5kYm94ZGVtbzAwMDEiLCJwIjoyMDB9.Hs7d2Qe9Lm4TzYk1"
                    }
                  },
                  "last_page": {
                    "summary": "Last page: status COMPLETE and no nextPageToken",
                    "value": {
                      "searchId": "CPHS0exampledemo0001",
                      "mode": "SYNC",
                      "status": "COMPLETE",
                      "name": "Acme Logistics Private Limited",
                      "partyType": "BOTH",
                      "filters": {
                        "caseStatus": "ALL"
                      },
                      "clientReference": "vendor-onboarding-4821",
                      "delivered": 137,
                      "warnings": [],
                      "createdAt": 1791600000000,
                      "expiresAt": 1792204800000,
                      "pageSize": 100,
                      "results": [
                        {
                          "caseRef": "CR0it88e0d412",
                          "caseIdentifier": null,
                          "identifierStatus": "NEEDS_CONFIRMATION",
                          "courtType": "ITAT",
                          "court": "Income Tax Appellate Tribunal, Mumbai",
                          "state": "Maharashtra",
                          "district": null,
                          "bench": "Mumbai",
                          "caseType": "ITA",
                          "caseTypeName": "Income Tax Appeal",
                          "caseNature": "Tax",
                          "caseNumber": "ITA/2210/MUM/2022",
                          "cnrNumber": null,
                          "filingNumber": null,
                          "registrationNumber": null,
                          "filingDate": "2022-09-14",
                          "filingYear": 2022,
                          "registrationDate": null,
                          "caseStatus": "PENDING",
                          "nextHearingDate": null,
                          "decisionDate": null,
                          "natureOfDisposal": null,
                          "petitioner": "ACME LOGISTICS PRIVATE LIMITED",
                          "respondent": "DCIT CIRCLE 4(1)",
                          "partyRole": "PETITIONER",
                          "matchedParty": "ACME LOGISTICS PRIVATE LIMITED",
                          "petitioners": [
                            "ACME LOGISTICS PRIVATE LIMITED"
                          ],
                          "respondents": [
                            "DCIT CIRCLE 4(1)"
                          ],
                          "partyCountTruncated": false
                        }
                      ],
                      "nextPageToken": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid page token (a token from another search, altered, or beyond what has been delivered).",
            "content": {
              "application/json": {
                "examples": {
                  "invalid_token": {
                    "summary": "Error: page token not valid for this search",
                    "value": {
                      "httpStatusCode": 400,
                      "code": 61453,
                      "message": "The page token is not valid for this search",
                      "appError": true
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "The plan's search allowance is used up.",
            "content": {
              "application/json": {
                "examples": {
                  "quota_exceeded": {
                    "summary": "Error: the plan's search allowance is used up",
                    "value": {
                      "httpStatusCode": 402,
                      "code": 61455,
                      "message": "Your plan's search allowance has been used up",
                      "appError": true
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Unknown or deleted search.",
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "Error: unknown or deleted search",
                    "value": {
                      "httpStatusCode": 404,
                      "code": 61449,
                      "message": "This search was not found",
                      "appError": true
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Another request on this search is still running.",
            "content": {
              "application/json": {
                "examples": {
                  "busy": {
                    "summary": "Error: another request on this search is still running",
                    "value": {
                      "httpStatusCode": 409,
                      "code": 61451,
                      "message": "Another request on this search is still running. Wait for it to finish, then retry",
                      "appError": true
                    }
                  },
                  "async_not_complete": {
                    "summary": "Error: the asynchronous search is still being collected",
                    "value": {
                      "httpStatusCode": 409,
                      "code": 61467,
                      "message": "This search is still being collected. Its results can be read once its status is COMPLETE",
                      "appError": true,
                      "details": {
                        "status": "RUNNING"
                      }
                    }
                  }
                }
              }
            }
          },
          "410": {
            "description": "The search has expired and its results were deleted.",
            "content": {
              "application/json": {
                "examples": {
                  "expired": {
                    "summary": "Error: the search has expired (older than 7 days)",
                    "value": {
                      "httpStatusCode": 410,
                      "code": 61450,
                      "message": "This search is older than its retention period and its results have been deleted. Start a new search",
                      "appError": true
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests for this account. See `Retry-After`."
          },
          "503": {
            "description": "The page could not be assembled in time. Retry with the same token.",
            "content": {
              "application/json": {
                "examples": {
                  "page_not_ready": {
                    "summary": "503: page not ready - retry with the same token",
                    "value": {
                      "httpStatusCode": 503,
                      "code": 61452,
                      "message": "This page could not be assembled in time. Nothing was delivered or charged - retry with the same page token",
                      "appError": true,
                      "details": {
                        "retryAfterSeconds": 3,
                        "heldForNextPage": false
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "nextPageOfASearch",
        "x-slug": "next-page-of-a-search",
        "x-group": "Historical Search"
      }
    },
    "/historical-search/{searchId}/download": {
      "get": {
        "tags": [
          "Historical Search"
        ],
        "summary": "Download a completed asynchronous search",
        "description": "For an asynchronous search whose status is COMPLETE: a fresh link (valid for 15 minutes) to ONE JSON file with the whole result set - the search, its `resultCount`, any `warnings` and every result, in the same shape and order as the pages. Ask again for a new link any time within the 7 days the file is kept; downloading is free. Before COMPLETE the call returns 409; a synchronous search has no file (404). Requires historicalSearch.read.\n",
        "parameters": [
          {
            "name": "searchId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A link to the file.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "description": "Presigned link, valid for 15 minutes."
                    },
                    "expiresAt": {
                      "type": "integer",
                      "description": "Epoch ms when the link stops working."
                    },
                    "format": {
                      "type": "string",
                      "enum": [
                        "json"
                      ]
                    },
                    "resultCount": {
                      "type": "integer"
                    },
                    "sizeBytes": {
                      "type": "integer"
                    }
                  }
                },
                "examples": {
                  "success": {
                    "summary": "Success: a link to the JSON file",
                    "value": {
                      "url": "https://files.example.com/historical-search/CPA0example/CPHS0exampleasync01.json?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Expires=900&X-Amz-Signature=...",
                      "expiresAt": 1791940500000,
                      "format": "json",
                      "resultCount": 1843,
                      "sizeBytes": 2764310
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Unknown or deleted search, or a search with no file (synchronous).",
            "content": {
              "application/json": {
                "examples": {
                  "no_file": {
                    "summary": "Error: a synchronous search has no download",
                    "value": {
                      "httpStatusCode": 404,
                      "code": 61468,
                      "message": "There is no download for this search: only a completed asynchronous search has one",
                      "appError": true
                    }
                  },
                  "not_found": {
                    "summary": "Error: unknown or deleted search",
                    "value": {
                      "httpStatusCode": 404,
                      "code": 61449,
                      "message": "This search was not found",
                      "appError": true
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "The search is still being collected, or it failed.",
            "content": {
              "application/json": {
                "examples": {
                  "not_complete": {
                    "summary": "Error: still being collected",
                    "value": {
                      "httpStatusCode": 409,
                      "code": 61467,
                      "message": "This search is still being collected. Its results can be read once its status is COMPLETE",
                      "appError": true,
                      "details": {
                        "status": "RUNNING"
                      }
                    }
                  }
                }
              }
            }
          },
          "410": {
            "description": "The search has expired and its file was deleted."
          }
        },
        "operationId": "downloadACompletedAsynchronousSearch",
        "x-slug": "download-historical-search",
        "x-group": "Historical Search"
      }
    }
  },
  "components": {
    "schemas": {
      "CreateEntityRequest": {
        "type": "object",
        "required": [
          "name",
          "entityType"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 2,
            "maxLength": 255
          },
          "entityType": {
            "type": "string",
            "enum": [
              "PERSON",
              "BUSINESS"
            ]
          },
          "fatherName": {
            "type": "string",
            "maxLength": 256,
            "nullable": true,
            "description": "PERSON entities only - ignored for BUSINESS."
          },
          "birthDate": {
            "type": "string",
            "pattern": "^\\d{2}-\\d{2}-\\d{4}$",
            "example": "15-08-1990",
            "nullable": true,
            "description": "DD-MM-YYYY. PERSON entities only - ignored for BUSINESS."
          },
          "location": {
            "type": "string",
            "maxLength": 4192,
            "nullable": true,
            "description": "Free-text address."
          },
          "registrationNumber": {
            "type": "string",
            "maxLength": 50,
            "nullable": true
          },
          "monitoredCourts": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "enum": [
                "ALL",
                "DC",
                "SC",
                "HC",
                "CC",
                "NCLT",
                "NCLAT",
                "GSTAT",
                "DRT",
                "DRAT",
                "CESTAT"
              ]
            },
            "description": "'ALL' must be the sole entry if used - cannot combine with specific court codes. Recorded with the entity. Monitoring is not currently restricted by this value."
          },
          "sharedWith": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ShareEntry"
            }
          },
          "fetchHistoricalCases": {
            "type": "boolean",
            "description": "One-time historical case lookup, fired asynchronously right after creation. BUSINESS entities only - silently a no-op for PERSON."
          }
        }
      },
      "CreateEntityResponse": {
        "type": "object",
        "properties": {
          "_id": {
            "type": "string",
            "example": "CPWLE0xyz789"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "httpStatusCode": {
            "type": "integer",
            "example": 400
          },
          "code": {
            "type": "integer",
            "description": "Numeric error code - stable, safe to branch on in client code.",
            "example": 60105
          },
          "message": {
            "type": "string",
            "example": "Email or password is incorrect"
          },
          "appError": {
            "type": "boolean",
            "example": true
          }
        }
      },
      "SearchRequest": {
        "type": "object",
        "description": "Shared search envelope used by every .../search endpoint in this API.",
        "properties": {
          "$filter": {
            "type": "object",
            "additionalProperties": true,
            "description": "Exact-match field filters, e.g. {\"status\": \"ACTIVE\"}."
          },
          "$like": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Case-insensitive substring filters, e.g. {\"name\": \"trip\"}."
          },
          "$skip": {
            "type": "integer",
            "minimum": 0
          },
          "$sort": {
            "type": "object",
            "additionalProperties": {
              "type": "integer",
              "enum": [
                1,
                -1
              ]
            },
            "description": "Field to +1/-1 (ascending/descending), e.g. {\"created\": -1}."
          },
          "$limit": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          }
        }
      },
      "EntitySearchResponse": {
        "type": "object",
        "properties": {
          "recordsFiltered": {
            "type": "integer",
            "description": "Total matching records, ignoring $skip/$limit."
          },
          "records": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WatchlistEntity"
            }
          }
        }
      },
      "WatchlistEntityDetail": {
        "description": "WatchlistEntity plus risk fields computed from its active cases.",
        "allOf": [
          {
            "$ref": "#/components/schemas/WatchlistEntity"
          },
          {
            "type": "object",
            "properties": {
              "riskLevel": {
                "type": "string",
                "enum": [
                  "VERY_HIGH",
                  "HIGH",
                  "MODERATE",
                  "LOW",
                  "UNCLASSIFIED"
                ],
                "description": "The single highest risk level among this entity's active cases."
              },
              "riskCounts": {
                "type": "object",
                "properties": {
                  "VERY_HIGH": {
                    "type": "integer"
                  },
                  "HIGH": {
                    "type": "integer"
                  },
                  "MODERATE": {
                    "type": "integer"
                  },
                  "LOW": {
                    "type": "integer"
                  },
                  "UNCLASSIFIED": {
                    "type": "integer"
                  }
                }
              },
              "caseCount": {
                "type": "integer",
                "description": "Count of ACTIVE cases tracked against this entity."
              }
            }
          }
        ]
      },
      "UpdateEntityRequest": {
        "type": "object",
        "required": [
          "name",
          "entityType"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 2,
            "maxLength": 255
          },
          "entityType": {
            "type": "string",
            "enum": [
              "PERSON",
              "BUSINESS"
            ]
          },
          "fatherName": {
            "type": "string",
            "maxLength": 256,
            "nullable": true
          },
          "birthDate": {
            "type": "string",
            "pattern": "^\\d{2}-\\d{2}-\\d{4}$",
            "nullable": true
          },
          "location": {
            "type": "string",
            "maxLength": 4192,
            "nullable": true
          },
          "registrationNumber": {
            "type": "string",
            "maxLength": 50,
            "nullable": true
          },
          "monitoredCourts": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "ALL",
                "DC",
                "SC",
                "HC",
                "CC",
                "NCLT",
                "NCLAT",
                "GSTAT",
                "DRT",
                "DRAT",
                "CESTAT"
              ]
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "PAUSED",
              "ARCHIVED"
            ]
          }
        }
      },
      "CandidatesSearchRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/SearchRequest"
          },
          {
            "type": "object",
            "required": [
              "tab"
            ],
            "properties": {
              "tab": {
                "type": "string",
                "enum": [
                  "historical",
                  "pendingReview"
                ]
              }
            }
          }
        ]
      },
      "CandidateSearchResponse": {
        "type": "object",
        "properties": {
          "recordsFiltered": {
            "type": "integer"
          },
          "records": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Candidate"
            }
          }
        }
      },
      "CreateCaseRequest": {
        "type": "object",
        "required": [
          "caseIdentifier"
        ],
        "properties": {
          "caseIdentifier": {
            "$ref": "#/components/schemas/CaseIdentifier"
          },
          "watchlistEntityId": {
            "type": "string",
            "nullable": true,
            "example": "CPWLE0abc123"
          },
          "snapshot": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "One matched record from POST .../discover, or the whole result of POST /case-lookup - carried into the new case for context (court, parties, risk level, ...). Omit for a fully manual add."
          },
          "sharedWith": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ShareEntry"
            }
          }
        }
      },
      "CreateCaseResponse": {
        "type": "object",
        "properties": {
          "_id": {
            "type": "string",
            "example": "CPWLC0xyz789"
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "PENDING_BACKOFFICE_REVIEW"
            ]
          },
          "linkedExisting": {
            "type": "boolean",
            "description": "true if this case was already tracked and this call just linked watchlistEntityId to it."
          }
        }
      },
      "CaseIdentifier": {
        "type": "object",
        "required": [
          "courtType"
        ],
        "properties": {
          "courtType": {
            "type": "string",
            "enum": [
              "DC",
              "SC",
              "HC",
              "CC",
              "NCLT",
              "NCLAT",
              "GSTAT",
              "DRT",
              "DRAT",
              "CESTAT"
            ]
          },
          "cnr": {
            "type": "string",
            "pattern": "^[A-Z]{4}[A-Z0-9]{8}\\d{4}$",
            "description": "DC, SC, HC only."
          },
          "registrationNumber": {
            "type": "string",
            "description": "Format depends on courtType - see the description above."
          },
          "filingNumber": {
            "type": "string",
            "description": "NCLT/NCLAT/GSTAT only."
          },
          "diaryNumber": {
            "type": "string",
            "description": "SC, DRT, DRAT, CESTAT only."
          },
          "establishmentCode": {
            "type": "string",
            "description": "Bench/tribunal code - required for HC (when not using cnr) and every tribunal court type."
          },
          "caseType": {
            "type": "string",
            "description": "Required alongside registrationNumber for most court types. Valid values depend on courtType; list them with GET /case-lookup/case-types."
          }
        },
        "example": {
          "courtType": "DC",
          "cnr": "DLCT010012342020"
        }
      },
      "CaseSearchResponse": {
        "type": "object",
        "properties": {
          "recordsFiltered": {
            "type": "integer"
          },
          "records": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WatchlistCase"
            }
          }
        }
      },
      "WatchlistCase": {
        "type": "object",
        "properties": {
          "_id": {
            "type": "string",
            "example": "CPWLC0abc123"
          },
          "number": {
            "type": "integer"
          },
          "accountId": {
            "type": "string"
          },
          "watchlistEntityIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Every watchlist entity this case is linked to - the same real-world case can be tracked against more than one company."
          },
          "caseIdentifier": {
            "$ref": "#/components/schemas/CaseIdentifier"
          },
          "snapshot": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true
          },
          "riskLevel": {
            "type": "string",
            "enum": [
              "VERY_HIGH",
              "HIGH",
              "MODERATE",
              "LOW",
              "UNCLASSIFIED"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "PENDING_BACKOFFICE_REVIEW",
              "REJECTED",
              "ARCHIVED"
            ]
          },
          "reviewedAt": {
            "type": "integer",
            "format": "int64",
            "nullable": true
          },
          "sharedWith": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ShareEntry"
            }
          },
          "created": {
            "type": "integer",
            "format": "int64"
          },
          "createdBy": {
            "type": "string",
            "nullable": true
          },
          "updated": {
            "type": "integer",
            "format": "int64",
            "nullable": true
          },
          "updatedBy": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "HistoricalSearchSummary": {
        "type": "object",
        "properties": {
          "searchId": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "SYNC",
              "ASYNC"
            ],
            "description": "ASYNC: collected in the background (see POST /historical-search)."
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "COMPLETE",
              "EXPIRED",
              "RUNNING",
              "FAILED"
            ],
            "description": "SYNC searches are ACTIVE, COMPLETE or EXPIRED. ASYNC searches are RUNNING, COMPLETE, FAILED or EXPIRED."
          },
          "name": {
            "type": "string"
          },
          "partyType": {
            "type": "string",
            "enum": [
              "PETITIONER",
              "RESPONDENT",
              "BOTH"
            ]
          },
          "filters": {
            "type": "object"
          },
          "clientReference": {
            "type": "string",
            "nullable": true
          },
          "delivered": {
            "type": "integer",
            "description": "Results delivered so far. For a COMPLETE asynchronous search: all of them (reading its pages is free and repeatable)."
          },
          "collected": {
            "type": "integer",
            "description": "ASYNC only. Results stored so far; final once COMPLETE."
          },
          "completedAt": {
            "type": "integer",
            "nullable": true,
            "description": "ASYNC only. Epoch ms the search finished (COMPLETE or FAILED); null while RUNNING."
          },
          "failureReason": {
            "type": "string",
            "description": "ASYNC only, present when FAILED: why, in words for a person. Nothing was charged."
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string",
                  "enum": [
                    "RESULT_CAP_REACHED",
                    "SOURCE_UNAVAILABLE"
                  ]
                },
                "message": {
                  "type": "string"
                }
              }
            }
          },
          "createdAt": {
            "type": "integer",
            "description": "Epoch ms."
          },
          "expiresAt": {
            "type": "integer",
            "description": "Epoch ms. Results are deleted at this time."
          }
        }
      },
      "HistoricalSearchPage": {
        "allOf": [
          {
            "$ref": "#/components/schemas/HistoricalSearchSummary"
          },
          {
            "type": "object",
            "properties": {
              "pageSize": {
                "type": "integer",
                "example": 100
              },
              "results": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/HistoricalSearchResult"
                }
              },
              "nextPageToken": {
                "type": "string",
                "nullable": true,
                "description": "Pass it to get the next page. Null when there is nothing more."
              }
            }
          }
        ]
      },
      "HistoricalSearchResult": {
        "type": "object",
        "properties": {
          "caseRef": {
            "type": "string",
            "description": "Stable id of the case: the same case has the same caseRef in every search."
          },
          "caseIdentifier": {
            "type": "object",
            "nullable": true,
            "description": "What identifies the case for a live lookup. Null when it cannot be established without a live check."
          },
          "identifierStatus": {
            "type": "string",
            "enum": [
              "CONFIRMED",
              "NEEDS_CONFIRMATION"
            ]
          },
          "courtType": {
            "type": "string",
            "description": "DC, HC, SC, CC, NCLT, NCLAT, CESTAT, DRT, DRAT, GSTAT, ITAT, APTEL, NGT, SAT or OTHER."
          },
          "court": {
            "type": "string",
            "nullable": true
          },
          "state": {
            "type": "string",
            "nullable": true
          },
          "district": {
            "type": "string",
            "nullable": true
          },
          "bench": {
            "type": "string",
            "nullable": true
          },
          "caseType": {
            "type": "string",
            "nullable": true
          },
          "caseTypeName": {
            "type": "string",
            "nullable": true
          },
          "caseNature": {
            "type": "string",
            "nullable": true
          },
          "caseNumber": {
            "type": "string",
            "nullable": true
          },
          "cnrNumber": {
            "type": "string",
            "nullable": true,
            "description": "Null when the case has no customer-visible CNR."
          },
          "filingNumber": {
            "type": "string",
            "nullable": true
          },
          "registrationNumber": {
            "type": "string",
            "nullable": true
          },
          "filingDate": {
            "type": "string",
            "nullable": true,
            "description": "YYYY-MM-DD."
          },
          "filingYear": {
            "type": "integer",
            "nullable": true
          },
          "registrationDate": {
            "type": "string",
            "nullable": true
          },
          "caseStatus": {
            "type": "string",
            "nullable": true
          },
          "nextHearingDate": {
            "type": "string",
            "nullable": true
          },
          "decisionDate": {
            "type": "string",
            "nullable": true
          },
          "natureOfDisposal": {
            "type": "string",
            "nullable": true
          },
          "petitioner": {
            "type": "string",
            "nullable": true
          },
          "respondent": {
            "type": "string",
            "nullable": true
          },
          "partyRole": {
            "type": "string",
            "nullable": true,
            "enum": [
              "PETITIONER",
              "RESPONDENT",
              "BOTH"
            ],
            "description": "The side the searched company is on."
          },
          "matchedParty": {
            "type": "string",
            "nullable": true,
            "description": "The party that made this case match: the first party, on the side(s) searched, that carries the company's name or one of its variations, as the court wrote it (for example 'Acme Logistics Pvt. Ltd' when it is respondent 6 of 8). `petitioner` and `respondent` above are only the parties on the case's title line, so they may not include it."
          },
          "petitioners": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Every petitioner, each once, in the court's order (placeholder entries such as 'Respondent' are left out). At most 25 - see `partyCountTruncated`."
          },
          "respondents": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Every respondent, each once, in the court's order. At most 25 - see `partyCountTruncated`."
          },
          "partyCountTruncated": {
            "type": "boolean",
            "description": "True when either list was cut at 25. `matchedParty` is still named."
          }
        }
      },
      "ShareEntry": {
        "type": "object",
        "required": [
          "type",
          "id"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "team",
              "user"
            ]
          },
          "id": {
            "type": "string",
            "description": "A team ID when type is 'team', a user ID otherwise."
          }
        }
      },
      "Candidate": {
        "type": "object",
        "description": "A court-record match found by discovery, awaiting (or past) a decision on whether it's a real case worth tracking.",
        "properties": {
          "_id": {
            "type": "string",
            "example": "CPWLCC0abc123"
          },
          "number": {
            "type": "integer"
          },
          "accountId": {
            "type": "string"
          },
          "watchlistEntityId": {
            "type": "string"
          },
          "rawMatch": {
            "type": "object",
            "additionalProperties": true,
            "description": "The discovered court record as found (shape varies by data source), plus, if a possible duplicate was seen but not auto-merged, possibleMatchConflict. Does not include which underlying provider(s) found it - that's stripped before this response is built."
          },
          "caseIdentifier": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/CaseIdentifier"
              }
            ],
            "description": "Null, or partially filled (cnr only, no courtType) until CasePrimus completes it. Always present by the time a candidate reaches PROMOTED."
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING_REVIEW",
              "APPROVED",
              "REJECTED",
              "PROMOTED"
            ],
            "description": "CasePrimus's data-quality check - is this a real, usable match at all."
          },
          "discoveryMode": {
            "type": "string",
            "enum": [
              "HISTORICAL",
              "ONGOING"
            ],
            "description": "HISTORICAL candidates skip the CasePrimus check entirely - the customer decides directly."
          },
          "customerDecision": {
            "type": "string",
            "enum": [
              "ADDED",
              "DECLINED"
            ],
            "nullable": true,
            "description": "null means not yet decided by the customer."
          },
          "promotedCaseId": {
            "type": "string",
            "nullable": true
          },
          "created": {
            "type": "integer",
            "format": "int64"
          },
          "updated": {
            "type": "integer",
            "format": "int64",
            "nullable": true
          }
        }
      },
      "WatchlistEntity": {
        "type": "object",
        "properties": {
          "_id": {
            "type": "string",
            "example": "CPWLE0abc123"
          },
          "number": {
            "type": "integer"
          },
          "accountId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "entityType": {
            "type": "string",
            "enum": [
              "PERSON",
              "BUSINESS"
            ]
          },
          "fatherName": {
            "type": "string",
            "nullable": true
          },
          "birthDate": {
            "type": "string",
            "nullable": true
          },
          "location": {
            "type": "string",
            "nullable": true
          },
          "registrationNumber": {
            "type": "string",
            "nullable": true
          },
          "monitoredCourts": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "PAUSED",
              "ARCHIVED"
            ]
          },
          "nameVariations": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "AI-generated alternate spellings/forms of the company name, used to widen court-record name matching. Empty for PERSON entities."
          },
          "lastCourtSyncAt": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "description": "When the daily/on-demand court-record search last ran for this entity."
          },
          "sharedWith": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ShareEntry"
            }
          },
          "created": {
            "type": "integer",
            "format": "int64"
          },
          "createdBy": {
            "type": "string"
          },
          "updated": {
            "type": "integer",
            "format": "int64",
            "nullable": true
          },
          "updatedBy": {
            "type": "string",
            "nullable": true
          }
        }
      }
    },
    "securitySchemes": {
      "apiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-CasePrimus-Api-Key",
        "description": "Your API key, created from the Developer console in the CasePrimus.ai dashboard. Keys can also be configured to require signed requests; see the Authentication guide."
      }
    }
  }
}