HashiCorp Nomad Evaluations API

Endpoints for querying evaluations. Evaluations are the mechanism by which Nomad makes scheduling decisions.

OpenAPI Specification

nomad-evaluations-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: HashiCorp Nomad HTTP ACL Evaluations API
  description: The HashiCorp Nomad HTTP API provides programmatic access to all Nomad functionality including job scheduling, allocation management, node operations, deployments, services, evaluations, namespaces, ACL policies, and cluster status. All API routes are prefixed with /v1/ and the default port is 4646. The API is RESTful, responds to standard HTTP verbs, and supports ACL token authentication via the X-Nomad-Token header or Bearer scheme.
  version: 1.9.0
  contact:
    name: HashiCorp Support
    url: https://support.hashicorp.com
  termsOfService: https://www.hashicorp.com/terms-of-service
  license:
    name: Business Source License 1.1
    url: https://github.com/hashicorp/nomad/blob/main/LICENSE
servers:
- url: http://localhost:4646/v1
  description: Local Nomad Agent
security:
- nomadToken: []
- bearerAuth: []
tags:
- name: Evaluations
  description: Endpoints for querying evaluations. Evaluations are the mechanism by which Nomad makes scheduling decisions.
paths:
  /evaluations:
    get:
      operationId: listEvaluations
      summary: List evaluations
      description: Lists all evaluations in the system. Supports filtering by job ID and evaluation status (blocked, pending, complete, failed, or canceled).
      tags:
      - Evaluations
      parameters:
      - $ref: '#/components/parameters/PrefixParam'
      - $ref: '#/components/parameters/NamespaceParam'
      - $ref: '#/components/parameters/NextTokenParam'
      - $ref: '#/components/parameters/PerPageParam'
      - $ref: '#/components/parameters/FilterParam'
      - name: status
        in: query
        description: Filter evaluations by status.
        schema:
          type: string
          enum:
          - blocked
          - pending
          - complete
          - failed
          - canceled
      - name: job
        in: query
        description: Filter evaluations by job ID.
        schema:
          type: string
      responses:
        '200':
          description: A list of evaluations
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Evaluation'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalError'
  /evaluations/count:
    get:
      operationId: countEvaluations
      summary: Count evaluations
      description: Returns a count of evaluations in the system, optionally filtered by status.
      tags:
      - Evaluations
      parameters:
      - name: status
        in: query
        description: Filter the count by evaluation status.
        schema:
          type: string
          enum:
          - blocked
          - pending
          - complete
          - failed
          - canceled
      responses:
        '200':
          description: Evaluation count
          content:
            application/json:
              schema:
                type: object
                properties:
                  Count:
                    type: integer
                    description: The number of evaluations matching the filter.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalError'
  /evaluation/{evalID}:
    get:
      operationId: readEvaluation
      summary: Read an evaluation
      description: Returns the full details of the specified evaluation.
      tags:
      - Evaluations
      parameters:
      - $ref: '#/components/parameters/EvalIDParam'
      responses:
        '200':
          description: Evaluation details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Evaluation'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalError'
  /evaluation/{evalID}/allocations:
    get:
      operationId: listEvaluationAllocations
      summary: List allocations for an evaluation
      description: Returns a list of allocations created or modified by the specified evaluation.
      tags:
      - Evaluations
      parameters:
      - $ref: '#/components/parameters/EvalIDParam'
      responses:
        '200':
          description: A list of allocation stubs
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/AllocationListStub'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  responses:
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
    Unauthorized:
      description: Unauthorized - missing or invalid ACL token
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
    InternalError:
      description: Internal server error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
  parameters:
    PerPageParam:
      name: per_page
      in: query
      description: Maximum number of results to return per page.
      schema:
        type: integer
    FilterParam:
      name: filter
      in: query
      description: Specifies the expression used to filter the results.
      schema:
        type: string
    NamespaceParam:
      name: namespace
      in: query
      description: The target namespace. Defaults to the default namespace.
      schema:
        type: string
    NextTokenParam:
      name: next_token
      in: query
      description: Indicates where to start paging for queries that support pagination.
      schema:
        type: string
    PrefixParam:
      name: prefix
      in: query
      description: Specifies a string to filter results based on an ID prefix.
      schema:
        type: string
    EvalIDParam:
      name: evalID
      in: path
      required: true
      description: The ID of the evaluation.
      schema:
        type: string
  schemas:
    AllocationListStub:
      type: object
      description: A stub representation of an allocation returned in list operations.
      properties:
        ID:
          type: string
        EvalID:
          type: string
        Name:
          type: string
        Namespace:
          type: string
        NodeID:
          type: string
        NodeName:
          type: string
        JobID:
          type: string
        JobVersion:
          type: integer
        TaskGroup:
          type: string
        DesiredStatus:
          type: string
        ClientStatus:
          type: string
        DeploymentStatus:
          type: object
          properties:
            Healthy:
              type: boolean
            Canary:
              type: boolean
        CreateIndex:
          type: integer
        ModifyIndex:
          type: integer
        CreateTime:
          type: integer
          format: int64
        ModifyTime:
          type: integer
          format: int64
    Evaluation:
      type: object
      description: An evaluation represents a scheduling decision made by Nomad.
      properties:
        ID:
          type: string
          description: The unique ID of the evaluation.
        Priority:
          type: integer
        Type:
          type: string
        TriggeredBy:
          type: string
          description: The event that triggered the evaluation.
        Namespace:
          type: string
        JobID:
          type: string
        JobModifyIndex:
          type: integer
        NodeID:
          type: string
        NodeModifyIndex:
          type: integer
        DeploymentID:
          type: string
        Status:
          type: string
          description: The status of the evaluation.
          enum:
          - blocked
          - pending
          - complete
          - failed
          - canceled
        StatusDescription:
          type: string
        Wait:
          type: integer
        NextEval:
          type: string
        PreviousEval:
          type: string
        BlockedEval:
          type: string
        CreateIndex:
          type: integer
        ModifyIndex:
          type: integer
        CreateTime:
          type: integer
          format: int64
        ModifyTime:
          type: integer
          format: int64
  securitySchemes:
    nomadToken:
      type: apiKey
      name: X-Nomad-Token
      in: header
      description: ACL token passed via the X-Nomad-Token request header.
    bearerAuth:
      type: http
      scheme: bearer
      description: ACL token passed via the Authorization header with Bearer scheme.
externalDocs:
  description: Nomad HTTP API Documentation
  url: https://developer.hashicorp.com/nomad/api-docs