HashiCorp Nomad Namespaces API

Endpoints for managing namespaces, which segment jobs and their associated objects.

OpenAPI Specification

nomad-namespaces-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: HashiCorp Nomad HTTP ACL Namespaces 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: Namespaces
  description: Endpoints for managing namespaces, which segment jobs and their associated objects.
paths:
  /namespaces:
    get:
      operationId: listNamespaces
      summary: List namespaces
      description: Lists all namespaces in the system.
      tags:
      - Namespaces
      parameters:
      - $ref: '#/components/parameters/PrefixParam'
      - $ref: '#/components/parameters/NextTokenParam'
      - $ref: '#/components/parameters/PerPageParam'
      responses:
        '200':
          description: A list of namespaces
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Namespace'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalError'
  /namespace:
    put:
      operationId: createNamespace
      summary: Create or update a namespace
      description: Creates a new namespace or updates an existing one.
      tags:
      - Namespaces
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Namespace'
      responses:
        '200':
          description: Namespace created or updated
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalError'
  /namespace/{namespaceName}:
    get:
      operationId: readNamespace
      summary: Read a namespace
      description: Returns the details of the specified namespace.
      tags:
      - Namespaces
      parameters:
      - name: namespaceName
        in: path
        required: true
        description: The name of the namespace.
        schema:
          type: string
      responses:
        '200':
          description: Namespace details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Namespace'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalError'
    delete:
      operationId: deleteNamespace
      summary: Delete a namespace
      description: Deletes the specified namespace.
      tags:
      - Namespaces
      parameters:
      - name: namespaceName
        in: path
        required: true
        description: The name of the namespace.
        schema:
          type: string
      responses:
        '200':
          description: Namespace deleted
        '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
    BadRequest:
      description: Bad request
      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
    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
  schemas:
    Namespace:
      type: object
      description: A Nomad namespace for segmenting jobs and objects.
      properties:
        Name:
          type: string
          description: The name of the namespace.
        Description:
          type: string
          description: A human-readable description of the namespace.
        Quota:
          type: string
          description: The name of the quota specification attached to the namespace.
        Meta:
          type: object
          additionalProperties:
            type: string
        CreateIndex:
          type: integer
        ModifyIndex:
          type: integer
  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