{
	"openapi": "3.0.0",
	"components": {
		"examples": {},
		"headers": {},
		"parameters": {},
		"requestBodies": {},
		"responses": {},
		"schemas": {
			"ReinstatementTypeCodeResponse": {
				"enum": [
					1,
					2,
					3,
					4,
					5,
					6,
					7,
					8,
					9,
					10,
					999
				],
				"type": "number"
			},
			"ReinstatementTypeDetails": {
				"properties": {
					"reinstatement_type_code": {
						"$ref": "#/components/schemas/ReinstatementTypeCodeResponse"
					},
					"reinstatement_type_code_string": {
						"type": "string"
					},
					"reinstatement_type_location_text": {
						"type": "string",
						"nullable": true
					},
					"is_active": {
						"type": "boolean"
					}
				},
				"required": [
					"reinstatement_type_code",
					"reinstatement_type_code_string",
					"is_active"
				],
				"type": "object",
				"additionalProperties": false
			},
			"PrimaryNoticeAuthority": {
				"properties": {
					"swa_code": {
						"type": "string"
					},
					"name": {
						"type": "string"
					},
					"location_description": {
						"type": "string"
					},
					"record_end_date": {
						"type": "string",
						"format": "date-time"
					}
				},
				"required": [
					"swa_code",
					"name",
					"location_description"
				],
				"type": "object",
				"additionalProperties": false
			},
			"InterestAuthority": {
				"properties": {
					"name": {
						"type": "string"
					},
					"location_description": {
						"type": "string"
					},
					"swa_code": {
						"type": "string"
					},
					"record_end_date": {
						"type": "string",
						"format": "date-time"
					}
				},
				"required": [
					"name",
					"location_description",
					"swa_code"
				],
				"type": "object",
				"additionalProperties": false
			},
			"AdditionalSpecialDesignationCodeResponse": {
				"enum": [
					1,
					2,
					3,
					6,
					8,
					9,
					10,
					12,
					13,
					16,
					17,
					18,
					19,
					20,
					21,
					22,
					23,
					24,
					25,
					26,
					27,
					28,
					29,
					30,
					999
				],
				"type": "number"
			},
			"AdditionalSpecialDesignationsPeriodicityCodeResponse": {
				"enum": [
					1,
					2,
					3,
					7,
					8,
					9,
					10,
					11,
					12,
					13,
					14,
					15,
					16,
					999
				],
				"type": "number"
			},
			"GeoJSONFeatureTypeResponse": {
				"enum": [
					"Point",
					"LineString",
					"Polygon",
					"MultiLineString",
					"upcoming_enum"
				],
				"type": "string"
			},
			"GeoJSONGeometry": {
				"properties": {
					"type": {
						"$ref": "#/components/schemas/GeoJSONFeatureTypeResponse"
					},
					"type_string": {
						"type": "string"
					},
					"coordinates": {}
				},
				"required": [
					"type",
					"type_string",
					"coordinates"
				],
				"type": "object",
				"additionalProperties": false
			},
			"AdditionalSpecialDesignationsResponse": {
				"properties": {
					"street_special_desig_code": {
						"$ref": "#/components/schemas/AdditionalSpecialDesignationCodeResponse"
					},
					"street_special_desig_code_string": {
						"type": "string",
						"nullable": true
					},
					"special_desig_location_text": {
						"type": "string",
						"nullable": true
					},
					"special_desig_description": {
						"type": "string",
						"nullable": true
					},
					"special_desig_start_time": {
						"type": "number",
						"format": "double",
						"nullable": true
					},
					"special_desig_end_time": {
						"type": "number",
						"format": "double",
						"nullable": true
					},
					"special_desig_periodicity_code": {
						"allOf": [
							{
								"$ref": "#/components/schemas/AdditionalSpecialDesignationsPeriodicityCodeResponse"
							}
						],
						"nullable": true
					},
					"special_desig_periodicity_code_string": {
						"type": "string",
						"nullable": true
					},
					"asd_coordinate_geometry": {
						"allOf": [
							{
								"$ref": "#/components/schemas/GeoJSONGeometry"
							}
						],
						"nullable": true
					},
					"whole_road": {
						"type": "boolean",
						"nullable": true
					},
					"special_desig_start_date": {
						"type": "string",
						"format": "date-time",
						"nullable": true
					},
					"special_desig_end_date": {
						"type": "string",
						"format": "date-time",
						"nullable": true
					}
				},
				"required": [
					"street_special_desig_code"
				],
				"type": "object",
				"additionalProperties": false
			},
			"GeoJSONMultiLineStringType": {
				"enum": [
					"MultiLineString"
				],
				"type": "string"
			},
			"GeoJSONMultiLineString": {
				"properties": {
					"type": {
						"$ref": "#/components/schemas/GeoJSONMultiLineStringType"
					},
					"coordinates": {
						"items": {
							"items": {
								"items": {
									"type": "number",
									"format": "double"
								},
								"type": "array"
							},
							"type": "array"
						},
						"type": "array"
					}
				},
				"required": [
					"type",
					"coordinates"
				],
				"type": "object",
				"additionalProperties": false
			},
			"GeoJSONCentrePointType": {
				"enum": [
					"Point"
				],
				"type": "string"
			},
			"GeoJSONCentrePoint": {
				"properties": {
					"type": {
						"$ref": "#/components/schemas/GeoJSONCentrePointType"
					},
					"coordinates": {
						"items": {
							"type": "number",
							"format": "double"
						},
						"type": "array"
					}
				},
				"required": [
					"type",
					"coordinates"
				],
				"type": "object",
				"additionalProperties": false
			},
			"StreetResponse": {
				"properties": {
					"usrn": {
						"type": "number",
						"format": "double"
					},
					"street_descriptor": {
						"type": "string"
					},
					"area": {
						"type": "string"
					},
					"town": {
						"type": "string"
					},
					"authority": {
						"type": "string"
					},
					"authority_swa_code": {
						"type": "string"
					},
					"road_category": {
						"type": "number",
						"format": "double",
						"description": "DEPRECATED"
					},
					"reinstatement_types": {
						"items": {
							"$ref": "#/components/schemas/ReinstatementTypeDetails"
						},
						"type": "array"
					},
					"traffic_sensitive": {
						"type": "boolean"
					},
					"primary_notice_authorities": {
						"items": {
							"$ref": "#/components/schemas/PrimaryNoticeAuthority"
						},
						"type": "array"
					},
					"interest_authorities": {
						"items": {
							"$ref": "#/components/schemas/InterestAuthority"
						},
						"type": "array"
					},
					"additional_special_designations_response": {
						"items": {
							"$ref": "#/components/schemas/AdditionalSpecialDesignationsResponse"
						},
						"type": "array"
					},
					"street_line": {
						"allOf": [
							{
								"$ref": "#/components/schemas/GeoJSONMultiLineString"
							}
						],
						"nullable": true
					},
					"street_centre_point": {
						"allOf": [
							{
								"$ref": "#/components/schemas/GeoJSONCentrePoint"
							}
						],
						"nullable": true
					}
				},
				"required": [
					"usrn",
					"street_descriptor",
					"area",
					"town",
					"authority",
					"authority_swa_code",
					"road_category",
					"reinstatement_types",
					"traffic_sensitive",
					"primary_notice_authorities",
					"interest_authorities",
					"additional_special_designations_response"
				],
				"type": "object",
				"additionalProperties": false
			},
			"Coordinates": {
				"properties": {
					"easting": {
						"type": "number",
						"format": "double",
						"description": "Required\nBritish National Grid (EPSG:27700) easting\nMinimum value 80000\nMaximum value 656100"
					},
					"northing": {
						"type": "number",
						"format": "double",
						"description": "Required\nBritish National Grid (EPSG:27700) northing\nMinimum value 5000\nMaximum value 657700"
					}
				},
				"required": [
					"easting",
					"northing"
				],
				"type": "object",
				"additionalProperties": false
			},
			"StreetsRequest": {
				"properties": {
					"coordinates": {
						"items": {
							"$ref": "#/components/schemas/Coordinates"
						},
						"type": "array",
						"description": "Required\nMinimum size of 1\nMaximum size of 10\nEach coordinate pair must be unique (no two entries may have the same easting and northing)"
					}
				},
				"required": [
					"coordinates"
				],
				"type": "object",
				"additionalProperties": false
			},
			"UsrnStreetRequest": {
				"properties": {
					"usrns": {
						"items": {
							"type": "number",
							"format": "double"
						},
						"type": "array",
						"description": "Minimum size of 1\nMaximum size of 25\nEach element must be a minimum value of 100001 and a maximum value of 99999999\nEach element must be unique\nEach element must be a whole number"
					}
				},
				"required": [
					"usrns"
				],
				"type": "object",
				"additionalProperties": false
			},
			"StreetSummaryResponse": {
				"properties": {
					"street_descriptor": {
						"type": "string",
						"description": "Required\nThe street name, taken from the NSG street descriptor record"
					},
					"area": {
						"type": "string",
						"description": "Required\nThe locality name, taken from the NSG street descriptor record"
					},
					"town": {
						"type": "string",
						"description": "Required\nThe town name, taken from the NSG street descriptor record"
					},
					"usrn": {
						"type": "number",
						"format": "double",
						"description": "Required\nThe Unique Street Reference Number (USRN) of the street"
					},
					"administrative_area": {
						"type": "string",
						"description": "Required\nThe administrative area, taken from the NSG street descriptor record"
					},
					"street_centre_point": {
						"$ref": "#/components/schemas/GeoJSONCentrePoint",
						"description": "Required\nThe centre point of the street geometry as a GeoJSON Point\nOnly streets that have a geometry are returned, so this is always present"
					}
				},
				"required": [
					"street_descriptor",
					"area",
					"town",
					"usrn",
					"administrative_area",
					"street_centre_point"
				],
				"type": "object",
				"additionalProperties": false
			}
		},
		"securitySchemes": {
			"token": {
				"type": "apiKey",
				"name": "token",
				"in": "header"
			}
		}
	},
	"info": {
		"title": "Street Manager Street Lookup API",
		"version": "1.0.0",
		"description": "See API specification Resource Guide > Street Lookup API for more information on endpoints\nNOTE: Swagger Editor/UI does not display all description text for enumerations and child elements, check swagger.json for full description text",
		"license": {
			"name": "MIT"
		},
		"contact": {}
	},
	"paths": {
		"/nsg/streets/search": {
			"post": {
				"operationId": "GetStreets",
				"responses": {
					"200": {
						"description": "NSG Street data",
						"content": {
							"application/json": {
								"schema": {
									"items": {
										"$ref": "#/components/schemas/StreetResponse"
									},
									"type": "array"
								}
							}
						}
					},
					"404": {
						"description": "Not Found"
					}
				},
				"description": "Returns NSG street data for the streets within 25 metres of each of the supplied coordinate pairs.\n\nAccess: the user must have the Planner, HighwayAuthority or Contractor role (a user with none of these, a suspended or disabled organisation, or a contractor without an active contracting organisation is rejected with 401); in addition the request must come from an API user or carry the frontend token.\nBusiness constraints: closed (state 4) and addressing-purposes-only (state 5) streets and streets with a reinstatement type code above 10 are excluded; duplicate streets are returned once, ordered by distance from the coordinates, to a maximum of 100 streets; returns 404 when no street is found within 25 metres of any coordinate.\n\nSee API specification Resource Guide > Street Lookup API > Get streets endpoint for more information",
				"security": [
					{
						"token": [
							"Planner",
							"HighwayAuthority",
							"Contractor"
						]
					}
				],
				"parameters": [],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/StreetsRequest"
							}
						}
					}
				}
			}
		},
		"/nsg/streets/{usrn}": {
			"get": {
				"operationId": "GetStreetsByUsrn",
				"responses": {
					"200": {
						"description": "NSG Street data",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/StreetResponse"
								}
							}
						}
					},
					"404": {
						"description": "Not Found"
					}
				},
				"description": "Returns NSG street data for a single street identified by its USRN.\n\nAccess: the user must have the Planner, HighwayAuthority or Contractor role (a user with none of these, a suspended or disabled organisation, or a contractor without an active contracting organisation is rejected with 401); in addition the request must come from an API user or carry the frontend token.\nParameters: usrn is a required path parameter and must be a whole number from 100001 to 99999999 inclusive; a value that is not a number or is outside this range is rejected with 400.\nBusiness constraints: closed (state 4) and addressing-purposes-only (state 5) streets and streets with a reinstatement type code above 10 (or no reinstatement type) are excluded; returns 404 when no matching street exists for the USRN.\n\nSee API specification Resource Guide > Street Lookup API > Get streets endpoint (USRN) for more information",
				"security": [
					{
						"token": [
							"Planner",
							"HighwayAuthority",
							"Contractor"
						]
					}
				],
				"parameters": [
					{
						"in": "path",
						"name": "usrn",
						"required": true,
						"schema": {
							"format": "double",
							"type": "number"
						}
					}
				]
			}
		},
		"/nsg/search": {
			"get": {
				"operationId": "GetStreetsByQuery",
				"responses": {
					"200": {
						"description": "",
						"content": {
							"application/json": {
								"schema": {
									"items": {
										"$ref": "#/components/schemas/StreetSummaryResponse"
									},
									"type": "array"
								}
							}
						}
					}
				},
				"description": "Returns a summary (street descriptor, area, town, USRN, administrative area and centre point) of the NSG streets that match a free-text search query.\n\nAccess: the user must have the Planner, HighwayAuthority or Contractor role (a user with none of these, a suspended or disabled organisation, or a contractor without an active contracting organisation is rejected with 401); in addition the request must come from an API user or carry the frontend token.\nParameters: query is a required query string parameter that must not be empty and must be at most 100 characters; a missing, empty or over-length value is rejected with 400.\nBusiness constraints: the query is cleaned (leading/trailing spaces trimmed, repeated spaces collapsed, apostrophes, plus signs and hyphens treated as spaces, any other character that is not a letter, digit or space removed) and every resulting word must match the street's stored search text (an AND match, so adding words narrows the results); only streets that have a geometry are returned, each street at most once, and at most 15 streets are returned by default (configurable per environment) in no guaranteed order; no filtering by street state or reinstatement type is applied; returns 200 with an empty array when nothing matches, and also when the search itself fails (for example the database lookup exceeds 30 seconds), in which case the error is only logged.\n\nSee API specification Resource Guide > Street Lookup API > Get nsg search endpoint for more information",
				"security": [
					{
						"token": [
							"Planner",
							"HighwayAuthority",
							"Contractor"
						]
					}
				],
				"parameters": [
					{
						"in": "query",
						"name": "query",
						"required": true,
						"schema": {
							"type": "string"
						}
					}
				]
			}
		}
	},
	"servers": [
		{
			"url": "/"
		}
	]
}