components:
  schemas:
    Transaction:
      description: A transaction record. The data dictionary describes the following fields as text or numeric values. The provided example represents several values as strings, including numeric quantities; schemas allow those observed string representations as well as the documented numeric type where applicable.
      properties:
        asp_sign_date:
          description: Date of Agreement for Sale and Purchase (ASP). The dictionary gives the format as dd-mm-yyyy, whereas the example representation is dd/mm/yyyy.
          examples:
            - 14/06/2024
          type: string
        block_name:
          description: Block name of the purchased flat.
          type: string
        court_estate_name:
          description: Court or estate name of the purchased flat.
          type: string
        flat_num:
          description: Flat number of the purchased flat. The example represents this as text.
          type: string
        floor_num:
          description: Floor number of the purchased flat. The example represents this as text.
          type: string
        sale_price:
          anyOf:
            - type: number
            - type: string
          description: Sale price of the purchased flat. The dictionary declares a numeric value with pattern/precision notation `999999999999999.99`; the example represents it as a string.
        saleable_area:
          anyOf:
            - type: number
            - type: string
          description: Saleable area of the purchased flat in square metres. The dictionary declares a numeric value with pattern/precision notation `9999999.999`; the example represents it as a string.
        scheme_name:
          description: Subsidised home ownership scheme name.
          type: string
        scheme_type:
          description: Subsidised home ownership scheme type. The data dictionary lists GSH as a possible value.
          type: string
        wing:
          description: Wing of the purchased flat.
          type: string
      type: object
    TransactionsResponse:
      description: JSON response containing transaction records. The documented example indicates a top-level `data` array; the source does not establish that the object is closed or that every listed field is present in every record.
      properties:
        data:
          items:
            $ref: "#/components/schemas/Transaction"
          type: array
      type: object
externalDocs:
  description: Data Specification for Transactions in the Sale of GSH Flats 2023
  url: https://data.housingauthority.gov.hk/dataset/ssfs/ssfs_sale_transactions_g23_data_dictionary.pdf
info:
  description: Returns transactions data for Green Form Subsidised Home Ownership Scheme (GSH) flats sold in 2023. The documentation states that authentication is not required. Simplified Chinese is listed as a language option, but the source says this dataset does not provide Simplified Chinese data and returns Traditional Chinese instead.
  title: Transactions in the Sale of GSH Flats 2023 API
  version: "1.0"
openapi: 3.1.0
paths:
  /export/{dataresource}/{lang}/{format}:
    get:
      description: Retrieves transaction data for the specified resource, language and response format. The documented resource value identifies the 2023 GSH sale transactions dataset. The documentation lists Simplified Chinese as a language option, while noting that this dataset does not provide Simplified Chinese and returns Traditional Chinese data instead.
      operationId: getGsh2023SaleTransactions
      parameters:
        - description: Dataset resource identifier.
          example: ssfs-sale-transactions-g23
          in: path
          name: dataresource
          required: true
          schema:
            enum:
              - ssfs-sale-transactions-g23
            type: string
        - description: Response language. The documentation lists `sc` (Simplified Chinese), but states that Simplified Chinese data is unavailable for this dataset and that Traditional Chinese data is returned.
          examples:
            english:
              value: en
            simplifiedChinese:
              value: sc
            traditionalChinese:
              value: tc
          in: path
          name: lang
          required: true
          schema:
            enum:
              - en
              - tc
              - sc
            type: string
        - description: Response file format.
          examples:
            csv:
              value: csv
            json:
              value: json
            xml:
              value: xml
          in: path
          name: format
          required: true
          schema:
            enum:
              - json
              - csv
              - xml
            type: string
      responses:
        "200":
          content:
            application/json:
              examples:
                documentedRequest:
                  summary: Request URL shown in the documentation
                  value: https://data.housingauthority.gov.hk/psi/rest/export/ssfs-sale-transactions-g23/en/json
              schema:
                $ref: "#/components/schemas/TransactionsResponse"
            application/xml:
              schema:
                description: XML response; no XML structure or sample is specified.
                type: string
            text/csv:
              schema:
                description: CSV response; no CSV structure or sample is specified.
                type: string
          description: Success. JSON responses contain a `data` array of transaction records. The data dictionary documents the record fields; the example in the source is visibly malformed and is not reproduced as an authoritative JSON response.
        "400":
          description: Bad Request.
        "500":
          description: Internal Server Error.
      summary: Get GSH flats 2023 sale transactions
security: []
servers:
  - url: https://data.housingauthority.gov.hk/psi/rest
