{
	"openapi": "3.0.0",
	"components": {
		"examples": {},
		"headers": {},
		"parameters": {},
		"requestBodies": {},
		"responses": {},
		"schemas": {
			"WorkstreamStatusResponse": {
				"enum": [
					"active",
					"deactivated",
					"upcoming_enum"
				],
				"type": "string"
			},
			"WorkstreamResponse": {
				"description": "Details of one workstream, returned by Get workstream and, as a list, by Get workstreams.\n\nGet workstreams only returns active workstreams, ordered by prefix, so status is always active in that list. Get workstream can also return deactivated workstreams.\norganisation_reference is the organisation's SWA code padded with leading zeros to 4 characters.",
				"properties": {
					"status": {
						"$ref": "#/components/schemas/WorkstreamStatusResponse"
					},
					"status_string": {
						"type": "string"
					},
					"prefix": {
						"type": "string"
					},
					"name": {
						"type": "string"
					},
					"description": {
						"type": "string",
						"nullable": true
					},
					"contact_name": {
						"type": "string",
						"nullable": true
					},
					"contact_number": {
						"type": "string",
						"nullable": true
					},
					"contact_email": {
						"type": "string",
						"nullable": true
					},
					"emergency_contact_name": {
						"type": "string",
						"nullable": true
					},
					"emergency_contact_number": {
						"type": "string",
						"nullable": true
					},
					"organisation_reference": {
						"type": "string"
					}
				},
				"required": [
					"status",
					"status_string",
					"prefix",
					"name",
					"organisation_reference"
				],
				"type": "object",
				"additionalProperties": false
			},
			"WorkstreamCreateResponse": {
				"properties": {
					"prefix": {
						"type": "string"
					}
				},
				"required": [
					"prefix"
				],
				"type": "object",
				"additionalProperties": false
			},
			"WorkstreamCreateRequest": {
				"description": "Leading and trailing spaces are removed from every text value before it is validated and saved.\n\nThe inherited fields internal_user_identifier and internal_user_name are both optional (max length 100 characters each).",
				"properties": {
					"internal_user_identifier": {
						"type": "string",
						"nullable": true,
						"description": "Max length 100 characters"
					},
					"internal_user_name": {
						"type": "string",
						"nullable": true,
						"description": "Max length 100 characters"
					},
					"prefix": {
						"type": "string",
						"description": "Required\nExactly 3 characters, forming a whole number of 0 or more (for example 001 or 123)\nMust not already be used by another workstream of your organisation, including inactive ones"
					},
					"name": {
						"type": "string",
						"description": "Required\nMust not be empty\nMax length 60 characters"
					},
					"description": {
						"type": "string",
						"nullable": true,
						"description": "Optional\nMax length 500 characters"
					},
					"contact_name": {
						"type": "string",
						"nullable": true,
						"description": "Optional\nMax length 50 characters"
					},
					"contact_number": {
						"type": "string",
						"nullable": true,
						"description": "Optional\nMax length 20 characters"
					},
					"contact_email": {
						"type": "string",
						"nullable": true,
						"description": "Optional\nMax length 320 characters"
					},
					"emergency_contact_name": {
						"type": "string",
						"nullable": true,
						"description": "Optional\nMax length 100 characters"
					},
					"emergency_contact_number": {
						"type": "string",
						"nullable": true,
						"description": "Optional\nMax length 100 characters"
					}
				},
				"required": [
					"prefix",
					"name"
				],
				"type": "object",
				"additionalProperties": false
			},
			"WorkstreamUpdateRequest": {
				"description": "Also accepts the optional internal_user_identifier and internal_user_name fields (each max length 100 characters), which are recorded against the audit entry for the update.\nAll values are trimmed of leading and trailing spaces before they are validated and saved.\nThe workstream prefix cannot be changed; it is identified by the URL.",
				"properties": {
					"internal_user_identifier": {
						"type": "string",
						"nullable": true,
						"description": "Max length 100 characters"
					},
					"internal_user_name": {
						"type": "string",
						"nullable": true,
						"description": "Max length 100 characters"
					},
					"name": {
						"type": "string",
						"description": "Required\nMust not be empty (a value of only spaces is treated as empty)\nMax length 60 characters"
					},
					"description": {
						"type": "string",
						"nullable": true,
						"description": "Optional, left unchanged if not sent\nMax length 500 characters"
					},
					"contact_name": {
						"type": "string",
						"nullable": true,
						"description": "Optional, left unchanged if not sent\nMax length 50 characters"
					},
					"contact_number": {
						"type": "string",
						"nullable": true,
						"description": "Optional, left unchanged if not sent\nMax length 20 characters"
					},
					"contact_email": {
						"type": "string",
						"nullable": true,
						"description": "Optional, left unchanged if not sent\nMax length 320 characters"
					},
					"emergency_contact_name": {
						"type": "string",
						"nullable": true,
						"description": "Optional, left unchanged if not sent\nMax length 100 characters"
					},
					"emergency_contact_number": {
						"type": "string",
						"nullable": true,
						"description": "Optional, left unchanged if not sent\nMax length 100 characters"
					}
				},
				"required": [
					"name"
				],
				"type": "object",
				"additionalProperties": false
			},
			"OrganisationTypeResponse": {
				"enum": [
					"PROMOTER",
					"HA",
					"CONTRACTOR",
					"upcoming_enum"
				],
				"type": "string"
			},
			"OrganisationStatusResponse": {
				"enum": [
					"active",
					"suspended",
					"disabled",
					"upcoming_enum"
				],
				"type": "string"
			},
			"OrganisationSummaryResponse": {
				"properties": {
					"name": {
						"type": "string"
					},
					"organisation_reference": {
						"type": "string"
					},
					"organisation_status": {
						"allOf": [
							{
								"$ref": "#/components/schemas/OrganisationStatusResponse"
							}
						],
						"nullable": true
					},
					"organisation_status_string": {
						"type": "string",
						"nullable": true
					}
				},
				"required": [
					"name",
					"organisation_reference"
				],
				"type": "object",
				"additionalProperties": false
			},
			"IndustrySectorResponse": {
				"enum": [
					"electric",
					"water",
					"gas",
					"telecoms",
					"transport",
					"highway_authority",
					"other",
					"upcoming_enum"
				],
				"type": "string"
			},
			"OrganisationResponse": {
				"description": "Details of one organisation, returned by GET /organisations/{organisationReference}.\nThe primary contact and primary admin fields are only returned when the requested organisation is the caller's own organisation.\nThe contractors field is only returned for promoter and highway authority organisations that have at least one linked contractor.\nThe industry sector fields are only returned when the organisation has an industry sector.\nThe organisation reference is padded with leading zeros to 4 characters for promoter and highway authority organisations.",
				"properties": {
					"name": {
						"type": "string"
					},
					"organisation_reference": {
						"type": "string"
					},
					"organisation_status": {
						"allOf": [
							{
								"$ref": "#/components/schemas/OrganisationStatusResponse"
							}
						],
						"nullable": true
					},
					"organisation_status_string": {
						"type": "string",
						"nullable": true
					},
					"address_line_one": {
						"type": "string"
					},
					"address_line_two": {
						"type": "string",
						"nullable": true
					},
					"email": {
						"type": "string",
						"nullable": true
					},
					"locality": {
						"type": "string",
						"nullable": true
					},
					"phone_number": {
						"type": "string"
					},
					"postcode": {
						"type": "string"
					},
					"town": {
						"type": "string",
						"nullable": true
					},
					"prefix": {
						"type": "string"
					},
					"organisation_type": {
						"$ref": "#/components/schemas/OrganisationTypeResponse"
					},
					"organisation_type_string": {
						"type": "string"
					},
					"contractors": {
						"items": {
							"$ref": "#/components/schemas/OrganisationSummaryResponse"
						},
						"type": "array",
						"nullable": true
					},
					"is_hs2_applicable": {
						"type": "boolean"
					},
					"primary_contact_name": {
						"type": "string"
					},
					"primary_contact_email": {
						"type": "string"
					},
					"primary_contact_number": {
						"type": "string"
					},
					"primary_admin_name": {
						"type": "string"
					},
					"primary_admin_email": {
						"type": "string"
					},
					"primary_admin_number": {
						"type": "string"
					},
					"industry_sector": {
						"allOf": [
							{
								"$ref": "#/components/schemas/IndustrySectorResponse"
							}
						],
						"nullable": true
					},
					"industry_sector_string": {
						"type": "string",
						"nullable": true
					}
				},
				"required": [
					"name",
					"organisation_reference",
					"address_line_one",
					"phone_number",
					"postcode",
					"prefix",
					"organisation_type",
					"organisation_type_string",
					"is_hs2_applicable"
				],
				"type": "object",
				"additionalProperties": false
			},
			"OrganisationType": {
				"enum": [
					"PROMOTER",
					"HA",
					"CONTRACTOR"
				],
				"type": "string"
			},
			"IndustrySector": {
				"enum": [
					"electric",
					"water",
					"gas",
					"telecoms",
					"transport",
					"highway_authority",
					"other"
				],
				"type": "string"
			},
			"OrganisationUpdateRequest": {
				"properties": {
					"address_line_one": {
						"type": "string",
						"description": "Max length 255 characters\nAlphanumeric characters only"
					},
					"address_line_two": {
						"type": "string",
						"nullable": true,
						"description": "Max length 255 characters\nAlphanumeric characters only"
					},
					"locality": {
						"type": "string",
						"nullable": true,
						"description": "Max length 255 characters\nAlphanumeric characters only"
					},
					"town": {
						"type": "string",
						"nullable": true,
						"description": "Max length 255 characters\nAlphanumeric characters only"
					},
					"postcode": {
						"type": "string",
						"description": "Max length 8 characters\nAlphanumeric characters only"
					},
					"email": {
						"type": "string",
						"nullable": true,
						"description": "Max length 320 characters\nMust be valid email"
					},
					"phone_number": {
						"type": "string",
						"description": "Max length 20 characters"
					},
					"primary_contact_name": {
						"type": "string",
						"description": "Max length 100 characters"
					},
					"primary_contact_email": {
						"type": "string",
						"description": "Max length 100 characters\nMust be valid email"
					},
					"primary_contact_number": {
						"type": "string",
						"description": "Max length 20 characters"
					},
					"primary_admin_name": {
						"type": "string",
						"description": "Max length 100 characters"
					},
					"primary_admin_email": {
						"type": "string",
						"description": "Max length 100 characters\nMust be valid email"
					},
					"primary_admin_number": {
						"type": "string",
						"description": "Max length 20 characters"
					},
					"industry_sector": {
						"allOf": [
							{
								"$ref": "#/components/schemas/IndustrySector"
							}
						],
						"nullable": true,
						"description": "Must be a valid IndustrySector\nMandatory if organisation is PROMOTER or HIGHWAY AUTHORITY"
					}
				},
				"required": [
					"address_line_one",
					"postcode",
					"phone_number",
					"primary_contact_name",
					"primary_contact_email",
					"primary_contact_number",
					"primary_admin_name",
					"primary_admin_email",
					"primary_admin_number"
				],
				"type": "object",
				"additionalProperties": false
			},
			"PaymentMethod": {
				"enum": [
					"bank_transfer",
					"card_payment",
					"cash",
					"cheque"
				],
				"type": "string"
			},
			"UpdateOrganisationFpnDetailsRequest": {
				"properties": {
					"authorised_officer_name": {
						"type": "string"
					},
					"payment_methods": {
						"items": {
							"$ref": "#/components/schemas/PaymentMethod"
						},
						"type": "array",
						"nullable": true
					},
					"authorised_officer_contact_details": {
						"type": "string",
						"nullable": true
					},
					"authorised_officer_address": {
						"type": "string",
						"nullable": true
					},
					"representations_contact_details": {
						"type": "string",
						"nullable": true
					},
					"representations_contact_address": {
						"type": "string",
						"nullable": true
					}
				},
				"required": [
					"authorised_officer_name"
				],
				"type": "object",
				"additionalProperties": false
			},
			"PaymentMethodResponse": {
				"enum": [
					"bank_transfer",
					"card_payment",
					"cash",
					"cheque",
					"upcoming_enum"
				],
				"type": "string"
			},
			"OrganisationFpnDetailsResponse": {
				"properties": {
					"organisation_reference": {
						"type": "string"
					},
					"authorised_officer_name": {
						"type": "string"
					},
					"authorised_officer_contact_details": {
						"type": "string",
						"nullable": true
					},
					"authorised_officer_address": {
						"type": "string",
						"nullable": true
					},
					"representations_contact_details": {
						"type": "string",
						"nullable": true
					},
					"representations_contact_address": {
						"type": "string",
						"nullable": true
					},
					"payment_methods": {
						"items": {
							"$ref": "#/components/schemas/PaymentMethodResponse"
						},
						"type": "array",
						"nullable": true
					},
					"payment_methods_string": {
						"items": {
							"type": "string"
						},
						"type": "array",
						"nullable": true
					}
				},
				"required": [
					"organisation_reference",
					"authorised_officer_name"
				],
				"type": "object",
				"additionalProperties": false
			},
			"RoleResponse": {
				"enum": [
					"Planner",
					"HighwayAuthority",
					"Admin",
					"Contractor",
					"API",
					"UI",
					"DataExport",
					"StreetWorksAdmin",
					"upcoming_enum"
				],
				"type": "string"
			},
			"WorkstreamAccessLevelResponse": {
				"enum": [
					"full_write",
					"read_only",
					"upcoming_enum"
				],
				"type": "string"
			},
			"UserWorkstreamAccessDetails": {
				"properties": {
					"workstream_prefix": {
						"type": "string"
					},
					"access_level": {
						"$ref": "#/components/schemas/WorkstreamAccessLevelResponse"
					},
					"workstream_name": {
						"type": "string"
					},
					"access_level_string": {
						"type": "string"
					}
				},
				"required": [
					"workstream_prefix",
					"access_level",
					"workstream_name",
					"access_level_string"
				],
				"type": "object",
				"additionalProperties": false
			},
			"PermissionResponse": {
				"enum": [
					"Permit",
					"Compliance",
					"Work",
					"upcoming_enum"
				],
				"type": "string"
			},
			"RolePermissionsResponse": {
				"properties": {
					"role": {
						"$ref": "#/components/schemas/RoleResponse"
					},
					"role_string": {
						"type": "string"
					},
					"permissions": {
						"items": {
							"$ref": "#/components/schemas/PermissionResponse"
						},
						"type": "array"
					},
					"permissions_string": {
						"items": {
							"type": "string"
						},
						"type": "array"
					}
				},
				"required": [
					"role",
					"role_string",
					"permissions",
					"permissions_string"
				],
				"type": "object",
				"additionalProperties": false
			},
			"UserResponse": {
				"description": "A user's profile, returned by Get user.\n\nRoles, role permissions and workstreams are scoped to an organisation, so contractor users can return different roles and workstreams depending on the caller and the swaCode query parameter. contracts is only populated for contractor users that have contracting organisations.",
				"properties": {
					"first_name": {
						"type": "string",
						"nullable": true
					},
					"last_name": {
						"type": "string",
						"nullable": true
					},
					"organisation_name": {
						"type": "string"
					},
					"roles": {
						"items": {
							"$ref": "#/components/schemas/RoleResponse"
						},
						"type": "array",
						"nullable": true
					},
					"roles_string": {
						"items": {
							"type": "string"
						},
						"type": "array",
						"nullable": true
					},
					"organisation_reference": {
						"type": "string"
					},
					"contracts": {
						"items": {
							"$ref": "#/components/schemas/OrganisationSummaryResponse"
						},
						"type": "array",
						"nullable": true
					},
					"workstreams": {
						"items": {
							"$ref": "#/components/schemas/UserWorkstreamAccessDetails"
						},
						"type": "array",
						"nullable": true
					},
					"organisation_status": {
						"allOf": [
							{
								"$ref": "#/components/schemas/OrganisationStatusResponse"
							}
						],
						"nullable": true
					},
					"organisation_status_string": {
						"type": "string",
						"nullable": true
					},
					"role_permissions": {
						"items": {
							"$ref": "#/components/schemas/RolePermissionsResponse"
						},
						"type": "array",
						"nullable": true
					}
				},
				"required": [
					"organisation_name",
					"organisation_reference"
				],
				"type": "object",
				"additionalProperties": false
			},
			"UpdateUserDetailsRequest": {
				"properties": {
					"first_name": {
						"type": "string",
						"description": "Required\nMust not be empty\nMax length 50 characters"
					},
					"last_name": {
						"type": "string",
						"description": "Required\nMust not be empty\nMax length 50 characters"
					}
				},
				"required": [
					"first_name",
					"last_name"
				],
				"type": "object",
				"additionalProperties": false
			},
			"WorkstreamAccessLevel": {
				"enum": [
					"full_write",
					"read_only"
				],
				"type": "string"
			},
			"UserWorkstreamAccess": {
				"properties": {
					"workstream_prefix": {
						"type": "string"
					},
					"access_level": {
						"$ref": "#/components/schemas/WorkstreamAccessLevel"
					}
				},
				"required": [
					"workstream_prefix",
					"access_level"
				],
				"type": "object",
				"additionalProperties": false
			},
			"UserWorkstreamAccessUpdateRequest": {
				"properties": {
					"user_workstream_access": {
						"items": {
							"$ref": "#/components/schemas/UserWorkstreamAccess"
						},
						"type": "array"
					}
				},
				"required": [
					"user_workstream_access"
				],
				"type": "object",
				"additionalProperties": false
			},
			"UserForgotPasswordRequest": {
				"properties": {
					"email": {
						"type": "string",
						"description": "Required\nMust be a valid email address"
					}
				},
				"required": [
					"email"
				],
				"type": "object",
				"additionalProperties": false
			},
			"UserResetPasswordRequest": {
				"properties": {
					"email": {
						"type": "string",
						"description": "Required\nMust be a valid email address. Not case sensitive"
					},
					"verification_code": {
						"type": "string",
						"description": "Required\nMust not be empty. The verification code from the email sent after a forgot password request"
					},
					"password": {
						"type": "string",
						"description": "Required\nMust not be empty. The new password, which must also meet the password policy"
					}
				},
				"required": [
					"email",
					"verification_code",
					"password"
				],
				"type": "object",
				"additionalProperties": false
			},
			"OrganisationContractCreateRequest": {
				"properties": {
					"contractor_organisation_reference": {
						"type": "string",
						"description": "Must be organisation reference of a contractor"
					}
				},
				"required": [
					"contractor_organisation_reference"
				],
				"type": "object",
				"additionalProperties": false
			},
			"TokenRefreshResponse": {
				"properties": {
					"id_token": {
						"type": "string"
					},
					"access_token": {
						"type": "string"
					}
				},
				"required": [
					"id_token",
					"access_token"
				],
				"type": "object",
				"additionalProperties": false
			},
			"TokenRefreshRequest": {
				"properties": {
					"refresh_token": {
						"type": "string",
						"description": "Required\nThe refresh token issued when you logged in. Must be provided as a string; its validity is checked when the tokens are refreshed"
					}
				},
				"required": [
					"refresh_token"
				],
				"type": "object",
				"additionalProperties": false
			},
			"LogoutRequest": {
				"properties": {
					"access_token": {
						"type": "string",
						"description": "Required. The user's current access token (JWT). Must be a string. It is passed to Cognito to sign the user out of all sessions; a token Cognito rejects (invalid, expired or already revoked) returns 401 'Invalid access token'."
					}
				},
				"required": [
					"access_token"
				],
				"type": "object",
				"additionalProperties": false
			},
			"Role": {
				"enum": [
					"Planner",
					"HighwayAuthority",
					"Admin",
					"Contractor",
					"API",
					"UI",
					"DataExport",
					"StreetWorksAdmin"
				],
				"type": "string"
			},
			"InviteUserRequest": {
				"properties": {
					"email": {
						"type": "string",
						"description": "Max length 100 characters"
					},
					"first_name": {
						"type": "string",
						"description": "Max length 50 characters"
					},
					"last_name": {
						"type": "string",
						"description": "Max length 50 characters"
					},
					"role": {
						"allOf": [
							{
								"$ref": "#/components/schemas/Role"
							}
						],
						"nullable": true
					}
				},
				"required": [
					"email",
					"first_name",
					"last_name"
				],
				"type": "object",
				"additionalProperties": false
			},
			"SetPasswordResponse": {
				"properties": {
					"idToken": {
						"type": "string"
					},
					"organisationReference": {
						"type": "string"
					},
					"accessToken": {
						"type": "string"
					},
					"refreshToken": {
						"type": "string"
					}
				},
				"required": [
					"idToken",
					"organisationReference",
					"accessToken",
					"refreshToken"
				],
				"type": "object",
				"additionalProperties": false
			},
			"SetPasswordRequest": {
				"properties": {
					"email": {
						"type": "string"
					},
					"password": {
						"type": "string"
					},
					"token": {
						"type": "string"
					}
				},
				"required": [
					"email",
					"password",
					"token"
				],
				"type": "object",
				"additionalProperties": false
			},
			"RemoveUserRequest": {
				"properties": {
					"email": {
						"type": "string",
						"description": "Max length 50 characters\nMust be valid email"
					}
				},
				"required": [
					"email"
				],
				"type": "object",
				"additionalProperties": false
			},
			"RemoveMultipleUsersRequest": {
				"properties": {
					"emails": {
						"items": {
							"type": "string"
						},
						"type": "array"
					}
				},
				"required": [
					"emails"
				],
				"type": "object",
				"additionalProperties": false
			},
			"OnboardUserRequest": {
				"properties": {
					"email": {
						"type": "string",
						"description": "Max length 100 characters"
					},
					"first_name": {
						"type": "string",
						"description": "Max length 50 characters"
					},
					"last_name": {
						"type": "string",
						"description": "Max length 50 characters"
					},
					"organisation_reference": {
						"type": "string",
						"description": "Max length 20 characters"
					},
					"roles": {
						"items": {
							"$ref": "#/components/schemas/Role"
						},
						"type": "array"
					}
				},
				"required": [
					"email",
					"first_name",
					"last_name",
					"organisation_reference",
					"roles"
				],
				"type": "object",
				"additionalProperties": false
			},
			"ReOnboardUserRequest": {
				"properties": {
					"email": {
						"type": "string",
						"description": "Max length 100 characters"
					},
					"password": {
						"type": "string",
						"nullable": true,
						"description": "Max length 99 characters"
					}
				},
				"required": [
					"email"
				],
				"type": "object",
				"additionalProperties": false
			},
			"Permission": {
				"enum": [
					"Permit",
					"Compliance",
					"Work"
				],
				"type": "string"
			},
			"InternalUpdateUserRolesRequest": {
				"properties": {
					"roles": {
						"items": {
							"$ref": "#/components/schemas/Role"
						},
						"type": "array",
						"description": "Each element must be unique"
					},
					"permissions": {
						"items": {
							"$ref": "#/components/schemas/Permission"
						},
						"type": "array",
						"description": "Each element must be unique"
					},
					"access_level": {
						"$ref": "#/components/schemas/WorkstreamAccessLevel"
					},
					"workstream_prefixes": {
						"items": {
							"type": "string"
						},
						"type": "array",
						"description": "Each element must be unique"
					}
				},
				"required": [
					"roles"
				],
				"type": "object",
				"additionalProperties": false
			},
			"AdminUpdateUserRolesRequest": {
				"properties": {
					"roles": {
						"items": {
							"$ref": "#/components/schemas/Role"
						},
						"type": "array",
						"description": "Each element must be unique\nMust be a valid combination of roles"
					},
					"permissions": {
						"items": {
							"$ref": "#/components/schemas/Permission"
						},
						"type": "array",
						"description": "Each element must be unique"
					}
				},
				"required": [
					"roles"
				],
				"type": "object",
				"additionalProperties": false
			},
			"UserCreateRequest": {
				"properties": {
					"email": {
						"type": "string",
						"description": "Max length 100 characters"
					},
					"first_name": {
						"type": "string",
						"description": "Max length 50 characters"
					},
					"last_name": {
						"type": "string",
						"description": "Max length 50 characters"
					},
					"password": {
						"type": "string",
						"description": "Max length 99 characters"
					},
					"organisation_reference": {
						"type": "string",
						"nullable": true,
						"description": "If provided, this must match a registered organisation reference"
					},
					"roles": {
						"items": {
							"$ref": "#/components/schemas/Role"
						},
						"type": "array"
					},
					"permissions": {
						"items": {
							"$ref": "#/components/schemas/Permission"
						},
						"type": "array"
					}
				},
				"required": [
					"email",
					"first_name",
					"last_name",
					"password",
					"roles"
				],
				"type": "object",
				"additionalProperties": false
			}
		},
		"securitySchemes": {
			"token": {
				"type": "apiKey",
				"name": "token",
				"in": "header"
			},
			"systemToken": {
				"type": "apiKey",
				"name": "token",
				"in": "header"
			}
		}
	},
	"info": {
		"title": "Street Manager Party API Stable",
		"version": "1.0.0",
		"description": "See API specification Resource Guide > Party 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": {
		"/organisations/{organisationReference}/workstreams/{workstreamPrefix}": {
			"get": {
				"operationId": "GetWorkstream",
				"responses": {
					"200": {
						"description": "Ok",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/WorkstreamResponse"
								}
							}
						}
					}
				},
				"description": "Returns a single workstream of an organisation, identified by the organisation reference and the workstream prefix.\n\nAccess: Authenticated user must have one of the following roles: Planner, Contractor, HighwayAuthority, Admin. Any user with one of these roles can read any organisation's workstream; there is no check that the workstream belongs to the user's organisation, contracting organisations or the user's workstream access. A contractor whose organisation has no active contracting organisation is rejected with 401, as is a user whose own organisation is suspended or disabled.\nParameters: organisationReference is the organisation's reference; leading zeros are ignored. workstreamPrefix is the workstream prefix, matched exactly as sent (it is not trimmed or reformatted). Neither parameter is format-checked.\nBusiness constraints: Responds with 404 if no organisation has the reference or the organisation has no workstream with the prefix. Deactivated workstreams are returned as well as active ones, with their status shown in the response. The returned organisation reference is padded with leading zeros to at least 4 characters. Nothing is changed or audited.\n\nSee API specification Resource Guide > Party API > Get workstream for more information",
				"security": [
					{
						"token": [
							"Planner",
							"HighwayAuthority",
							"Admin",
							"Contractor"
						]
					}
				],
				"parameters": [
					{
						"in": "path",
						"name": "organisationReference",
						"required": true,
						"schema": {
							"type": "string"
						}
					},
					{
						"in": "path",
						"name": "workstreamPrefix",
						"required": true,
						"schema": {
							"type": "string"
						}
					}
				]
			},
			"put": {
				"operationId": "UpdateWorkstream",
				"responses": {
					"204": {
						"description": ""
					}
				},
				"description": "Updates the name, description and contact details of an existing workstream belonging to your own organisation.\n\nAccess: Requires a valid token for a user with the Admin or Planner role, from an organisation that is not suspended or disabled. The user must also be an API user. The organisation reference in the path must be your own organisation (leading zeros are ignored); you cannot update another organisation's workstreams.\nParameters: The organisationReference path parameter is the organisation's SWA code, compared with your own organisation ignoring leading zeros. The workstreamPrefix path parameter must match the prefix of an existing workstream of that organisation exactly (it is not trimmed or padded).\nBusiness constraints: Returns 401 if the organisation reference is not your own, 404 if the organisation has no workstream with that prefix, and 400 if the request body fails validation; the existence check is made before the body is validated. If the request has timed out, the update is not made. The workstream prefix itself cannot be changed. The name is always replaced; optional fields you leave out keep their current value, and optional fields sent as null pass validation. A successful update returns 204 with no body and the change is recorded in the audit log. Any unexpected failure returns 500.\n\nSee API specification Resource Guide > Party API > Put workstream for more information",
				"security": [
					{
						"token": [
							"Admin",
							"Planner"
						]
					}
				],
				"parameters": [
					{
						"in": "path",
						"name": "organisationReference",
						"required": true,
						"schema": {
							"type": "string"
						}
					},
					{
						"in": "path",
						"name": "workstreamPrefix",
						"required": true,
						"schema": {
							"type": "string"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/WorkstreamUpdateRequest"
							}
						}
					}
				}
			}
		},
		"/organisations/{organisationReference}/workstreams": {
			"get": {
				"operationId": "GetWorkstreams",
				"responses": {
					"200": {
						"description": "Ok",
						"content": {
							"application/json": {
								"schema": {
									"items": {
										"$ref": "#/components/schemas/WorkstreamResponse"
									},
									"type": "array"
								}
							}
						}
					}
				},
				"description": "Returns the active workstreams of an organisation, ordered by prefix.\n\nAccess: Requires a valid token for a user with the Planner, Admin or Contractor role (a HighwayAuthority-only user is rejected). The user's organisation must not be suspended or disabled, and a Contractor user must belong to an organisation with an active contracting organisation. The user must also be an API user. There is no organisation scoping: any such user can list the workstreams of any existing organisation, not only their own.\nParameters: organisationReference is the organisation's SWA code. Leading zeros are ignored. An organisation reference that matches no organisation returns 404.\nBusiness constraints: Only active workstreams are returned; deactivated workstreams are never listed. An organisation with no active workstreams returns 200 with an empty list. Nothing is created, changed or audited.\n\nSee API specification Resource Guide > Party API > Get workstreams for more information",
				"security": [
					{
						"token": [
							"Planner",
							"Admin",
							"Contractor"
						]
					}
				],
				"parameters": [
					{
						"in": "path",
						"name": "organisationReference",
						"required": true,
						"schema": {
							"type": "string"
						}
					}
				]
			},
			"post": {
				"operationId": "CreateWorkstream",
				"responses": {
					"201": {
						"description": "Created",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/WorkstreamCreateResponse"
								}
							}
						}
					}
				},
				"description": "Creates a new, active workstream for your own organisation.\n\nAccess: Requires a valid token for a user with the Admin or Planner role and the API role, from an organisation that is not suspended or disabled (a Contractor must belong to an organisation with an active contracting organisation). You can only create workstreams for your own organisation; any other organisation reference is rejected with 401. Leading zeros in the organisation reference are ignored.\nParameters: organisationReference is the reference of your organisation. Leading zeros are ignored.\nBusiness constraints: The prefix must not already be used by any workstream of your organisation, active or not (412). If you are a Planner, you are automatically given full write access to the new workstream; Admin users are not given access automatically. Returns 201 with the new prefix. The creation and an audit entry are saved together. A request that has timed out is stopped (408) straight after the organisation check and again just before the workstream is saved.\n\nSee API specification Resource Guide > Party API > Post workstreams for more information",
				"security": [
					{
						"token": [
							"Admin",
							"Planner"
						]
					}
				],
				"parameters": [
					{
						"in": "path",
						"name": "organisationReference",
						"required": true,
						"schema": {
							"type": "string"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/WorkstreamCreateRequest"
							}
						}
					}
				}
			}
		},
		"/organisations/{organisationReference}": {
			"get": {
				"operationId": "GetOrganisation",
				"responses": {
					"200": {
						"description": "Ok",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/OrganisationResponse"
								}
							}
						}
					}
				},
				"description": "Returns the details of a single organisation.\n\nAccess: Requires a valid token for a user with the Admin, Planner, HighwayAuthority or Contractor role. The request is rejected with 401 if the token is invalid, your organisation is suspended or disabled, or you do not hold one of those roles. The user must also be an API user, otherwise the request is rejected with 401. Contractor users are normally rejected with 401 if their organisation has no active contracting organisation, but this check is skipped for this endpoint. There is no restriction on which organisation you can read: any authenticated user with an allowed role can read any organisation, whatever the status of the organisation being read.\nParameters: organisationReference (path) is the organisation's reference. Leading zeros are ignored, so 0123 and 123 identify the same organisation. No other format check is applied; a reference that matches no organisation returns 404.\nBusiness constraints: The primary contact and primary admin details are only returned when the requested organisation is your own organisation. Promoter and highway authority organisations also return their contractors (omitted when none are linked); contractor organisations never do. The industry sector is only returned when the organisation has one. The organisation reference in the response is padded with leading zeros to 4 characters for promoter and highway authority organisations. A successful request returns 200.\n\nSee API specification Resource Guide > Party API > Get organisation for more information",
				"security": [
					{
						"token": [
							"Admin",
							"Planner",
							"HighwayAuthority",
							"Contractor"
						]
					}
				],
				"parameters": [
					{
						"in": "path",
						"name": "organisationReference",
						"required": true,
						"schema": {
							"type": "string"
						}
					}
				]
			}
		},
		"/organisations": {
			"get": {
				"operationId": "GetOrganisations",
				"responses": {
					"200": {
						"description": "Ok",
						"content": {
							"application/json": {
								"schema": {
									"items": {
										"$ref": "#/components/schemas/OrganisationSummaryResponse"
									},
									"type": "array"
								}
							}
						}
					}
				},
				"description": "Returns a summary list of organisations, optionally filtered by organisation type and by part of the organisation name.\n\nAccess: You must be authenticated with one of the roles Planner, Contractor, HighwayAuthority or Admin, and be an API user.\nYour organisation must not be suspended or disabled. If you are a contractor, your organisation must have an active contracting organisation.\nParameters: Query parameters type (repeatable, PROMOTER, HA or CONTRACTOR) and query (text) are both optional. When both are supplied, only organisations that match both are returned.\nBusiness constraints: The list is not limited to your own organisation. Disabled organisations are never returned, whereas suspended organisations are returned.\nName matching is partial and not case sensitive. The result is an empty list when nothing matches, and no ordering is applied.\nOrganisation references of promoters and highway authorities are returned left padded with zeros to at least 4 characters; contractor references are returned as stored.\n\nSee API specification Resource Guide > Party API > Get organisations for more information\nAuthenticated user must have one of the following roles: Planner, Contractor, HighwayAuthority, Admin",
				"security": [
					{
						"token": [
							"Admin",
							"Planner",
							"HighwayAuthority",
							"Contractor"
						]
					}
				],
				"parameters": [
					{
						"in": "query",
						"name": "type",
						"required": false,
						"schema": {
							"type": "array",
							"items": {
								"$ref": "#/components/schemas/OrganisationType"
							}
						}
					},
					{
						"in": "query",
						"name": "query",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				]
			}
		},
		"/users/{email}": {
			"get": {
				"operationId": "GetUser",
				"responses": {
					"200": {
						"description": "Ok",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/UserResponse"
								}
							}
						}
					}
				},
				"description": "Retrieves a user's profile: organisation, roles and permissions, contracting organisations (contractors only), and workstream access.\n\nAccess: the caller must have one of the following roles: Planner, Contractor, HighwayAuthority, Admin. The caller must also be an API user. A caller can read their own record. An Admin can also read a user in the same organisation, and an Admin who is not a contractor can read a contractor user who contracts for the Admin's organisation. Any other request, and a request for a user that does not exist, is rejected with 401 Access restricted. A contractor with no active contracting organisation is still allowed to call this endpoint.\nParameters: email is the user's email address (the username), base64 encoded; matching is case-insensitive for the lookup, but a caller is only treated as reading their own record when the decoded email exactly matches their own username. swaCode is optional and only affects contractor users: it selects the contracting organisation whose workstream access is returned, and (only when a contractor reads their own record) whose roles are returned. The SWA code is accepted with or without leading zeros. If the user has contracting organisations and swaCode is not one of them the request is rejected with 401 Access restricted.\nBusiness constraints: roles, permissions and workstream access are scoped to an organisation. For non-contractor users roles come from the user's own organisation and workstream access from the caller's organisation. For contractor users the contractor roles shown for an Admin whose organisation the contractor works for are those held in the Admin's organisation, and workstream access is for the swaCode organisation when supplied, otherwise the caller's organisation. Any unexpected failure (for example an unknown swaCode for a contractor) is returned as 500 Something went wrong while retrieving user. If the request has already timed out nothing is returned.\n\nSee API specification Resource Guide > Party API > Get user",
				"security": [
					{
						"token": [
							"Admin",
							"Planner",
							"HighwayAuthority",
							"Contractor"
						]
					}
				],
				"parameters": [
					{
						"in": "path",
						"name": "email",
						"required": true,
						"schema": {
							"type": "string"
						}
					},
					{
						"in": "query",
						"name": "swaCode",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				]
			},
			"put": {
				"operationId": "UpdateUserDetails",
				"responses": {
					"204": {
						"description": "No content"
					}
				},
				"description": "Updates the first name and last name of a user.\n\nAccess: Requires a valid token for a user with the Admin, Planner, HighwayAuthority or Contractor role, from an organisation that is not suspended or disabled. A Contractor must belong to an organisation with an active contracting organisation. The user must also have the API role. A user without the Admin role can only update their own details. A user with the Admin role can only update users in their own organisation (including their own record).\nParameters: The email path parameter is the base64 encoded email address (username) of the user to update. It is decoded and matched case-insensitively.\nBusiness constraints: The user must exist. Returns 404 if no user matches the email address, 412 if the authenticated user is not allowed to update that user, and 400 if the request body fails validation. Any other failure returns 500. A successful update returns 204 with no body and the change is recorded in the audit log.\n\nSee API specification Resource Guide > Party API",
				"security": [
					{
						"token": [
							"Admin",
							"Planner",
							"HighwayAuthority",
							"Contractor"
						]
					}
				],
				"parameters": [
					{
						"in": "path",
						"name": "email",
						"required": true,
						"schema": {
							"type": "string"
						}
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/UpdateUserDetailsRequest"
							}
						}
					}
				}
			}
		},
		"/forgot-password": {
			"post": {
				"operationId": "ForgotPassword",
				"responses": {
					"204": {
						"description": "No content"
					}
				},
				"description": "Starts the forgotten password process by asking the authentication provider to send a verification code to the user's email address.\n\nAccess: No authentication is required.\nBusiness constraints: The email address is converted to lower case before it is used. The response is the same whether or not a user exists for the email address (or the provider refuses the request for that user), so the endpoint does not reveal whether an account exists. Any other failure while requesting the code is returned as a generic internal server error (500). No Street Manager data is changed and nothing is audited.\n\nSee API specification Resource Guide > Party API > Forgot Password",
				"security": [],
				"parameters": [],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/UserForgotPasswordRequest"
							}
						}
					}
				}
			}
		},
		"/reset-password": {
			"post": {
				"operationId": "ResetPassword",
				"responses": {
					"204": {
						"description": "No content"
					}
				},
				"description": "Sets a new password for a user, using the verification code that was emailed to them after a forgot password request.\n\nAccess: No authentication token is required.\nBusiness constraints: A valid, unexpired verification code that matches the email address is required, and the new password must be accepted by the password policy. If the code is wrong or expired, the password is not acceptable, or the email address is not known, the request fails with a generic 400 Bad Request, so the response does not reveal which of these applied. Other failures return 500 Internal Server Error. On success the response is 200 OK with no body.\n\nSee API specification Resource Guide > Party API > Reset Forgotten Password",
				"security": [],
				"parameters": [],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/UserResetPasswordRequest"
							}
						}
					}
				}
			}
		},
		"/refresh": {
			"post": {
				"operationId": "Refresh",
				"responses": {
					"200": {
						"description": "Ok",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/TokenRefreshResponse"
								}
							}
						}
					}
				},
				"description": "Exchanges a valid refresh token for a new ID token and access token.\n\nAccess: no authentication token or role is required; the refresh token in the request body is the only credential.\nBusiness constraints: the refresh token is checked with the identity provider, and the user's session activity time is updated when the new tokens are issued.\nAny failure while refreshing (for example an invalid, expired or revoked refresh token) is returned as a 401 Unauthorized with the message \"Invalid refresh token\". No new refresh token is issued, so keep using the one you already hold.\n\nSee API specification Resource Guide > Party API > Refresh tokens",
				"security": [],
				"parameters": [],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/TokenRefreshRequest"
							}
						}
					}
				}
			}
		},
		"/logout": {
			"post": {
				"operationId": "Logout",
				"responses": {
					"204": {
						"description": "No content"
					}
				},
				"description": "Logs a user out by asking Cognito to sign the user out of all of their sessions, using the user's access token.\n\nAccess: No authentication or role is required (no Authorization header is checked). The access token supplied in the request body is the only credential, and Cognito decides whether it is acceptable.\n\nBusiness constraints:\n- `access_token` is required in the request body and must be a string (request validation failure returns 400).\n- The access token is sent to Cognito's global sign-out, which signs the user out everywhere. Any failure from Cognito (for example an invalid, expired or already revoked token) is returned as 401 'Invalid access token'.\n- Success returns 200 with no response body.\n- If the request has already timed out when the controller runs, the method returns without calling Cognito.",
				"security": [],
				"parameters": [],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/LogoutRequest"
							}
						}
					}
				}
			}
		}
	},
	"servers": [
		{
			"url": "/"
		}
	]
}