{
  "openapi": "3.1.0",
  "info": {
    "title": "Endpoint Jobs API",
    "version": "1.0.0",
    "description": "Read-only access to active, normalized endpoint job listings."
  },
  "servers": [
    {
      "url": "https://endpointjobs.dev",
      "description": "Production"
    }
  ],
  "paths": {
    "/api/jobs": {
      "get": {
        "operationId": "listJobs",
        "summary": "List active jobs",
        "parameters": [
          {
            "$ref": "#/components/parameters/Query"
          },
          {
            "$ref": "#/components/parameters/Platforms"
          },
          {
            "$ref": "#/components/parameters/Tools"
          },
          {
            "$ref": "#/components/parameters/MetroAreas"
          },
          {
            "$ref": "#/components/parameters/Location"
          },
          {
            "$ref": "#/components/parameters/Workplace"
          },
          {
            "$ref": "#/components/parameters/SalaryShown"
          },
          {
            "$ref": "#/components/parameters/Leadership"
          },
          {
            "$ref": "#/components/parameters/MinimumSalary"
          },
          {
            "$ref": "#/components/parameters/Seniority"
          },
          {
            "$ref": "#/components/parameters/RoleFamily"
          },
          {
            "$ref": "#/components/parameters/Freshness"
          },
          {
            "$ref": "#/components/parameters/Sort"
          },
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "description": "Filtered, paginated active jobs",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "Access-Control-Allow-Origin": {
                "$ref": "#/components/headers/AllowOrigin"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobCollection"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidQuery"
          }
        }
      },
      "options": {
        "operationId": "listJobsPreflight",
        "summary": "CORS preflight",
        "responses": {
          "204": {
            "description": "Preflight accepted"
          }
        }
      }
    },
    "/api/jobs/{id}": {
      "get": {
        "operationId": "getJob",
        "summary": "Get one active job",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Active job listing",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "Access-Control-Allow-Origin": {
                "$ref": "#/components/headers/AllowOrigin"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/JobNotFound"
          }
        }
      },
      "options": {
        "operationId": "getJobPreflight",
        "summary": "CORS preflight",
        "responses": {
          "204": {
            "description": "Preflight accepted"
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "Query": {
        "name": "q",
        "in": "query",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        }
      },
      "Platforms": {
        "name": "platforms",
        "in": "query",
        "style": "form",
        "explode": false,
        "description": "Comma-separated platform names.",
        "schema": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "macOS",
              "Windows",
              "iOS",
              "Android",
              "Linux"
            ]
          },
          "example": [
            "macOS",
            "Windows"
          ]
        }
      },
      "Tools": {
        "name": "tools",
        "in": "query",
        "style": "form",
        "explode": false,
        "description": "Comma-separated endpoint tool names.",
        "schema": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "Jamf",
              "Intune",
              "SCCM",
              "Fleet MDM",
              "Kandji",
              "NinjaOne",
              "Workspace ONE",
              "Tanium",
              "Okta",
              "Entra ID",
              "Autopilot",
              "PowerShell",
              "Defender"
            ]
          },
          "example": [
            "Jamf",
            "Intune"
          ]
        }
      },
      "MetroAreas": {
        "name": "metroAreas",
        "in": "query",
        "style": "pipeDelimited",
        "explode": false,
        "description": "Pipe-separated metro area names (values contain commas, e.g. London, UK|Berlin, Germany).",
        "schema": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "Atlanta, GA",
              "Austin, TX",
              "Baltimore, MD",
              "Barcelona, Spain",
              "Berlin, Germany",
              "Boston, MA",
              "Charlotte, NC",
              "Chicago, IL",
              "Columbus, OH",
              "Dallas, TX",
              "Denver, CO",
              "Detroit, MI",
              "Frankfurt, Germany",
              "Houston, TX",
              "Indianapolis, IN",
              "Jersey City, NJ",
              "Kansas City, MO",
              "London, UK",
              "Los Angeles, CA",
              "Madrid, Spain",
              "Maryland",
              "Miami, FL",
              "Milan, Italy",
              "Milwaukee, WI",
              "Munich, Germany",
              "Nashville, TN",
              "New York, NY",
              "Northern Virginia",
              "Paris, France",
              "Philadelphia, PA",
              "Phoenix, AZ",
              "Portland, OR",
              "Raleigh-Durham, NC",
              "San Diego, CA",
              "San Francisco, CA",
              "San Jose, CA",
              "Seattle, WA",
              "Washington, DC",
              "Zurich, Switzerland"
            ]
          },
          "example": [
            "Atlanta, GA",
            "Austin, TX"
          ]
        }
      },
      "Location": {
        "name": "location",
        "in": "query",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        }
      },
      "Workplace": {
        "name": "workplace",
        "in": "query",
        "schema": {
          "type": "string",
          "enum": [
            "Remote",
            "Hybrid",
            "On-site"
          ]
        }
      },
      "SalaryShown": {
        "name": "salary",
        "in": "query",
        "description": "Require disclosed salary.",
        "schema": {
          "type": "string",
          "const": "1"
        }
      },
      "Leadership": {
        "name": "leadership",
        "in": "query",
        "description": "Require leadership roles.",
        "schema": {
          "type": "string",
          "const": "1"
        }
      },
      "MinimumSalary": {
        "name": "minSalary",
        "in": "query",
        "description": "Minimum USD salary floor; listings qualify when their salary ceiling meets it.",
        "schema": {
          "type": "string",
          "enum": [
            "80000",
            "100000",
            "120000",
            "150000",
            "180000",
            "200000"
          ]
        }
      },
      "Seniority": {
        "name": "seniority",
        "in": "query",
        "schema": {
          "type": "string",
          "enum": [
            "Associate",
            "Mid",
            "Senior",
            "Staff",
            "Lead",
            "Manager"
          ]
        }
      },
      "RoleFamily": {
        "name": "family",
        "in": "query",
        "schema": {
          "type": "string",
          "enum": [
            "Endpoint Engineering",
            "macOS Platform",
            "Windows Platform",
            "Workplace Systems",
            "Endpoint Security",
            "Device Compliance",
            "Systems Administration",
            "Automation"
          ]
        }
      },
      "Freshness": {
        "name": "freshness",
        "in": "query",
        "description": "Maximum posted age in days.",
        "schema": {
          "type": "string",
          "enum": [
            "1",
            "7",
            "14",
            "30"
          ]
        }
      },
      "Sort": {
        "name": "sort",
        "in": "query",
        "schema": {
          "type": "string",
          "enum": [
            "newest",
            "salary",
            "company"
          ],
          "default": "newest"
        }
      },
      "Page": {
        "name": "page",
        "in": "query",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "default": 1
        }
      },
      "Limit": {
        "name": "limit",
        "in": "query",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 20
        }
      }
    },
    "headers": {
      "CacheControl": {
        "description": "Shared cache policy.",
        "schema": {
          "type": "string",
          "example": "public, s-maxage=300, stale-while-revalidate=3600"
        }
      },
      "NoStore": {
        "description": "Error responses are not cached.",
        "schema": {
          "type": "string",
          "const": "no-store"
        }
      },
      "AllowOrigin": {
        "description": "CORS origin policy.",
        "schema": {
          "type": "string",
          "const": "*"
        }
      }
    },
    "responses": {
      "InvalidQuery": {
        "description": "Invalid query parameters",
        "headers": {
          "Cache-Control": {
            "$ref": "#/components/headers/NoStore"
          },
          "Access-Control-Allow-Origin": {
            "$ref": "#/components/headers/AllowOrigin"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            }
          }
        }
      },
      "JobNotFound": {
        "description": "Job is missing or inactive",
        "headers": {
          "Cache-Control": {
            "$ref": "#/components/headers/NoStore"
          },
          "Access-Control-Allow-Origin": {
            "$ref": "#/components/headers/AllowOrigin"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            }
          }
        }
      }
    },
    "schemas": {
      "JobCollection": {
        "type": "object",
        "required": [
          "data",
          "filters",
          "meta"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Job"
            }
          },
          "filters": {
            "$ref": "#/components/schemas/Filters"
          },
          "meta": {
            "$ref": "#/components/schemas/PaginationMeta"
          }
        }
      },
      "JobResponse": {
        "type": "object",
        "required": [
          "data",
          "meta"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Job"
          },
          "meta": {
            "type": "object",
            "required": [
              "updatedAt"
            ],
            "properties": {
              "updatedAt": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        }
      },
      "PaginationMeta": {
        "type": "object",
        "required": [
          "page",
          "limit",
          "total",
          "totalPages",
          "updatedAt"
        ],
        "properties": {
          "page": {
            "type": "integer",
            "minimum": 1
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "total": {
            "type": "integer",
            "minimum": 0
          },
          "totalPages": {
            "type": "integer",
            "minimum": 1
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Filters": {
        "type": "object",
        "required": [
          "q",
          "platforms",
          "tools",
          "metroAreas",
          "location",
          "workplace",
          "salaryShown",
          "leadership",
          "minSalary",
          "seniority",
          "family",
          "freshness",
          "sort"
        ],
        "properties": {
          "q": {
            "type": [
              "string",
              "null"
            ]
          },
          "platforms": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "macOS",
                "Windows",
                "iOS",
                "Android",
                "Linux"
              ]
            }
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "Jamf",
                "Intune",
                "SCCM",
                "Fleet MDM",
                "Kandji",
                "NinjaOne",
                "Workspace ONE",
                "Tanium",
                "Okta",
                "Entra ID",
                "Autopilot",
                "PowerShell",
                "Defender"
              ]
            }
          },
          "metroAreas": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "Atlanta, GA",
                "Austin, TX",
                "Baltimore, MD",
                "Barcelona, Spain",
                "Berlin, Germany",
                "Boston, MA",
                "Charlotte, NC",
                "Chicago, IL",
                "Columbus, OH",
                "Dallas, TX",
                "Denver, CO",
                "Detroit, MI",
                "Frankfurt, Germany",
                "Houston, TX",
                "Indianapolis, IN",
                "Jersey City, NJ",
                "Kansas City, MO",
                "London, UK",
                "Los Angeles, CA",
                "Madrid, Spain",
                "Maryland",
                "Miami, FL",
                "Milan, Italy",
                "Milwaukee, WI",
                "Munich, Germany",
                "Nashville, TN",
                "New York, NY",
                "Northern Virginia",
                "Paris, France",
                "Philadelphia, PA",
                "Phoenix, AZ",
                "Portland, OR",
                "Raleigh-Durham, NC",
                "San Diego, CA",
                "San Francisco, CA",
                "San Jose, CA",
                "Seattle, WA",
                "Washington, DC",
                "Zurich, Switzerland"
              ]
            }
          },
          "location": {
            "type": [
              "string",
              "null"
            ]
          },
          "workplace": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "Remote",
              "Hybrid",
              "On-site",
              null
            ]
          },
          "salaryShown": {
            "type": "boolean"
          },
          "leadership": {
            "type": "boolean"
          },
          "minSalary": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "80000",
              "100000",
              "120000",
              "150000",
              "180000",
              "200000",
              null
            ]
          },
          "seniority": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "Associate",
              "Mid",
              "Senior",
              "Staff",
              "Lead",
              "Manager",
              null
            ]
          },
          "family": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "Endpoint Engineering",
              "macOS Platform",
              "Windows Platform",
              "Workplace Systems",
              "Endpoint Security",
              "Device Compliance",
              "Systems Administration",
              "Automation",
              null
            ]
          },
          "freshness": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "1",
              "7",
              "14",
              "30",
              null
            ]
          },
          "sort": {
            "type": "string",
            "enum": [
              "newest",
              "salary",
              "company"
            ]
          }
        }
      },
      "Job": {
        "type": "object",
        "required": [
          "id",
          "title",
          "company",
          "location",
          "workplace",
          "postedAt",
          "fetchedAt",
          "staleAfter",
          "source",
          "sourceUrl",
          "attributionLabel",
          "termsProfile",
          "summary",
          "tags",
          "matchReasons",
          "tools",
          "platforms",
          "roleFamily",
          "seniority",
          "employmentType"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "company": {
            "type": "string"
          },
          "location": {
            "type": "string"
          },
          "mapLocation": {
            "$ref": "#/components/schemas/MapLocation"
          },
          "workplace": {
            "type": "string",
            "enum": [
              "Remote",
              "Hybrid",
              "On-site",
              "Unknown"
            ]
          },
          "postedAt": {
            "type": "string",
            "format": "date-time"
          },
          "fetchedAt": {
            "type": "string",
            "format": "date-time"
          },
          "staleAfter": {
            "type": "string",
            "format": "date-time"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "source": {
            "type": "string"
          },
          "sourceUrl": {
            "type": "string",
            "format": "uri"
          },
          "applyUrl": {
            "type": "string",
            "format": "uri"
          },
          "attributionLabel": {
            "type": "string"
          },
          "termsProfile": {
            "type": "string",
            "enum": [
              "seed",
              "attribution-required",
              "partner-terms",
              "public-api"
            ]
          },
          "summary": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "matchReasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "platforms": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "roleFamily": {
            "type": "string"
          },
          "seniority": {
            "type": "string"
          },
          "employmentType": {
            "type": "string"
          },
          "salary": {
            "$ref": "#/components/schemas/Salary"
          }
        }
      },
      "MapLocation": {
        "type": "object",
        "required": [
          "label",
          "latitude",
          "longitude"
        ],
        "properties": {
          "label": {
            "type": "string"
          },
          "latitude": {
            "type": "number",
            "minimum": -90,
            "maximum": 90
          },
          "longitude": {
            "type": "number",
            "minimum": -180,
            "maximum": 180
          }
        }
      },
      "Salary": {
        "type": "object",
        "required": [
          "currency",
          "label"
        ],
        "properties": {
          "min": {
            "type": "number"
          },
          "max": {
            "type": "number"
          },
          "currency": {
            "type": "string"
          },
          "label": {
            "type": "string"
          }
        }
      },
      "ApiError": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "INVALID_QUERY",
                  "JOB_NOT_FOUND"
                ]
              },
              "message": {
                "type": "string"
              },
              "details": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  }
}
