swagger: '2.0'
info:
  version: 1.0.0
  title: Tensorflight API
  description: >
    `request_processing_location` API call is used to request analysis of given address / location.
    Every such call will incur a charge of 1 credit.
    It will start real-time analysis of given location and it may take around 15 seconds until results are available.

    Results of the analysis can be fetched using `get_features` API call.
    If such API call returns response code 202, it means that location is still being processed. Then the request should be repeated after a few seconds to check the status again.
    `get_features` API calls are free of charge.
  contact:
    name: "API Support"
    email: support@tensorflight.com
schemes:
  - https
host: app.tensorflight.com
basePath: /api
paths:
  /request_processing_location:
    post:
      consumes:
        - application/json
      description: ''
      summary: /request_processing_location
      parameters:
        - name: body
          in: body
          required: true
          schema:
            type: object
            required:
              - api_key
            properties:
              lng:
                description: Longitude of the building location, required together with latitude. If both not provided, please provide an address.
                type: number
                format: float
                example: -82.76472692251235
              lat:
                description: Latitude of the building location, required together with longitude. If both not provided, please provide an address.
                type: number
                format: float
                example: 28.01892974673773
              address:
                description: Address of the building location. If not provided, please provide the longitude and latitude of the building location.
                type: string
                example: "1461 Main St, Dunedin, FL 34698"
              location_id:
                description: ID of given location in client's database
                type: string
                example: "FNX22075100"
              insured_name:
                description: Name of the insured business. It is used as a hint for geocoding.
                type: string
                example: "Dunkin Donuts"
              api_key:
                description: API key
                type: string
                format: uuid
                example: "<api_key>"
      produces:
        - application/json
      responses:
        200:
          description: Successful response
          schema:
            type: object
            properties:
              status:
                type: string
                enum: ['SUCCESS']
              plan_id:
                type: string
                format: uuid
                description: ID of the created plan (processed location)
                example: 6f208009-9e78-4646-9862-794b75f9cff4
        400:
          description: Exceeded limit of requested plans
        403:
          description: Given api key is invalid or user does not have sufficient permissions
  /get_features:
    post:
      summary: /get_features
      parameters:
        - name: body
          in: body
          description: ''
          required: true
          schema:
            type: object
            required:
              - plan_id
              - api_key
            properties:
              plan_id:
                description: ID of the plan from which take all buildings and provide analysis
                type: string
                format: uuid
                example: 6f208009-9e78-4646-9862-794b75f9cff4
              columns:
                description: "Optional. List of columns which are to be present in the returned report. Possible values are: building_footprint, construction_type, floor_area, footprint_area, height, latitude, longitude, nr_of_stories, plan_url, building_url."
                items:
                  type: string
              api_key:
                description: API key
                type: string
                format: uuid
                example: "<api_key>"
      produces:
        - application/json
      responses:
        200:
          description: Successful response
          schema:
            type: array
            description: List of detected buildings on the plan. If no buildings have been detected then the list is empty.
            items:
              $ref: '#/definitions/BuildingFeatures'
        202:
          description: Buildings are still being processed. Try again after a few seconds.
        400:
          description: Plan with given ID has not been found
        403:
          description: Given api key is invalid or user does not have sufficient permissions

definitions:
  BuildingFeatures:
    type: object
    properties:
      building_footprint:
        type: string
        description: Building footprint polygon in GeoJSON format (EPSG:4326)
        example: "{\"coordinates\": [[[-82.764563, 28.019079], [-82.764562, 28.019009], [-82.764562, 28.018964], [-82.764561, 28.018919], [-82.76456, 28.018829], [-82.764559, 28.018783], [-82.764894, 28.018778], [-82.764894, 28.018824], [-82.764896, 28.018914], [-82.764897, 28.018959], [-82.764897, 28.019005], [-82.764898, 28.019069], [-82.764798, 28.019071], [-82.764799, 28.019099], [-82.764685, 28.019099], [-82.764685, 28.019077], [-82.764563, 28.019079]]], \"type\": \"Polygon\"}"
      building_occupancy_type:
        type: string
        x-nullable: true
        enum: ['SINGLE_FAMILY', 'MULTI_FAMILY', 'APARTMENTS', 'OFFICE',
            'HOTEL', 'PARKING', 'SHOPPING_MALL', 'RETAIL',
            'RESTAURANT', 'PERSONAL_SERVICES',
            'CULTURE', 'SPORT', 'MEDICAL_OFFICE', 'HOSPITAL',
            'CHURCH', 'PUBLIC', 'SCHOOL', 'UNIVERSITY', 'CAR_SERVICES',
            'WAREHOUSE', 'INDUSTRIAL', 'AGRICULTURE', 'TRANSPORTATION',
            'MISCELLANEOUS', 'MOBILE_HOME']
        description: Categorizing structures based on their usage
        example: SHOPPING_MALL
      buildings_on_parcel_count:
        type: integer
        x-nullable: false
        description: Number of buildings found on the parcel
        example: 1
      coast_distance:
        type: number
        format: float
        x-nullable: true
        description: Distance from the building to the coast [in miles]
        example: 1.7
      construction_type:
        type: string
        x-nullable: true
        description: Construction material of main bearing element of the building
        enum: ['REINFORCED_CONCRETE', 'MASONRY', 'STEEL', 'WOOD_FRAME']
        example: MASONRY
      facade_condition:
        type: string
        x-nullable: true
        enum: ["POOR", "FAIR", "GOOD"]
        description: Facade condition. Categorized by analysis of relevant risk factors.
        example: GOOD
      facade_material:
        type: string
        x-nullable: true
        enum: ["PLASTER", "BRICK", "STONE", "METAL", "GLASS", "WOOD", "ACP_PANEL"]
        description: Predominant facade material type.
        example: PLASTER
      flood_zone:
        type: string
        x-nullable: true
        enum: ['X', 'AE', 'A', 'VE', 'AH', 'V']
        description: FEMA flood zone. Geographic areas that the FEMA has defined according to varying levels of flood risk.
        example: X
      floor_area:
        type: number
        format: float
        description: Estimated living floor area of the building [in square feet]
        example: 10005
      footprint_area:
        type: number
        format: float
        description: Building footprint area [in square feet]
        example: 11864
      height:
        type: number
        format: float
        x-nullable: true
        description: Height of the building [in feet]
        example: 19.9
      latitude:
        type: number
        format: float
        description: Latitude of the building centroid
        example: 28.018932
      longitude:
        type: number
        format: float
        description: Longitude of the building centroid
        example: -82.764728
      nr_of_stories:
        type: string
        x-nullable: true
        description: Any level part of a building with a floor above ground (ground floor is included). It could be a range e.g. '5-9', '10-19', '20+' or '5+.
        example: "1"
      parcel_area:
        type: number
        format: float
        description: Area of land assigned to the specific address [in square feet]
        example: 149784
      plan_url:
        type: string
        description: Access link (URL) to the property preview in the Tensorflight App
        example: 'https://app.tensorflight.com/#/pages/annotations?id=<plan_id>'
      replacement_value:
        type: number
        format: float
        description: Estimated replacement value of the building [USD in the USA, AUD in the Australia]
        example: 1823000
      roof_condition:
        type: string
        x-nullable: true
        enum: ["POOR", "FAIR", "GOOD"]
        description: Roof condition. Categorized by analysis of relevant risk factors.
        example: POOR
      roof_condition_score:
        type: number
        format: float
        x-nullable: true
        description: Roof condition score (between 0 and 1)
        example: 0.61
      roof_geometry:
        type: string
        x-nullable: true
        enum: [HIP, FLAT, GABLE, GAMBREL, MANSARD, PYRAMID, SHED, COMPLEX]
        description: Predominant shape of the building roof.
        example: FLAT
      roof_material:
        type: string
        x-nullable: true
        enum: ["BITUMINOUS_WATERPROOFING", "CORRUGATED_METAL", "STEEL_TILE", "ASBESTOS_CEMENT_CORRUGATED_SHEETS", "CERAMIC_TILE", 'SHINGLE']
        description: The outermost layer on the roof of a building, sometimes self-supporting, but generally supported by an underlying structure.
        example: BITUMINOUS_WATERPROOFING
      roof_pitch:
        type: string
        x-nullable: true
        enum: ['FLAT', 'LOW', 'MODERATE', 'STEEP']
        description: The amount of rise a roof has compared to its horizontal measurement – Flat (<5°) | Low (5-18.5°) | Moderate (18.5-45°) | Steep (>45°)
        example: FLAT
#      footprint_confidence:
#        type: number
#        format: float
#        x-nullable: true
#        description: Confidence of building footprint
#        example: 1.0
#      geocoding_level:
#        type: string
#        x-nullable: true
#        enum: ['rooftop', 'parcel', 'uncertain']
#        description: Level of geocoding
#      nr_of_stories_confidences:
#        description: List of model confidences for nr of stories
#        type: array
#        items:
#          type: object
#        example:
#          - ['5-9', 1.0]
#      occupancy_types:
#        type: string
#        x-nullable: true
#        description: Occupancy types
#        example: General Commercial
#      occupancy_types_confidences:
#        description: List of model confidences for occupancy types
#        items:
#          type: object
#        example:
#          - ['General Commercial', 1.0]
#      roof_geometry_confidences:
#        description: List of model confidences for roof geometry
#        items:
#          type: object
#        example:
#          - ['HIP', 1.0]
#      roof_pitch_confidences:
#        description: List of model confidences for roof pitch
#        items:
#          type: object
#        example:
#          - ['LOW', 0.49]
#          - ['MODERATE', 0.452]
#      human_verified:
#        type: boolean
#        description: If yes, plan was verified by a human, otherwise no.
#      id:
#        type: string
#        format: uuid
#        description: Plan id
#      nearby_pools:
#        type: number
#        format: integer
#        description: Number of pools within 25 meters from the building
#        x-nullable: true
#      nearby_trees:
#        type: number
#        format: integer
#        description: Number of trees within 25 meters from the building
#        x-nullable: true
#      pool_distance:
#        type: number
#        format: float
#        description: Distance to the closest pool [in feet]
#        x-nullable: true
#      solar_panels_area:
#        type: number
#        format: float
#        x-nullable: true
#        description: Total solar panels area [in square feet]
#      solar_panels_percentage:
#        type: number
#        format: float
#        description: Percentage of the roof covered by the solar panels
#        x-nullable: true
#      tree_distance:
#        type: number
#        format: float
#        description: Distance to the nearest tree [in feet]
#        x-nullable: true
#      tree_overhang:
#        type: number
#        format: integer
#        x-nullable: true
#        description: Number of trees overhanging the building
