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

# List placement groups

> List all placement groups in the specified project and region.



## OpenAPI

````yaml /api-reference/services_docs_mintlify_enriched/cloud_api.yaml get /cloud/v1/servergroups/{project_id}/{region_id}
openapi: 3.1.0
info:
  title: Gcore OpenAPI – Cloud API
  description: >-
    This OpenAPI is an aggregated OpenAPI specification that unifies all Gcore
    products into a single file. It covers Cloud, CDN, DNS, WAAP, DDoS
    Protection, Object Storage, Streaming, and FastEdge services.
  version: 23526a255bc8
servers:
  - url: https://api.gcore.com
security:
  - APIKey: []
tags:
  - name: Bare Metal
  - name: Container as a Service
  - name: Cost Reports
  - name: DDoS Protection
  - name: Everywhere Inference
  - name: Everywhere Inference Apps
  - name: File Shares
  - name: Floating IPs
  - name: Function as a Service
  - name: GPU Bare Metal
  - name: GPU Virtual
  - name: IP Ranges
  - name: Images
  - name: Instances
  - name: Load Balancers
  - name: Logging
  - name: Managed Kubernetes
  - name: Managed PostgreSQL
  - name: Networks
  - name: Placement Groups
  - name: Ports
  - name: Projects
  - name: Quotas
  - name: Regions
  - name: Registry
  - name: Reservations
  - name: Reserved IPs
  - name: Routers
  - name: SSH Keys
  - name: Secrets
  - name: Security Groups
  - name: Snapshot Schedules
  - name: Snapshots
  - name: Tasks
  - name: User Actions
  - name: User Role Assignments
  - name: Volumes
paths:
  /cloud/v1/servergroups/{project_id}/{region_id}:
    get:
      tags:
        - Placement Groups
      summary: List placement groups
      description: List all placement groups in the specified project and region.
      operationId: ServerGroupsViewSet.get
      parameters:
        - in: path
          name: project_id
          required: true
          description: Project ID
          schema:
            description: Project ID
            example: 1
            examples:
              - 1
            title: Project Id
            type: integer
        - in: path
          name: region_id
          required: true
          description: Region ID
          schema:
            description: Region ID
            example: 1
            examples:
              - 1
            title: Region Id
            type: integer
        - in: query
          name: limit
          required: false
          description: Optional. Limit the number of returned items
          schema:
            default: 1000
            description: Optional. Limit the number of returned items
            example: 1000
            examples:
              - 1000
            exclusiveMinimum: 0
            maximum: 1000
            title: Limit
            type: integer
        - in: query
          name: offset
          required: false
          description: >-
            Optional. Offset value is used to exclude the first set of records
            from the result
          schema:
            default: 0
            description: >-
              Optional. Offset value is used to exclude the first set of records
              from the result
            example: 0
            examples:
              - 0
            minimum: 0
            title: Offset
            type: integer
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServerGroupCollectionSerializer'
      x-codeSamples:
        - lang: Python
          source: |-
            import os
            from gcore import Gcore

            client = Gcore(
                api_key=os.environ.get("GCORE_API_KEY"),  # This is the default and can be omitted
            )
            page = client.cloud.placement_groups.list(
                project_id=1,
                region_id=1,
            )
            page = page.results[0]
            print(page.project_id)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/G-Core/gcore-go\"\n\t\"github.com/G-Core/gcore-go/cloud\"\n\t\"github.com/G-Core/gcore-go/option\"\n)\n\nfunc main() {\n\tclient := gcore.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Cloud.PlacementGroups.List(context.TODO(), cloud.PlacementGroupListParams{\n\t\tProjectID: gcore.Int(1),\n\t\tRegionID:  gcore.Int(1),\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n"
components:
  schemas:
    ServerGroupCollectionSerializer:
      properties:
        count:
          description: Number of objects
          example: 1
          examples:
            - 1
          minimum: 0
          title: Count
          type: integer
        results:
          description: Objects
          items:
            $ref: '#/components/schemas/ServerGroupSerializer'
          title: Results
          type: array
      required:
        - count
        - results
      title: ServerGroupCollectionSerializer
      type: object
    ServerGroupSerializer:
      properties:
        instances:
          description: The list of instances in this server group.
          example:
            - instance_id: 6d14f194-6c1e-49b3-9fc7-50dc8401eb74
              instance_name: my-instance-1
            - instance_id: 142988bb-291e-4862-bffb-b1cf20036c27
              instance_name: my-instance-2
          examples:
            - - instance_id: 6d14f194-6c1e-49b3-9fc7-50dc8401eb74
                instance_name: my-instance-1
              - instance_id: 142988bb-291e-4862-bffb-b1cf20036c27
                instance_name: my-instance-2
          items:
            $ref: '#/components/schemas/InstanceBriefSerializer'
          title: Instances
          type: array
        name:
          description: The name of the server group.
          example: my-server-group
          examples:
            - my-server-group
          title: Name
          type: string
        policy:
          description: >-
            The server group policy. Options are: anti-affinity, affinity, or
            soft-anti-affinity.
          example: anti-affinity
          examples:
            - anti-affinity
          title: Policy
          type: string
        project_id:
          description: Project ID
          example: 1337
          examples:
            - 1337
          title: Project Id
          type: integer
        region:
          description: Region name
          example: Luxembourg 1
          examples:
            - Luxembourg 1
          title: Region
          type: string
        region_id:
          description: Region ID
          example: 7
          examples:
            - 7
          title: Region Id
          type: integer
        servergroup_id:
          description: The ID of the server group.
          example: 47003067-550a-6f17-93b6-81ee16ba061e
          examples:
            - 47003067-550a-6f17-93b6-81ee16ba061e
          title: Servergroup Id
          type: string
      required:
        - project_id
        - region_id
        - region
        - servergroup_id
        - policy
        - name
        - instances
      title: Server group schema
      type: object
    InstanceBriefSerializer:
      properties:
        instance_id:
          description: The ID of the instance, corresponding to the attribute 'id'.
          example: 142988bb-aa1e-4862-bffb-1bc2f0036c77
          examples:
            - 142988bb-aa1e-4862-bffb-1bc2f0036c77
          title: Instance Id
          type: string
        instance_name:
          description: The name of the instance, corresponding to the attribute 'name'.
          example: test_instance
          examples:
            - test_instance
          title: Instance Name
          type: string
      required:
        - instance_id
        - instance_name
      title: Instance brief details schema
      type: object
  securitySchemes:
    APIKey:
      description: >-
        API key for authentication. Make sure to include the word `apikey`,
        followed by a single space and then your token.

        Example: `apikey 1234_abcdef`
      type: apiKey
      in: header
      name: Authorization

````