This code system https://fhir.nhs.uk/CodeSystem/Ambulance-MentalHealthLegalClass defines the following codes:

CodeDisplay
01Informal
02Formally detained under Mental Health Act Section 135
03Formally detained under Mental Health Act Section 136
04Formally detained under Mental Health Act Section 2
05Formally detained under Mental Health Act Section 3
06Formally detained under Mental Health Act Section 4
07Formally detained under Mental Health Act Section 5(2)
08Formally detained under Mental Health Act Section 5(4)
09Formally detained under Mental Health Act Section 35
10Formally detained under Mental Health Act Section 36
12Formally detained under Mental Health Act Section 37 with section 41 restrictions
13Formally detained under Mental Health Act Section 37
14Formally detained under Mental Health Act Section 38
15Formally detained under Mental Health Act Section 44
16Formally detained under Mental Health Act Section 46
17Formally detained under Mental Health Act Section 47 with section 49 restrictions
18Formally detained under Mental Health Act Section 47
19Formally detained under Mental Health Act Section 48 with section 49 restrictions
20Formally detained under Mental Health Act Section 48
31Formally detained under Criminal Procedure(Insanity) Act 1964 as amended by the Criminal Procedures (Insanity and Unfitness to Plead) Act 1991
32Formally detained under other acts
35Subject to guardianship under Mental Health Act Section 7
36Subject to guardianship under Mental Health Act Section 37
37Formally detained under Mental Health Act Section 45A (Limited direction in force)
38Formally detained under Mental Health Act Section 45A (Limitation direction ended)
98Not Applicable
99Not Known