> ## Documentation Index
> Fetch the complete documentation index at: https://www.latitude.sh/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a cluster node group

> Adds a node group to your cluster. Only available for projects that have a GPU cluster; any other project answers 404 PROJECT_NOT_A_CLUSTER. Signed requirements need to be signed again. Needs an owner, administrator or collaborator.



## OpenAPI

````yaml https://spec.speakeasy.com/latitude/latitude/latitude-sh-api-with-code-samples post /projects/{project_id}/cluster/node_groups
openapi: 3.0.1
info:
  title: Latitude.sh API
  version: '2023-06-01'
  description: >-
    The Latitude.sh API is a RESTful API to manage your Latitude.sh account. It
    allows you to perform the same actions as the Latitude.sh dashboard.
servers:
  - url: https://api.latitude.sh
    variables:
      latitude_api_key:
        default: <insert your api key here>
  - url: http://api.latitude.sh
    variables:
      latitude_api_key:
        default: <insert your api key here>
security: []
tags:
  - name: API keys
  - name: Baselines (Preview)
    description: >-
      Preview. Available to teams with the `baselines_api` feature flag. The
      shape of these endpoints may change before general availability.
  - name: Billing
  - name: Clusters
    description: >-
      Projects that have a GPU cluster only. Every operation answers 404
      PROJECT_NOT_A_CLUSTER for a project without one.
  - name: Elastic Ips
  - name: Events
  - name: Firewalls
  - name: Inference
  - name: IP Addresses
  - name: Managed Databases
    description: Managed database instances (PostgreSQL, ClickHouse)
  - name: Kubernetes Clusters
  - name: LKS
  - name: Marketplace apps
  - name: Operating Systems
  - name: Plans
  - name: Sandboxes (Preview)
    description: >-
      Preview. Available to teams with the `sandboxes_api` feature flag. The
      shape of these endpoints may change before general availability.
  - name: Public Networks
  - name: Private Networks
  - name: Projects
  - name: Regions
  - name: Roles
  - name: SSH Keys
  - name: Servers
  - name: Block Storage
  - name: Filesystem Storage
  - name: Object Storage
  - name: Tags
  - name: Teams
  - name: Team members
  - name: Traffic
  - name: User data
  - name: User profile
  - name: Virtual machines
  - name: Virtual machine backups
  - name: Virtual machine restores
paths:
  /projects/{project_id}/cluster/node_groups:
    post:
      tags:
        - Clusters
      summary: Create a cluster node group
      description: >-
        Adds a node group to your cluster. Only available for projects that have
        a GPU cluster; any other project answers 404 PROJECT_NOT_A_CLUSTER.
        Signed requirements need to be signed again. Needs an owner,
        administrator or collaborator.
      operationId: create-project-cluster-node-group
      parameters:
        - name: project_id
          in: path
          required: true
          description: The ID or slug of a project that has a GPU cluster
          examples:
            Created:
              value: proj_lxWpD699qm6rk
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/create_cluster_node_group'
            examples:
              Created:
                summary: Created
                value:
                  data:
                    type: cluster_node_groups
                    attributes:
                      name: login
                      kind: cpu
                      plan: g4-b300-large
                      server_count: 2
                      os: rocky_9_x64
          application/vnd.api+json:
            schema:
              $ref: '#/components/schemas/create_cluster_node_group'
            examples:
              Created:
                summary: Created
                value:
                  data:
                    type: cluster_node_groups
                    attributes:
                      name: login
                      kind: cpu
                      plan: g4-b300-large
                      server_count: 2
                      os: rocky_9_x64
        required: true
      responses:
        '201':
          description: Created
          content:
            application/vnd.api+json:
              examples:
                Created:
                  value:
                    data:
                      id: '8'
                      type: cluster_node_groups
                      attributes:
                        name: login
                        kind: cpu
                        plan: g4-b300-large
                        plan_name: g4.b300.large
                        server_count: 2
                        os: rocky_9_x64
              schema:
                $ref: '#/components/schemas/cluster_node_group'
        '403':
          description: Forbidden (role cannot change node groups)
        '404':
          description: Project is not a cluster
          content:
            application/vnd.api+json:
              examples:
                Project is not a cluster:
                  value:
                    errors:
                      - code: PROJECT_NOT_A_CLUSTER
                        title: Project Not A Cluster
                        detail: This project is not a cluster
                        status: '404'
                        meta: {}
        '409':
          description: Requirements are a draft
          content:
            application/vnd.api+json:
              examples:
                Requirements are a draft:
                  value:
                    errors:
                      - code: REQUIREMENTS_NOT_EDITABLE
                        title: Requirements Not Editable
                        detail: These requirements are not ready for your review yet
                        status: '409'
                        meta: {}
        '422':
          description: >-
            Unprocessable Entity (a field customers can't set, or an operating
            system the plan cannot run)
          content:
            application/vnd.api+json:
              examples:
                Unprocessable Entity (an operating system the plan cannot run):
                  value:
                    errors:
                      - code: VALIDATION_ERROR
                        title: Validation Error
                        detail: >-
                          windows_2022 is not an operating system this node
                          group's plan can run
                        status: '422'
                        meta: {}
      security:
        - Bearer: []
      x-codeSamples:
        - lang: go
          label: Go (SDK)
          source: "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tlatitudeshgosdk \"github.com/latitudesh/latitudesh-go-sdk\"\n\t\"github.com/latitudesh/latitudesh-go-sdk/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n    ctx := context.Background()\n\n    s := latitudeshgosdk.New(\n        latitudeshgosdk.WithSecurity(os.Getenv(\"LATITUDESH_BEARER\")),\n    )\n\n    res, err := s.Clusters.CreateProjectClusterNodeGroup(ctx, \"proj_lxWpD699qm6rk\", components.CreateClusterNodeGroup{\n        Data: components.CreateClusterNodeGroupData{\n            Type: components.CreateClusterNodeGroupTypeClusterNodeGroups,\n            Attributes: components.CreateClusterNodeGroupAttributes{\n                Name: \"login\",\n                Kind: components.CreateClusterNodeGroupKindCPU,\n                Plan: \"g4-b300-large\",\n                ServerCount: 2,\n                Os: latitudeshgosdk.Pointer(\"rocky_9_x64\"),\n            },\n        },\n    })\n    if err != nil {\n        log.Fatal(err)\n    }\n    if res.ClusterNodeGroup != nil {\n        // handle response\n    }\n}"
        - lang: typescript
          label: Typescript (SDK)
          source: |-
            import { Latitudesh } from "latitudesh-typescript-sdk";

            const latitudesh = new Latitudesh({
              bearer: process.env["LATITUDESH_BEARER"] ?? "",
            });

            async function run() {
              const result = await latitudesh.clusters.createProjectClusterNodeGroup({
                projectId: "proj_lxWpD699qm6rk",
                createClusterNodeGroup: {
                  data: {
                    type: "cluster_node_groups",
                    attributes: {
                      name: "login",
                      kind: "cpu",
                      plan: "g4-b300-large",
                      serverCount: 2,
                      os: "rocky_9_x64",
                    },
                  },
                },
              });

              console.log(result);
            }

            run();
components:
  schemas:
    create_cluster_node_group:
      type: object
      properties:
        data:
          type: object
          properties:
            type:
              type: string
              enum:
                - cluster_node_groups
            attributes:
              type: object
              properties:
                name:
                  type: string
                  maxLength: 64
                  description: >-
                    Unique within the cluster; leading and trailing spaces are
                    trimmed
                kind:
                  type: string
                  enum:
                    - gpu
                    - cpu
                    - storage
                    - management
                    - other
                plan:
                  type: string
                  description: The slug of a bare-metal or GPU plan on sale
                server_count:
                  type: integer
                  minimum: 1
                  maximum: 1024
                os:
                  type: string
                  nullable: true
                  description: >-
                    An operating system slug the plan can run, or empty or null
                    to clear it. Changing the plan checks the node group's
                    operating system against the new plan.
              required:
                - name
                - kind
                - plan
                - server_count
          required:
            - type
            - attributes
      required:
        - data
    cluster_node_group:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/cluster_node_group_data'
    cluster_node_group_data:
      type: object
      properties:
        id:
          type: string
          example: '7'
          description: The node group id
        type:
          type: string
          enum:
            - cluster_node_groups
        attributes:
          type: object
          properties:
            name:
              type: string
              example: gpu-workers
            kind:
              type: string
              enum:
                - gpu
                - cpu
                - storage
                - management
                - other
              example: gpu
            plan:
              type: string
              nullable: true
              example: g4-b300-large
              description: The plan slug; null while no plan is set
            plan_name:
              type: string
              nullable: true
              example: g4.b300.large
            server_count:
              type: integer
              example: 16
            os:
              type: string
              nullable: true
              example: ubuntu_24_04_x64_lts
              description: The operating system slug; null while none is set
  securitySchemes:
    Bearer:
      type: apiKey
      name: Authorization
      in: header

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.