{
  "openapi": "3.0.0",
  "info": {
    "title": "MHCLG CORE Data Collection API",
    "version": "1.0",
    "description": "Submit social housing lettings and sales data (CORE)"
  },
  "servers": [
    {
      "url": "https://dluhc-core-staging.london.cloudapps.digital/logs",
      "description": "Staging"
    }
  ],
  "paths": {
    "/logs/:id": {
      "parameters": [],
      "get": {
        "summary": "Get lettings log Info by lettings log ID",
        "tags": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/lettings-log"
                },
                "examples": {}
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {}
                },
                "examples": {
                  "Not found": {
                    "value": {
                      "error": "lettings log 67 not found"
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "get-lettings_logs-lettings_logs-:id",
        "description": "Retrieve data for a specific lettings log",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "enum": ["application/json"]
            },
            "in": "header",
            "name": "Accept",
            "required": true
          }
        ]
      },
      "patch": {
        "summary": "Update lettings log Information",
        "operationId": "patch-lettings_logs-lettings_logs-:id",
        "responses": {
          "200": {
            "description": "lettings log Updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/lettings-log"
                },
                "examples": {}
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {}
                },
                "examples": {
                  "Not found": {
                    "value": {
                      "error": "lettings log 67 not found"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity ",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {}
                },
                "examples": {
                  "Invalid Age": {
                    "value": {
                      "errors": {
                        "age1": ["Tenant age must be between 16 and 120"]
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "description": "Update the information of an existing lettings log",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/lettings-log"
              },
              "examples": {}
            }
          },
          "description": "Patch lettings log properties to update."
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "enum": ["application/json"]
            },
            "in": "header",
            "name": "Accept",
            "required": true
          }
        ]
      },
      "delete": {
        "summary": "Delete a lettings log by lettings log ID",
        "operationId": "delete-lettings_logs-:id",
        "responses": {
          "204": {
            "description": "No Content"
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {}
                },
                "examples": {
                  "Not found": {
                    "value": {
                      "error": "lettings log 67 not found"
                    }
                  }
                }
              }
            }
          }
        },
        "description": "Delete a lettings log",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "enum": ["application/json"]
            },
            "in": "header",
            "name": "Accept",
            "required": true
          }
        ]
      }
    },
    "/logs": {
      "post": {
        "summary": "Create New lettings log",
        "operationId": "post-LettingsLog",
        "responses": {
          "201": {
            "description": "lettings log Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/lettings-log"
                },
                "examples": {}
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity ",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {}
                },
                "examples": {
                  "Invalid Age and Reasonable Preference": {
                    "value": {
                      "errors": {
                        "reasonable_preference_reason": [
                          "If reasonable preference is Yes, a reason must be given"
                        ],
                        "age1": ["Tenant age must be between 16 and 120"]
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/lettings-log"
              },
              "examples": {}
            }
          },
          "description": "Post the necessary fields for the API to create a new lettings log."
        },
        "description": "Create a new lettings log.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "pattern": "application/json",
              "enum": ["application/json"]
            },
            "in": "header",
            "name": "Accept",
            "required": true
          }
        ]
      },
      "parameters": []
    }
  },
  "components": {
    "schemas": {
      "lettings-log": {
        "description": "",
        "type": "object",
        "x-examples": {
          "example-1": {
            "lettings_log": {
              "tenant_code": "T657",
              "age1": 35,
              "sex1": "F",
              "ethnic": 0,
              "national": 0,
              "prevten": 6,
              "armedforces": 0,
              "armed_forces_partner": "",
              "ecstat1": 1,
              "other_hhmemb": 7,
              "hhmemb": 8,
              "relat2": 0,
              "age2": 32,
              "sex2": "M",
              "ecstat2": 5,
              "relat3": 1,
              "age3": 12,
              "sex3": "M",
              "ecstat3": 8,
              "relat4": 1,
              "age4": 12,
              "sex4": "F",
              "ecstat4": 8,
              "relat5": 1,
              "age5": 10,
              "sex5": "X",
              "ecstat5": 8,
              "relat6": 1,
              "age6": 5,
              "sex6": "R",
              "ecstat6": 8,
              "relat7": 1,
              "age7": 5,
              "sex7": "R",
              "ecstat7": 8,
              "relat8": 1,
              "age8": 2,
              "sex8": "R",
              "ecstat8": 8,
              "homeless": 2,
              "reason": 1,
              "underoccupation_benefitcap": 0,
              "leftreg": 1,
              "reservist": 1,
              "illness": 1,
              "preg_occ": 0,
              "tenancy_code": "BZ757",
              "startdate": "12/12/2021",
              "day": 12,
              "month": 12,
              "year": 2021,
              "startertenancy": 0,
              "tenancylength": 5,
              "tenancy": 3,
              "landlord": "This landlord",
              "la": "Barnet",
              "postcode_full": "NW1 5TY",
              "property_relet": 0,
              "rsnvac": 0,
              "property_reference": "P9876",
              "unittype_gn": 2,
              "property_building_type": "dummy",
              "beds": 3,
              "property_void_date": "10/10/2020",
              "majorrepairs": 1,
              "mrcdate": "11/11/2020",
              "mrcday": 11,
              "mrcmonth": 11,
              "mrcyear": 2020,
              "offered": 2,
              "wchair": 1,
              "net_income_known": 1,
              "earnings": 150,
              "incfreq": 0,
              "benefits": 1,
              "hb": 1,
              "period": 0,
              "brent": 200,
              "scharge": 50,
              "pscharge": 40,
              "supcharg": 35,
              "tcharge": 325,
              "outstanding_amount": 1,
              "layear": 2,
              "lawaitlist": 1,
              "prevloc": "E07000105",
              "ppostcode_full": "SE2 6RT",
              "reasonpref": 1,
              "cbl": 1,
              "chr": 1,
              "cap": 0,
              "hbrentshortfall": 1,
              "tshortfall": 12,
              "reasonother": null,
              "housingneeds_a": 1,
              "housingneeds_b": 0,
              "housingneeds_c": 0,
              "housingneeds_f": 0,
              "housingneeds_g": 0,
              "housingneeds_h": 0,
              "accessibility_requirements_prefer_not_to_say": 0,
              "illness_type_1": 0,
              "illness_type_2": 1,
              "illness_type_3": 0,
              "illness_type_4": 0,
              "illness_type_8": 0,
              "illness_type_5": 0,
              "illness_type_6": 0,
              "illness_type_7": 0,
              "illness_type_9": 0,
              "illness_type_10": 0,
              "condition_effects_prefer_not_to_say": 1,
              "rp_homeless": 0,
              "rp_insan_unsat": 0,
              "rp_medwel": 0,
              "rp_hardship": 0,
              "rp_dontknow": 0,
              "discarded_at": "05/05/2020",
              "net_income_value_check": "",
              "property_owner_organisation": "",
              "property_manager_organisation": "",
              "rent_type": 0,
              "intermediate_rent_product_name": "",
              "needstype": 1,
              "purchaser_code": "",
              "propcode": "123",
              "postcode": "a1",
              "postcod2": "w3",
              "ppostc1": "w3",
              "ppostc2": "w3",
              "first_time_property_let_as_social_housing": 0,
              "unitletas": 1,
              "builtype": 0,
              "property_wheelchair_accessible": 1,
              "void_or_renewal_date": "05/05/2020",
              "renewal": 1,
              "new_build_handover_date": "01/01/2019",
              "has_benefits": 1,
              "household_charge": 1,
              "is_carehome": 1,
              "chcharge": 6,
              "shelteredaccom": 0,
              "declaration": 1
            }
          }
        },
        "title": "lettings log",
        "x-internal": false,
        "properties": {
          "tenant_code": {
            "type": "string",
            "minLength": 1
          },
          "age1": {
            "type": "number",
            "description": "The age of the lead tenant",
            "maximum": 120,
            "minimum": 0
          },
          "sex1": {
            "type": "string",
            "minLength": 1,
            "enum": ["F: Female", "M:Male", "X:Non-binary", "R:Refused"],
            "maxLength": 1
          },
          "ethnic": {
            "type": "integer",
            "minimum": 1,
            "maximum": 18
          },
          "national": {
            "type": "integer",
            "minimum": 1,
            "maximum": 17
          },
          "prevten": {
            "type": "integer"
          },
          "armedforces": {
            "type": "integer"
          },
          "ecstat1": {
            "type": "integer"
          },
          "other_hhmemb": {
            "type": "number",
            "minimum": 0,
            "maximum": 7
          },
          "relat2": {
            "type": "integer",
            "minimum": 1
          },
          "age2": {
            "type": "number",
            "maximum": 120,
            "minimum": 0
          },
          "sex2": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1
          },
          "ecstat2": {
            "type": "integer"
          },
          "relat3": {
            "type": "integer"
          },
          "age3": {
            "type": "number",
            "maximum": 120,
            "minimum": 0
          },
          "sex3": {
            "type": "string",
            "minLength": 1
          },
          "ecstat3": {
            "type": "integer"
          },
          "relat4": {
            "type": "integer"
          },
          "age4": {
            "type": "number",
            "maximum": 120,
            "minimum": 0
          },
          "sex4": {
            "type": "string",
            "minLength": 1
          },
          "ecstat4": {
            "type": "integer"
          },
          "relat5": {
            "type": "integer"
          },
          "age5": {
            "type": "number",
            "maximum": 120,
            "minimum": 0
          },
          "sex5": {
            "type": "string",
            "minLength": 1
          },
          "ecstat5": {
            "type": "integer"
          },
          "relat6": {
            "type": "integer"
          },
          "age6": {
            "type": "number",
            "maximum": 120,
            "minimum": 0
          },
          "sex6": {
            "type": "string",
            "minLength": 1
          },
          "ecstat6": {
            "type": "integer"
          },
          "relat7": {
            "type": "integer"
          },
          "age7": {
            "type": "number",
            "maximum": 120,
            "minimum": 0
          },
          "sex7": {
            "type": "string",
            "minLength": 1
          },
          "ecstat7": {
            "type": "integer"
          },
          "relat8": {
            "type": "integer"
          },
          "age8": {
            "type": "number",
            "maximum": 120,
            "minimum": 0
          },
          "sex8": {
            "type": "string",
            "minLength": 1
          },
          "ecstat8": {
            "type": "integer"
          },
          "homeless": {
            "type": "integer"
          },
          "reason": {
            "type": "integer"
          },
          "underoccupation_benefitcap": {
            "type": "integer"
          },
          "leftreg": {
            "type": "integer"
          },
          "reservist": {
            "type": "integer"
          },
          "illness": {
            "type": "integer"
          },
          "preg_occ": {
            "type": "integer"
          },
          "accessibility_requirements": {
            "type": "integer"
          },
          "condition_effects": {
            "type": "integer"
          },
          "tenancy_code": {
            "type": "string",
            "minLength": 1
          },
          "startdate": {
            "type": "string",
            "minLength": 1,
            "format": "date"
          },
          "startertenancy": {
            "type": "integer"
          },
          "tenancylength": {
            "type": "integer"
          },
          "tenancy": {
            "type": "integer"
          },
          "lettype": {
            "type": "integer"
          },
          "landlord": {
            "type": "integer"
          },
          "la": {
            "type": "string",
            "minLength": 1
          },
          "ppostcode_full": {
            "type": "string",
            "minLength": 1
          },
          "property_relet": {
            "type": "integer"
          },
          "rsnvac": {
            "type": "integer"
          },
          "property_reference": {
            "type": "string",
            "minLength": 1
          },
          "unittype_gn": {
            "type": "integer"
          },
          "property_building_type": {
            "type": "integer"
          },
          "beds": {
            "type": "number"
          },
          "property_void_date": {
            "type": "string",
            "minLength": 1,
            "format": "date"
          },
          "majorrepairs": {
            "type": "integer"
          },
          "mrcdate": {
            "type": "string",
            "minLength": 1,
            "format": "date"
          },
          "offered": {
            "type": "number"
          },
          "wchair": {
            "type": "integer"
          },
          "earnings": {
            "type": "number"
          },
          "incfreq": {
            "type": "integer"
          },
          "benefits": {
            "type": "integer"
          },
          "hb": {
            "type": "integer"
          },
          "period": {
            "type": "integer"
          },
          "brent": {
            "type": "number"
          },
          "scharge": {
            "type": "number"
          },
          "pscharge": {
            "type": "number"
          },
          "supcharg": {
            "type": "number"
          },
          "tcharge": {
            "type": "number"
          },
          "tshortfall": {
            "type": "number"
          },
          "layear": {
            "type": "integer"
          },
          "lawaitlist": {
            "type": "integer"
          },
          "prevloc": {
            "type": "string",
            "minLength": 1
          },
          "postcode_full": {
            "type": "string",
            "minLength": 1
          },
          "reasonpref": {
            "type": "integer"
          },
          "reasonable_preference_reason": {
            "type": "string",
            "minLength": 1
          },
          "cbl": {
            "type": "integer"
          },
          "chr": {
            "type": "integer"
          },
          "cap": {
            "type": "integer"
          },
          "hbrentshortfall": {
            "type": "integer"
          },
          "other_reason_for_leaving_last_settled_home": {
            "type": "string",
            "minLength": 1
          },
          "housingneeds_a": {
            "type": "integer"
          },
          "housingneeds_b": {
            "type": "integer"
          },
          "housingneeds_c": {
            "type": "integer"
          },
          "housingneeds_f": {
            "type": "integer"
          },
          "housingneeds_g": {
            "type": "integer"
          },
          "housingneeds_h": {
            "type": "integer"
          },
          "accessibility_requirements_prefer_not_to_say": {
            "type": "integer"
          },
          "illness_type_1": {
            "type": "integer"
          },
          "illness_type_2": {
            "type": "integer"
          },
          "illness_type_3": {
            "type": "integer"
          },
          "illness_type_4": {
            "type": "integer"
          },
          "illness_type_8": {
            "type": "integer"
          },
          "illness_type_5": {
            "type": "integer"
          },
          "illness_type_6": {
            "type": "integer"
          },
          "illness_type_7": {
            "type": "integer"
          },
          "illness_type_9": {
            "type": "integer"
          },
          "illness_type_10": {
            "type": "integer"
          },
          "condition_effects_prefer_not_to_say": {
            "type": "integer"
          },
          "rp_homeless": {
            "type": "integer"
          },
          "rp_insan_unsat": {
            "type": "integer"
          },
          "rp_medwel": {
            "type": "integer"
          },
          "rp_hardship": {
            "type": "integer"
          },
          "rp_dontknow": {
            "type": "integer"
          },
          "other_tenancy-type": {
            "type": "string",
            "example": "private tenancy"
          }
        },
        "required": [
          "tenant_code",
          "age1",
          "sex1",
          "ethnic",
          "national",
          "prevten",
          "armedforces",
          "ecstat1",
          "other_hhmemb",
          "relat2",
          "age2",
          "sex2",
          "ecstat2",
          "relat3",
          "age3",
          "sex3",
          "ecstat3",
          "relat4",
          "age4",
          "sex4",
          "ecstat4",
          "relat5",
          "age5",
          "sex5",
          "ecstat5",
          "relat6",
          "age6",
          "sex6",
          "ecstat6",
          "relat7",
          "age7",
          "sex7",
          "ecstat7",
          "relat8",
          "age8",
          "sex8",
          "ecstat8",
          "homeless",
          "reason",
          "underoccupation_benefitcap",
          "leftreg",
          "reservist",
          "illness",
          "preg_occ",
          "accessibility_requirements",
          "condition_effects",
          "tenancy_code",
          "startdate",
          "startertenancy",
          "tenancylength",
          "tenancy",
          "lettype",
          "landlord",
          "la",
          "ppostcode_full",
          "property_relet",
          "rsnvac",
          "property_reference",
          "unittype_gn",
          "property_building_type",
          "beds",
          "property_void_date",
          "majorrepairs",
          "mrcdate",
          "offered",
          "wchair",
          "earnings",
          "incfreq",
          "benefits",
          "hb",
          "period",
          "brent",
          "scharge",
          "pscharge",
          "supcharg",
          "tcharge",
          "tshortfall",
          "layear",
          "lawaitlist",
          "prevloc",
          "postcode_full",
          "reasonpref",
          "reasonable_preference_reason",
          "cbl",
          "chr",
          "cap",
          "hbrentshortfall",
          "other_reason_for_leaving_last_settled_home",
          "housingneeds_a",
          "housingneeds_b",
          "housingneeds_c",
          "housingneeds_f",
          "housingneeds_g",
          "housingneeds_h",
          "accessibility_requirements_prefer_not_to_say",
          "illness_type_1",
          "illness_type_2",
          "illness_type_3",
          "illness_type_4",
          "illness_type_8",
          "illness_type_5",
          "illness_type_6",
          "illness_type_7",
          "illness_type_9",
          "illness_type_10",
          "condition_effects_prefer_not_to_say",
          "rp_homeless",
          "rp_insan_unsat",
          "rp_medwel",
          "rp_hardship",
          "rp_dontknow",
          "other_tenancy-type"
        ]
      }
    },
    "securitySchemes": {
      "API Key - 1": {
        "name": "API Key",
        "type": "apiKey",
        "in": "query"
      },
      "API Key - 2": {
        "name": "API Key",
        "type": "apiKey",
        "in": "query"
      }
    }
  }
}