openapi: 3.0.0
info:
  title: Greenhouse Jobs API
  description: |
    Get the job posts an employer publishes on its Greenhouse job board, with each post's job id, title, company name, location, link and last update time.

    A board's posts come back in one response. When Greenhouse has no board for the token, or the board has no posts, the response has an `error` field.
  version: 1.0.0
servers:
  - url: https://www.searchapi.io/api/v1
paths:
  /search:
    get:
      summary: Greenhouse Jobs
      security:
        - ApiKeyAuth: []
        - ApiKeyQuery: []
      parameters:
        - name: engine
          in: query
          required: true
          description: 'Search engine. Must be set to: `greenhouse_jobs`'
          schema:
            type: string
            enum: ["greenhouse_jobs"]
        - name: board_token
          in: query
          required: true
          description: Board token from the employer's Greenhouse board link, such as `gitlab` in job-boards.greenhouse.io/gitlab.
          schema:
            type: string
            maxLength: 128
            pattern: '^[A-Za-z0-9_-]+$'
        - name: zero_retention
          in: query
          required: false
          description: Set to true to disable logging and persistent storage for this request. Enterprise plans only.
          schema:
            type: boolean
            default: false
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResponse'
        '400':
          description: Validation Error. There is an issue with query parameters, such as missing required parameters or invalid values.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Authentication Error. The API key is missing or invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden. Zero data retention is not available to the account, or the account requires `zero_retention=true`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate Limit Exceeded. The number of allowed requests has been exceeded. Consider upgrading your plan or waiting for the limit to reset.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Server Error. Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Greenhouse didn't answer after several tries, or we could not retrieve results in 90 seconds. The search is not billed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: 'Use Bearer authentication. Format: "Bearer YOUR_API_KEY"'
    ApiKeyQuery:
      type: apiKey
      in: query
      name: api_key
      description: Pass API key as query parameter
  schemas:
    SearchResponse:
      type: object
      properties:
        search_metadata:
          $ref: '#/components/schemas/SearchMetadata'
        search_parameters:
          $ref: '#/components/schemas/SearchParameters'
        search_information:
          $ref: '#/components/schemas/SearchInformation'
        jobs:
          type: array
          items:
            $ref: '#/components/schemas/Job'
        error:
          type: string
          description: Why there are no jobs to return.
    SearchMetadata:
      type: object
      required: [status, created_at]
      properties:
        id:
          type: string
          description: "Unique identifier for the search request"
        status:
          type: string
          description: "Status of the search request"
        created_at:
          type: string
          format: date-time
          description: "Timestamp when the search was created"
        request_time_taken:
          type: number
          description: "Time taken to make the request in seconds"
        parsing_time_taken:
          type: number
          description: "Time taken to parse the results in seconds"
        total_time_taken:
          type: number
          description: "Total time taken for the search in seconds"
        request_url:
          type: string
          description: "Greenhouse board page for this board token"
        html_url:
          type: string
          description: "URL to view HTML results"
        json_url:
          type: string
          description: "URL to view JSON results"
    SearchParameters:
      type: object
      properties:
        engine:
          type: string
          description: Search engine used for the request.
        board_token:
          type: string
          description: Board token the request was run for.
    SearchInformation:
      type: object
      required: [total_results]
      properties:
        total_results:
          type: integer
          description: Number of job posts on the board.
    Job:
      type: object
      required: [position, job_id, title, company_name, link, updated_at]
      properties:
        position:
          type: integer
          description: Order of the post in Greenhouse's list of the board's posts, starting at 1.
        job_id:
          type: string
          description: Greenhouse identifier for the job post.
        title:
          type: string
          description: Job title.
        company_name:
          type: string
          description: Name of the employer as Greenhouse shows it.
        location:
          type: string
          description: Job location as the employer wrote it.
        link:
          type: string
          description: Link to the job post on the employer's board or careers site.
        first_published_at:
          type: string
          format: date-time
          description: When the post was first published.
        updated_at:
          type: string
          format: date-time
          description: When the employer last updated the post.
        language:
          type: string
          description: Language code of the post, such as `en`.
    ErrorResponse:
      type: object
      required: [error]
      properties:
        error:
          type: string
          description: Error message.
