openapi: 3.1.0
info:
  title: Tango Spaces Outbound API
  version: "1.0"
  description: |
    Async **delta** REST API: client retrieves Space records updated in
    Tango since the last integration run. Two-call pattern with gu_id
    and pagination (5000/page).

    Updates to `space_id`, `building_id`, `floor_id`, `property_id`,
    `property_number`, or `property_description` do NOT trigger export — only
    updates to other fields do.
  x-direction: outbound
  x-source: Tango
  x-destination: Client System
servers:
  - url: https://api.tangoanalytics.com
    description: Production
  - url: https://testapi.tangoanalytics.com
    description: Test (SIT/UAT)
tags: [{name: Spaces (Delta)}, {name: Status}]
paths:
  /v1/spacemgmt/delta/spaces:
    get:
      summary: Initiate delta Space export (async)
      operationId: getSpacesDelta
      tags: [Spaces (Delta)]
      parameters:
        - $ref: "#/components/parameters/XClient"
        - $ref: "#/components/parameters/XApiKey"
      responses:
        "200":
          description: Async ack.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AcceptedResponse"
  /v1/batch/status:
    get:
      summary: Retrieve paginated Space records by gu_id
      operationId: getSpacesByGuId
      tags: [Status]
      parameters:
        - $ref: "#/components/parameters/XClient"
        - $ref: "#/components/parameters/XApiKey"
        - in: query
          name: gu_id
          required: true
          schema: { type: string, format: uuid }
        - in: query
          name: page_no
          required: false
          schema: { type: integer, minimum: 1 }
      responses:
        "200":
          description: Paginated Space records.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SpacePage"
components:
  securitySchemes:
    xClientHeader: { type: apiKey, in: header, name: x-client }
    xApiKeyHeader: { type: apiKey, in: header, name: x-api-key }
  parameters:
    XClient: { name: x-client, in: header, required: true, schema: { type: string } }
    XApiKey: { name: x-api-key, in: header, required: true, schema: { type: string } }
  schemas:
    AcceptedResponse:
      type: object
      required: [status]
      properties:
        status: { type: string, enum: [OK, Error] }
        status_message: { type: string }
        gu_id: { type: string, format: uuid }
    SpacePage:
      type: object
      required: [records]
      properties:
        status: { type: string, enum: [PROCESSING, COMPLETED, ERROR] }
        total_records: { type: integer }
        total_pages: { type: integer }
        page_size: { type: integer, default: 5000 }
        page_no: { type: integer }
        records:
          type: array
          items:
            $ref: "#/components/schemas/SpaceRecord"
    SpaceRecord:
      type: object
      properties:
        space_id: { type: number }
        space_name: { type: string }
        space_number: { type: string }
        building_id: { type: number }
        building_number: { type: string }
        building_description: { type: string }
        floor_id: { type: number }
        floor_number: { type: string }
        property_id: { type: number }
        property_number: { type: string }
        property_description: { type: string }
        occupancy_status: { type: string }
        charge_type: { type: string, description: 'e.g., "Floor Shared".' }
        allocation_type: { type: string }
        space_type: { type: string, description: 'e.g., "SUPT-Break Room, Canteen-FS".' }
        contractual_type: { type: string }
        measurement_type: { type: string }
        wkst_type: { type: string }
        space_use: { type: string }
        space_category: { type: string, description: 'e.g., "SUPT".' }
        is_shift_space: { type: string, enum: [Y, N] }
        is_subleased: { type: string, enum: [Y, N] }
        is_reservable: { type: string, enum: [Y, N] }
        is_wkst: { type: string, enum: [Y, N] }
        rate: { type: string }
        no_of_shifts: { type: string }
        actual_sf: { type: number }
        actual_sm: { type: number }
        usable_sf: { type: number }
        usable_sm: { type: number }
        cad_rentable_sf: { type: number }
        cad_rentable_sm: { type: number }
        capacity_planned: { type: number }
        capacity_available: { type: number }
        total_headcount: { type: number }
        workstation_headcount: { type: number }
        workstation_capacity: { type: number }
        total_capacity: { type: number }
        status: { type: string, description: 'e.g., "ACTIVE".' }
        last_update_date: { type: string }
        last_updated_by: { type: string }
        c_ext_attr1: { type: string }
        c_ext_attr2: { type: string }
        c_ext_attr3: { type: string }
        c_ext_attr4: { type: string }
        c_ext_attr5: { type: string }
        c_ext_attr6: { type: string }
        c_ext_attr7: { type: string }
        c_ext_attr8: { type: string }
        c_ext_attr9: { type: string }
        c_ext_attr10: { type: string }
        n_ext_attr1: { type: number }
        n_ext_attr2: { type: number }
        n_ext_attr3: { type: number }
        n_ext_attr4: { type: number }
        n_ext_attr5: { type: number }
        n_ext_attr6: { type: number }
        n_ext_attr7: { type: number }
        n_ext_attr8: { type: number }
        n_ext_attr9: { type: number }
        n_ext_attr10: { type: number }
        d_ext_attr1: { type: string, description: "DATE." }
        d_ext_attr2: { type: string, description: "DATE." }
        d_ext_attr3: { type: string, description: "DATE." }
        d_ext_attr4: { type: string, description: "DATE." }
        d_ext_attr5: { type: string, description: "DATE." }
        d_ext_attr6: { type: string, description: "DATE." }
        d_ext_attr7: { type: string, description: "DATE." }
        d_ext_attr8: { type: string, description: "DATE." }
        d_ext_attr9: { type: string, description: "DATE." }
        d_ext_attr10: { type: string, description: "DATE." }
        " c_ext_lov1 ":
          type: string
          description: |
            **Source has whitespace around the JSON key** — `" c_ext_lov1 "`.
            Preserved verbatim across c_ext_lov1..9; c_ext_lov10 is clean.
            Likely a doc typo; runtime almost certainly uses `c_ext_lov1`.
        " c_ext_lov2 ": { type: string }
        " c_ext_lov3 ": { type: string }
        " c_ext_lov4 ": { type: string }
        " c_ext_lov5 ": { type: string }
        " c_ext_lov6 ": { type: string }
        " c_ext_lov7 ": { type: string }
        " c_ext_lov8 ": { type: string }
        " c_ext_lov9 ": { type: string }
        c_ext_lov10: { type: string, description: "Unlike c_ext_lov1..9, this one has clean spacing in source." }
        other_capacity: { type: string }
        space_attributes: { type: string }
security:
  - xClientHeader: []
    xApiKeyHeader: []
