{
  "openapi": "3.0.3",
  "info": {
    "title": "TailRegister integration API",
    "version": "1.0.0",
    "description": "Read-only access to programme records for other systems of the organisation. Create a key in the console under Integration and send it in the `X-API-Key` header. A key sees every unit of its organisation. Times are ISO 8601 in UTC; dates are YYYY-MM-DD."
  },
  "servers": [
    {
      "url": "https://tailregister.com"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "paths": {
    "/v1/dogs": {
      "get": {
        "summary": "List dogs",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Collar code, part of a microchip number, or part of the capture address",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "registered, captured, in_centre, released, adopted or dead",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sex",
            "in": "query",
            "required": false,
            "description": "male, female or unknown",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "org_unit_id",
            "in": "query",
            "required": false,
            "description": "Limit to this unit and everything beneath it",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "care",
            "in": "query",
            "required": false,
            "description": "sterilised, not_sterilised, vaccinated or booster_overdue",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "1–200, default 50",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Rows to skip",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of dogs and the total matching",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DogList"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not permitted, account suspended, or integration not licensed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dogs/lookup": {
      "get": {
        "summary": "Find one dog by collar code, collar URL or microchip number",
        "parameters": [
          {
            "name": "code",
            "in": "query",
            "required": true,
            "description": "Collar code, scanned URL or 15-digit microchip number",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The dog",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "dog": {
                      "$ref": "#/components/schemas/Dog"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not permitted, account suspended, or integration not licensed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No dog carries that code",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dogs/points": {
      "get": {
        "summary": "Capture positions for mapping",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Collar code, part of a microchip number, or part of the capture address",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "registered, captured, in_centre, released, adopted or dead",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sex",
            "in": "query",
            "required": false,
            "description": "male, female or unknown",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "org_unit_id",
            "in": "query",
            "required": false,
            "description": "Limit to this unit and everything beneath it",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "care",
            "in": "query",
            "required": false,
            "description": "sterilised, not_sterilised, vaccinated or booster_overdue",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Positions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/DogPoint"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not permitted, account suspended, or integration not licensed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dogs/{id}": {
      "get": {
        "summary": "One dog with its full history and photo list",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Dog id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Dog, events and photos",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DogDetail"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not permitted, account suspended, or integration not licensed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/photos/{id}/file": {
      "get": {
        "summary": "Download a photograph",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Photo id from the dog record",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The image",
            "content": {
              "image/jpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not permitted, account suspended, or integration not licensed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/stats/summary": {
      "get": {
        "summary": "Programme totals, daily activity and a breakdown by unit",
        "parameters": [
          {
            "name": "org_unit_id",
            "in": "query",
            "required": false,
            "description": "Unit to summarise; default is the whole organisation",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "First day of the daily series",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "Last day of the daily series",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Summary",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatsSummary"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not permitted, account suspended, or integration not licensed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/org-units": {
      "get": {
        "summary": "Organisation units (state, districts, local bodies, centres)",
        "responses": {
          "200": {
            "description": "Units ordered so that parents precede children",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/OrgUnit"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not permitted, account suspended, or integration not licensed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sync/pull": {
      "get": {
        "summary": "Incremental feed of every change since a cursor",
        "description": "Start with cursor 0 and repeat with the returned cursor while `has_more` is true; afterwards poll with the last cursor to receive only what changed.",
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Cursor from the previous call; 0 to start",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "1–1000, default 500",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Changed dogs, events and photos",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PullResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not permitted, account suspended, or integration not licensed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/export/dogs.csv": {
      "get": {
        "summary": "Dog register as CSV",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Collar code, part of a microchip number, or part of the capture address",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "registered, captured, in_centre, released, adopted or dead",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sex",
            "in": "query",
            "required": false,
            "description": "male, female or unknown",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "org_unit_id",
            "in": "query",
            "required": false,
            "description": "Limit to this unit and everything beneath it",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "care",
            "in": "query",
            "required": false,
            "description": "sterilised, not_sterilised, vaccinated or booster_overdue",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "CSV, UTF-8",
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not permitted, account suspended, or integration not licensed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/export/events.csv": {
      "get": {
        "summary": "Events in a period as CSV",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": true,
            "description": "First day",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "description": "Last day",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "org_unit_id",
            "in": "query",
            "required": false,
            "description": "Limit to a unit",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "CSV, UTF-8",
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not permitted, account suspended, or integration not licensed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/public/tags/{code}": {
      "get": {
        "summary": "Public status of a collar (no key needed)",
        "security": [],
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "description": "Collar code",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sterilisation and vaccination status only",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicTag"
                }
              }
            }
          },
          "404": {
            "description": "Unknown code",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    },
    "schemas": {
      "Dog": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "qr_code": {
            "nullable": true,
            "type": "string"
          },
          "chip_no": {
            "nullable": true,
            "type": "string"
          },
          "sex": {
            "type": "string",
            "enum": [
              "male",
              "female",
              "unknown"
            ]
          },
          "age_group": {
            "nullable": true,
            "type": "string",
            "enum": [
              "puppy",
              "young",
              "adult",
              "old"
            ]
          },
          "colour": {
            "nullable": true,
            "type": "string"
          },
          "markings": {
            "nullable": true,
            "type": "string"
          },
          "weight_kg": {
            "nullable": true,
            "type": "number"
          },
          "org_unit_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "status": {
            "type": "string",
            "enum": [
              "registered",
              "captured",
              "in_centre",
              "released",
              "adopted",
              "dead"
            ]
          },
          "captured_at": {
            "nullable": true,
            "type": "string"
          },
          "sterilised_at": {
            "nullable": true,
            "type": "string"
          },
          "last_vaccinated_at": {
            "nullable": true,
            "type": "string"
          },
          "vaccination_due_on": {
            "nullable": true,
            "type": "string"
          },
          "released_at": {
            "nullable": true,
            "type": "string"
          },
          "lat": {
            "nullable": true,
            "type": "number"
          },
          "lng": {
            "nullable": true,
            "type": "number"
          },
          "address": {
            "nullable": true,
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          },
          "rev": {
            "type": "number"
          }
        },
        "required": [
          "id",
          "qr_code",
          "chip_no",
          "sex",
          "age_group",
          "colour",
          "markings",
          "weight_kg",
          "org_unit_id",
          "status",
          "captured_at",
          "sterilised_at",
          "last_vaccinated_at",
          "vaccination_due_on",
          "released_at",
          "lat",
          "lng",
          "address",
          "created_at",
          "updated_at",
          "rev"
        ],
        "additionalProperties": false
      },
      "DogList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "qr_code": {
                  "nullable": true,
                  "type": "string"
                },
                "chip_no": {
                  "nullable": true,
                  "type": "string"
                },
                "sex": {
                  "type": "string",
                  "enum": [
                    "male",
                    "female",
                    "unknown"
                  ]
                },
                "age_group": {
                  "nullable": true,
                  "type": "string",
                  "enum": [
                    "puppy",
                    "young",
                    "adult",
                    "old"
                  ]
                },
                "colour": {
                  "nullable": true,
                  "type": "string"
                },
                "markings": {
                  "nullable": true,
                  "type": "string"
                },
                "weight_kg": {
                  "nullable": true,
                  "type": "number"
                },
                "org_unit_id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "registered",
                    "captured",
                    "in_centre",
                    "released",
                    "adopted",
                    "dead"
                  ]
                },
                "captured_at": {
                  "nullable": true,
                  "type": "string"
                },
                "sterilised_at": {
                  "nullable": true,
                  "type": "string"
                },
                "last_vaccinated_at": {
                  "nullable": true,
                  "type": "string"
                },
                "vaccination_due_on": {
                  "nullable": true,
                  "type": "string"
                },
                "released_at": {
                  "nullable": true,
                  "type": "string"
                },
                "lat": {
                  "nullable": true,
                  "type": "number"
                },
                "lng": {
                  "nullable": true,
                  "type": "number"
                },
                "address": {
                  "nullable": true,
                  "type": "string"
                },
                "created_at": {
                  "type": "string"
                },
                "updated_at": {
                  "type": "string"
                },
                "rev": {
                  "type": "number"
                },
                "org_unit_name": {
                  "type": "string"
                },
                "photo_id": {
                  "nullable": true,
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                }
              },
              "required": [
                "id",
                "qr_code",
                "chip_no",
                "sex",
                "age_group",
                "colour",
                "markings",
                "weight_kg",
                "org_unit_id",
                "status",
                "captured_at",
                "sterilised_at",
                "last_vaccinated_at",
                "vaccination_due_on",
                "released_at",
                "lat",
                "lng",
                "address",
                "created_at",
                "updated_at",
                "rev",
                "org_unit_name",
                "photo_id"
              ],
              "additionalProperties": false
            }
          },
          "total": {
            "type": "number"
          }
        },
        "required": [
          "items",
          "total"
        ],
        "additionalProperties": false
      },
      "DogDetail": {
        "type": "object",
        "properties": {
          "dog": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "qr_code": {
                "nullable": true,
                "type": "string"
              },
              "chip_no": {
                "nullable": true,
                "type": "string"
              },
              "sex": {
                "type": "string",
                "enum": [
                  "male",
                  "female",
                  "unknown"
                ]
              },
              "age_group": {
                "nullable": true,
                "type": "string",
                "enum": [
                  "puppy",
                  "young",
                  "adult",
                  "old"
                ]
              },
              "colour": {
                "nullable": true,
                "type": "string"
              },
              "markings": {
                "nullable": true,
                "type": "string"
              },
              "weight_kg": {
                "nullable": true,
                "type": "number"
              },
              "org_unit_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "status": {
                "type": "string",
                "enum": [
                  "registered",
                  "captured",
                  "in_centre",
                  "released",
                  "adopted",
                  "dead"
                ]
              },
              "captured_at": {
                "nullable": true,
                "type": "string"
              },
              "sterilised_at": {
                "nullable": true,
                "type": "string"
              },
              "last_vaccinated_at": {
                "nullable": true,
                "type": "string"
              },
              "vaccination_due_on": {
                "nullable": true,
                "type": "string"
              },
              "released_at": {
                "nullable": true,
                "type": "string"
              },
              "lat": {
                "nullable": true,
                "type": "number"
              },
              "lng": {
                "nullable": true,
                "type": "number"
              },
              "address": {
                "nullable": true,
                "type": "string"
              },
              "created_at": {
                "type": "string"
              },
              "updated_at": {
                "type": "string"
              },
              "rev": {
                "type": "number"
              }
            },
            "required": [
              "id",
              "qr_code",
              "chip_no",
              "sex",
              "age_group",
              "colour",
              "markings",
              "weight_kg",
              "org_unit_id",
              "status",
              "captured_at",
              "sterilised_at",
              "last_vaccinated_at",
              "vaccination_due_on",
              "released_at",
              "lat",
              "lng",
              "address",
              "created_at",
              "updated_at",
              "rev"
            ],
            "additionalProperties": false
          },
          "events": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "dog_id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "capture",
                    "intake",
                    "surgery",
                    "tagging",
                    "vaccination",
                    "postop_check",
                    "release",
                    "adoption",
                    "death",
                    "resight"
                  ]
                },
                "occurred_at": {
                  "type": "string"
                },
                "recorded_at": {
                  "type": "string"
                },
                "lat": {
                  "nullable": true,
                  "type": "number"
                },
                "lng": {
                  "nullable": true,
                  "type": "number"
                },
                "accuracy_m": {
                  "nullable": true,
                  "type": "number"
                },
                "address": {
                  "nullable": true,
                  "type": "string"
                },
                "org_unit_id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "user_id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "user_name": {
                  "type": "string"
                },
                "device_id": {
                  "nullable": true,
                  "type": "string"
                },
                "data": {
                  "type": "object",
                  "additionalProperties": {}
                },
                "rev": {
                  "type": "number"
                }
              },
              "required": [
                "id",
                "dog_id",
                "type",
                "occurred_at",
                "recorded_at",
                "lat",
                "lng",
                "accuracy_m",
                "address",
                "org_unit_id",
                "user_id",
                "device_id",
                "data",
                "rev"
              ],
              "additionalProperties": false
            }
          },
          "photos": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "dog_id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "event_id": {
                  "nullable": true,
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "mime": {
                  "type": "string"
                },
                "bytes": {
                  "type": "number"
                },
                "taken_at": {
                  "type": "string"
                },
                "rev": {
                  "type": "number"
                }
              },
              "required": [
                "id",
                "dog_id",
                "event_id",
                "mime",
                "bytes",
                "taken_at",
                "rev"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "dog",
          "events",
          "photos"
        ],
        "additionalProperties": false
      },
      "DogPoint": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "lat": {
            "type": "number"
          },
          "lng": {
            "type": "number"
          },
          "status": {
            "type": "string",
            "enum": [
              "registered",
              "captured",
              "in_centre",
              "released",
              "adopted",
              "dead"
            ]
          },
          "sex": {
            "type": "string",
            "enum": [
              "male",
              "female",
              "unknown"
            ]
          }
        },
        "required": [
          "id",
          "lat",
          "lng",
          "status",
          "sex"
        ],
        "additionalProperties": false
      },
      "OrgUnit": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "parent_id": {
            "nullable": true,
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "type": {
            "type": "string",
            "enum": [
              "state",
              "district",
              "local_body",
              "centre"
            ]
          },
          "name": {
            "type": "string"
          },
          "code": {
            "nullable": true,
            "type": "string"
          },
          "path": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "parent_id",
          "type",
          "name",
          "code",
          "path"
        ],
        "additionalProperties": false
      },
      "StatsSummary": {
        "type": "object",
        "properties": {
          "totals": {
            "type": "object",
            "properties": {
              "registered": {
                "type": "number"
              },
              "sterilised": {
                "type": "number"
              },
              "vaccinated": {
                "type": "number"
              },
              "released": {
                "type": "number"
              },
              "in_centre": {
                "type": "number"
              },
              "adopted": {
                "type": "number"
              },
              "dead": {
                "type": "number"
              },
              "vaccination_overdue": {
                "type": "number"
              }
            },
            "required": [
              "registered",
              "sterilised",
              "vaccinated",
              "released",
              "in_centre",
              "adopted",
              "dead",
              "vaccination_overdue"
            ],
            "additionalProperties": false
          },
          "by_sex": {
            "type": "object",
            "properties": {
              "male": {
                "type": "number"
              },
              "female": {
                "type": "number"
              },
              "unknown": {
                "type": "number"
              }
            },
            "required": [
              "male",
              "female",
              "unknown"
            ],
            "additionalProperties": false
          },
          "daily": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "date": {
                  "type": "string"
                },
                "capture": {
                  "type": "number"
                },
                "surgery": {
                  "type": "number"
                },
                "vaccination": {
                  "type": "number"
                },
                "release": {
                  "type": "number"
                }
              },
              "required": [
                "date",
                "capture",
                "surgery",
                "vaccination",
                "release"
              ],
              "additionalProperties": false
            }
          },
          "by_unit": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "org_unit_id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "name": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "state",
                    "district",
                    "local_body",
                    "centre"
                  ]
                },
                "registered": {
                  "type": "number"
                },
                "sterilised": {
                  "type": "number"
                },
                "vaccinated": {
                  "type": "number"
                },
                "released": {
                  "type": "number"
                }
              },
              "required": [
                "org_unit_id",
                "name",
                "type",
                "registered",
                "sterilised",
                "vaccinated",
                "released"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "totals",
          "by_sex",
          "daily",
          "by_unit"
        ],
        "additionalProperties": false
      },
      "PullResponse": {
        "type": "object",
        "properties": {
          "dogs": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "qr_code": {
                  "nullable": true,
                  "type": "string"
                },
                "chip_no": {
                  "nullable": true,
                  "type": "string"
                },
                "sex": {
                  "type": "string",
                  "enum": [
                    "male",
                    "female",
                    "unknown"
                  ]
                },
                "age_group": {
                  "nullable": true,
                  "type": "string",
                  "enum": [
                    "puppy",
                    "young",
                    "adult",
                    "old"
                  ]
                },
                "colour": {
                  "nullable": true,
                  "type": "string"
                },
                "markings": {
                  "nullable": true,
                  "type": "string"
                },
                "weight_kg": {
                  "nullable": true,
                  "type": "number"
                },
                "org_unit_id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "registered",
                    "captured",
                    "in_centre",
                    "released",
                    "adopted",
                    "dead"
                  ]
                },
                "captured_at": {
                  "nullable": true,
                  "type": "string"
                },
                "sterilised_at": {
                  "nullable": true,
                  "type": "string"
                },
                "last_vaccinated_at": {
                  "nullable": true,
                  "type": "string"
                },
                "vaccination_due_on": {
                  "nullable": true,
                  "type": "string"
                },
                "released_at": {
                  "nullable": true,
                  "type": "string"
                },
                "lat": {
                  "nullable": true,
                  "type": "number"
                },
                "lng": {
                  "nullable": true,
                  "type": "number"
                },
                "address": {
                  "nullable": true,
                  "type": "string"
                },
                "created_at": {
                  "type": "string"
                },
                "updated_at": {
                  "type": "string"
                },
                "rev": {
                  "type": "number"
                }
              },
              "required": [
                "id",
                "qr_code",
                "chip_no",
                "sex",
                "age_group",
                "colour",
                "markings",
                "weight_kg",
                "org_unit_id",
                "status",
                "captured_at",
                "sterilised_at",
                "last_vaccinated_at",
                "vaccination_due_on",
                "released_at",
                "lat",
                "lng",
                "address",
                "created_at",
                "updated_at",
                "rev"
              ],
              "additionalProperties": false
            }
          },
          "events": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "dog_id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "capture",
                    "intake",
                    "surgery",
                    "tagging",
                    "vaccination",
                    "postop_check",
                    "release",
                    "adoption",
                    "death",
                    "resight"
                  ]
                },
                "occurred_at": {
                  "type": "string"
                },
                "recorded_at": {
                  "type": "string"
                },
                "lat": {
                  "nullable": true,
                  "type": "number"
                },
                "lng": {
                  "nullable": true,
                  "type": "number"
                },
                "accuracy_m": {
                  "nullable": true,
                  "type": "number"
                },
                "address": {
                  "nullable": true,
                  "type": "string"
                },
                "org_unit_id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "user_id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "user_name": {
                  "type": "string"
                },
                "device_id": {
                  "nullable": true,
                  "type": "string"
                },
                "data": {
                  "type": "object",
                  "additionalProperties": {}
                },
                "rev": {
                  "type": "number"
                }
              },
              "required": [
                "id",
                "dog_id",
                "type",
                "occurred_at",
                "recorded_at",
                "lat",
                "lng",
                "accuracy_m",
                "address",
                "org_unit_id",
                "user_id",
                "device_id",
                "data",
                "rev"
              ],
              "additionalProperties": false
            }
          },
          "photos": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "dog_id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "event_id": {
                  "nullable": true,
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "mime": {
                  "type": "string"
                },
                "bytes": {
                  "type": "number"
                },
                "taken_at": {
                  "type": "string"
                },
                "rev": {
                  "type": "number"
                }
              },
              "required": [
                "id",
                "dog_id",
                "event_id",
                "mime",
                "bytes",
                "taken_at",
                "rev"
              ],
              "additionalProperties": false
            }
          },
          "cursor": {
            "type": "number"
          },
          "has_more": {
            "type": "boolean"
          }
        },
        "required": [
          "dogs",
          "events",
          "photos",
          "cursor",
          "has_more"
        ],
        "additionalProperties": false
      },
      "PublicTag": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "organisation": {
            "type": "string"
          },
          "registered": {
            "type": "boolean"
          },
          "sex": {
            "type": "string",
            "enum": [
              "male",
              "female",
              "unknown"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "registered",
              "captured",
              "in_centre",
              "released",
              "adopted",
              "dead"
            ]
          },
          "sterilised_on": {
            "nullable": true,
            "type": "string"
          },
          "vaccinated_on": {
            "nullable": true,
            "type": "string"
          },
          "vaccination_due_on": {
            "nullable": true,
            "type": "string"
          }
        },
        "required": [
          "code",
          "organisation",
          "registered"
        ],
        "additionalProperties": false
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "error",
          "message"
        ],
        "additionalProperties": false
      }
    }
  }
}