{
  "openapi": "3.1.0",
  "info": {
    "title": "Pegel public API",
    "version": "1.0.0",
    "description": "Read-only access to Berlin startup roles and tracked companies.",
    "license": {
      "name": "CC0 1.0",
      "url": "https://creativecommons.org/publicdomain/zero/1.0/"
    }
  },
  "servers": [
    {
      "url": "https://pegel.berlin"
    }
  ],
  "externalDocs": {
    "description": "Human-readable API documentation",
    "url": "https://pegel.berlin/api"
  },
  "paths": {
    "/api/v1/jobs": {
      "get": {
        "summary": "List active jobs",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000,
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "company",
            "in": "query",
            "description": "Comma-separated filter values.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sector",
            "in": "query",
            "description": "Comma-separated filter values.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "stage",
            "in": "query",
            "description": "Comma-separated filter values.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sizeBand",
            "in": "query",
            "description": "Comma-separated filter values.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "german",
            "in": "query",
            "description": "Comma-separated filter values.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "seniority",
            "in": "query",
            "description": "Comma-separated filter values.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contract",
            "in": "query",
            "description": "Comma-separated filter values.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "location",
            "in": "query",
            "description": "Comma-separated filter values.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "workplaceMode",
            "in": "query",
            "description": "Comma-separated filter values.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "remoteMode",
            "in": "query",
            "description": "Comma-separated filter values.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "techTags",
            "in": "query",
            "description": "Comma-separated filter values.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "visa",
            "in": "query",
            "description": "Pass 1 to enable.",
            "schema": {
              "type": "string",
              "enum": [
                "1"
              ]
            }
          },
          {
            "name": "hideGhosts",
            "in": "query",
            "description": "Pass 1 to enable.",
            "schema": {
              "type": "string",
              "enum": [
                "1"
              ]
            }
          },
          {
            "name": "salaryDisclosed",
            "in": "query",
            "description": "Pass 1 to enable.",
            "schema": {
              "type": "string",
              "enum": [
                "1"
              ]
            }
          },
          {
            "name": "postedWithin",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "7d",
                "30d",
                "90d",
                "all"
              ],
              "default": "all"
            }
          },
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated active jobs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobList"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/v1/jobs/{id}": {
      "get": {
        "summary": "Get one job",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Full UUID or eight-character URL suffix.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Job detail.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Job"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/v1/companies": {
      "get": {
        "summary": "List tracked companies",
        "parameters": [
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "alpha",
                "hiring",
                "recent"
              ],
              "default": "alpha"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tracked companies.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Company"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/v1/companies/{slug}": {
      "get": {
        "summary": "Get one company and its active jobs",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Company profile.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Company"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Job": {
        "type": "object",
        "required": [
          "id",
          "slug",
          "title",
          "company",
          "firstSeenAt",
          "lastSeenAt",
          "status",
          "atsUrl",
          "pegelUrl"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "slug": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "company": {
            "type": "object",
            "required": [
              "slug",
              "name"
            ],
            "properties": {
              "slug": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "location": {
            "type": [
              "string",
              "null"
            ]
          },
          "seniorityRaw": {
            "type": [
              "string",
              "null"
            ]
          },
          "contractTypeRaw": {
            "type": [
              "string",
              "null"
            ]
          },
          "languageTier": {
            "type": [
              "string",
              "null"
            ]
          },
          "visaTier": {
            "type": [
              "string",
              "null"
            ]
          },
          "remoteModeTier": {
            "type": [
              "string",
              "null"
            ]
          },
          "salaryMin": {
            "type": [
              "number",
              "null"
            ],
            "description": "Employer-disclosed minimum. Null means not disclosed; Pegel does not estimate pay."
          },
          "salaryMax": {
            "type": [
              "number",
              "null"
            ],
            "description": "Employer-disclosed maximum. Null means not disclosed."
          },
          "salaryCurrency": {
            "type": [
              "string",
              "null"
            ]
          },
          "salaryPeriod": {
            "type": [
              "string",
              "null"
            ]
          },
          "techTags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "summaryText": {
            "type": [
              "string",
              "null"
            ]
          },
          "postedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "firstSeenAt": {
            "type": "string",
            "format": "date-time"
          },
          "lastSeenAt": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "expired"
            ]
          },
          "expiredAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "atsUrl": {
            "type": "string",
            "format": "uri"
          },
          "pegelUrl": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "Company": {
        "type": "object",
        "required": [
          "slug",
          "name",
          "sectorPrimary",
          "sectorSecondary",
          "stage",
          "visaSponsorSignal",
          "pegelUrl"
        ],
        "properties": {
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "website": {
            "type": [
              "string",
              "null"
            ]
          },
          "shortDescription": {
            "type": [
              "string",
              "null"
            ]
          },
          "sectorPrimary": {
            "type": "string"
          },
          "sectorSecondary": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "stage": {
            "type": "string"
          },
          "sizeBand": {
            "type": [
              "string",
              "null"
            ]
          },
          "foundedYear": {
            "type": [
              "integer",
              "null"
            ]
          },
          "defaultLanguageTier": {
            "type": [
              "string",
              "null"
            ]
          },
          "visaSponsorSignal": {
            "type": "boolean"
          },
          "twitter": {
            "type": [
              "string",
              "null"
            ]
          },
          "linkedin": {
            "type": [
              "string",
              "null"
            ]
          },
          "pegelUrl": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "Pagination": {
        "type": "object",
        "required": [
          "page",
          "pageSize",
          "totalCount",
          "totalPages"
        ],
        "properties": {
          "page": {
            "type": "integer"
          },
          "pageSize": {
            "type": "integer"
          },
          "totalCount": {
            "type": "integer"
          },
          "totalPages": {
            "type": "integer"
          }
        }
      },
      "JobList": {
        "type": "object",
        "required": [
          "data",
          "pagination"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Job"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/Pagination"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "status",
              "message"
            ],
            "properties": {
              "status": {
                "type": "integer"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "responses": {
      "NotFound": {
        "description": "Resource not found.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "RateLimited": {
        "description": "Rate limit exceeded.",
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "integer"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    }
  }
}