---
agentTools:
  projectIndex: https://developer-docs.gomotive.com/llms.txt
---

# List all the groups

**Purpose**: Use this API to fetch a list of all the available groups in your organisation.

```ruby Ruby (OAuth 2.0)
require 'uri'
require 'net/http'

url = URI('https://api.gomotive.com/v1/groups')

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request['Authorization'] = "Bearer <OAUTH_TOKEN>"

response = http.request(request)
puts response.read_body
```

## Response Parameters

### Groups

* **Type**: Array of Objects
* **Description**: Contains a list of groups.

### id

* **Type**: Integer
* **Description**: The unique identifier for the group.

### name

* **Type**: String
* **Description**: The name of the group.

### company\_id

* **Type**: Integer
* **Description**: The unique identifier for the company associated with the group.

### parent\_id

* **Type**: Integer
* **Description**: Denotes the ID of the group's parent.

### creator

* **Type**: Object or null
* **Description**: The creator of the group, if available.

***

### user

* **Type**: Object
* **Description**: Details about the user associated with the group.

### id

* **Type**: Integer
* **Description**: The unique identifier for the user.

### first\_name

* **Type**: String
* **Description**: The first name of the user.

### last\_name

* **Type**: String
* **Description**: The last name of the user.

### username

* **Type**: String or null
* **Description**: The username of the user, if available.

### email

* **Type**: String
* **Description**: The email address of the user.

### driver\_company\_id

* **Type**: Integer
* **Description**: The unique identifier for the company associated with the driver.

### status

* **Type**: String
* **Description**: The status of the user.

### role

* **Type**: String
* **Description**: The role of the user within the company.

***

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Motive",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://api.gomotive.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/v1/groups": {
      "get": {
        "summary": "List all the groups",
        "description": "",
        "operationId": "fetch-a-list-of-all-the-groups-of-a-company",
        "parameters": [
          {
            "name": "updated_after",
            "in": "query",
            "description": "Specify a date to fetch the groups that were updated after that date.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "description": "Number of records to return per page.",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 25
            }
          },
          {
            "name": "page_no",
            "in": "query",
            "description": "Denotes the current page number.",
            "schema": {
              "type": "string",
              "default": "1"
            }
          },
          {
            "name": "X-Time-Zone",
            "in": "header",
            "description": "Time zone used to format timestamps.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Metric-Units",
            "in": "header",
            "description": "Specify if you want to use the Metric units or the Imperial units. TRUE: Metric units. FALSE: Imperial Units",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "X-User-Id",
            "in": "header",
            "description": "Specify the ID of the Fleet Admin or the Fleet Manager who is accessing this endpoint.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Fetch a list of all the available groups": {
                    "value": "  {\n  \"groups\": [\n    {\n      \"group\": {\n        \"id\": 6,\n        \"name\": \"Garden, Electronics & Baby\",\n        \"company_id\": 75,\n\t\t\t\t\"parent_id\": null,\n        \"creator\": null\n      }\n    },\n    {\n      \"group\": {\n        \"id\": 5,\n        \"name\": \"music\",\n        \"company_id\": 75,\n        \"user\": {\n          \"id\": 158,\n          \"first_name\": \"Amory\",\n          \"last_name\": \"Davis\",\n          \"username\": null,\n          \"email\": \"d77d64aa04d1@keeptruckin.com\",\n          \"driver_company_id\": 75,\n          \"status\": \"active\",\n          \"role\": \"admin\"\n        }\n      }\n    }\n  ],\n  \"pagination\": {\n    \"per_page\": 25,\n    \"page_no\": 1,\n    \"total\": 2\n  }\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "groups": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "group": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "integer",
                                "example": 6,
                                "default": 0
                              },
                              "name": {
                                "type": "string",
                                "example": "Garden, Electronics & Baby"
                              },
                              "company_id": {
                                "type": "integer",
                                "example": 75,
                                "default": 0
                              },
                              "parent_id": {},
                              "creator": {}
                            }
                          }
                        }
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "per_page": {
                          "type": "integer",
                          "example": 25,
                          "default": 0
                        },
                        "page_no": {
                          "type": "integer",
                          "example": 1,
                          "default": 0
                        },
                        "total": {
                          "type": "integer",
                          "example": 2,
                          "default": 0
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true,
  "_id": "66acf64a829e88001980fbf2:66d72f006707eb0018260089"
}
```