components:
  schemas:
    Transaction:
      description: Transaction record. The data dictionary describes the fields as text or numeric; the JSON example represents all values as strings. The schema permits either representation where the sample and declared type differ.
      properties:
        asp_sign_date:
          anyOf:
            - pattern: ^\d{2}-\d{2}-\d{4}$
              type: string
            - pattern: ^\d{2}/\d{2}/\d{4}$
              type: string
          description: Date of Agreement for Sale and Purchase (ASP), documented as text in dd-mm-yyyy format. The response example uses `15/01/2024` (dd/mm/yyyy), so both forms are allowed here to preserve the documented discrepancy.
          examples:
            - 15/01/2024
          type: string
        block_name:
          description: Block name of the purchased flat.
          type: string
        court_estate_name:
          description: Court/Estate name of the purchased flat.
          type: string
        flat_num:
          description: Flat number of the purchased flat.
          type: string
        floor_num:
          description: Floor number of the purchased flat.
          type: string
        sale_price:
          anyOf:
            - type: number
            - type: string
          description: Sale price of the purchased flat. The data dictionary declares numeric with an indicated precision/size of 999999999999999.99, while the JSON example encodes it as a string.
          examples:
            - "2680900.0"
        saleable_area:
          anyOf:
            - type: number
            - type: string
          description: Saleable area of the purchased flat in square metres. The data dictionary declares numeric with an indicated precision/size of 9999999.999, while the JSON example encodes it as a string.
          examples:
            - "35.6"
        scheme_name:
          description: Subsidised home ownership scheme.
          type: string
        scheme_type:
          description: Subsidised home ownership scheme type. The documented possible value is HOS.
          examples:
            - HOS
          type: string
        wing:
          description: Wing of the purchased flat.
          type: string
      type: object
    TransactionsResponse:
      description: Documented JSON response envelope. The specification identifies the transaction fields, but does not state requiredness or establish that the sample is a complete response contract.
      properties:
        data:
          items:
            $ref: "#/components/schemas/Transaction"
          type: array
      type: object
externalDocs:
  description: Data Specification for Transactions in the Sale of Home Ownership Scheme (HOS) Flats 2023
  url: https://data.housingauthority.gov.hk/dataset/ssfs/ssfs_sale_transactions_023_data_dictionary.pdf
info:
  description: Returns transactions data for flats sold under the Home Ownership Scheme (HOS) 2023. The version is the documentation version (25 July 2024), not necessarily an API version. The documentation states that authentication is not required. Simplified Chinese is not provided for this dataset; a Simplified Chinese request returns Traditional Chinese data.
  title: Transactions in the Sale of HOS Flats 2023
  version: "2.0"
openapi: 3.1.0
paths:
  /psi/rest/export/{dataresource}/{lang}/{format}:
    get:
      description: The documented resource returns sales transactions in JSON format. The resource information also lists JSON, CSV, and XML as response formats.
      operationId: getHos2023SaleTransactions
      parameters:
        - description: Dataset identifier. The documented valid value is `ssfs-sale-transactions-023`.
          example: ssfs-sale-transactions-023
          in: path
          name: dataresource
          required: true
          schema:
            enum:
              - ssfs-sale-transactions-023
            type: string
        - description: Language. Documented values are `en` (English) and `tc` (Traditional Chinese). The documentation also lists `sc` (Simplified Chinese), but notes that this dataset does not provide Simplified Chinese and returns Traditional Chinese data for that request.
          examples:
            english:
              value: en
            simplifiedChineseRequest:
              description: The documentation says Simplified Chinese data is unavailable and Traditional Chinese data is returned.
              value: sc
            traditionalChinese:
              value: tc
          in: path
          name: lang
          required: true
          schema:
            enum:
              - en
              - tc
              - sc
            type: string
        - description: Output file format. Documented values are JSON, CSV, and XML.
          example: json
          in: path
          name: format
          required: true
          schema:
            enum:
              - json
              - csv
              - xml
            type: string
      responses:
        "200":
          content:
            application/json:
              examples:
                documentedExample:
                  summary: Documented JSON response example
                  value:
                    data:
                      - asp_sign_date: 15/01/2024
                        block_name: BLOCK A
                        court_estate_name: SIU TSUI COURT
                        flat_num: "5"
                        floor_num: "15"
                        sale_price: "2680900.0"
                        saleable_area: "35.6"
                        scheme_name: Sale of Home Ownership Scheme Flats 2023
                        scheme_type: HOS
                        wing: ""
              schema:
                $ref: "#/components/schemas/TransactionsResponse"
            application/xml:
              schema:
                description: XML response. The documentation lists XML as a supported response format but does not specify its wire-level structure.
                type: string
            text/csv:
              schema:
                description: CSV response. The documentation lists CSV as a supported response format but does not specify its wire-level structure.
                type: string
          description: Success. The response representation depends on the requested format. The documented JSON representation is an object containing a `data` array of transaction records.
        "400":
          description: Bad Request. No error response structure is documented.
        "500":
          description: Internal Server Error. No error response structure is documented.
      summary: Get HOS flats 2023 sale transactions
servers:
  - url: https://data.housingauthority.gov.hk
