---
title: "Location Groups"
description: "Interface with the autoZnetwork location groups."
canonical_url: "https://autoznetwork.com/docs/api/location-groups"
---

> Index of every page on this site: [llms.txt](https://autoznetwork.com/llms.txt)

# Location Groups

**A default location group is created for every organization.

A Location Group instance resource represents a group of locations within an Organization. This is usually used for locations within close proximity.

### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        id
      </code>
    </td>
    
    <td>
      Integer
    </td>
    
    <td>
      The ID of the Location.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        default
      </code>
    </td>
    
    <td>
      Boolean
    </td>
    
    <td>
      Identifies the Location Group as default.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        name
      </code>
    </td>
    
    <td>
      String
    </td>
    
    <td>
      Friendly name for the Location.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        coordinates
      </code>
    </td>
    
    <td>
      Object
    </td>
    
    <td>
      Latitude and Longitude of a central point for the group.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        created_at
      </code>
    </td>
    
    <td>
      DateTime
    </td>
    
    <td>
      DateTime the Location was created in autoZnetwork's system.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        updated_at
      </code>
    </td>
    
    <td>
      DateTime
    </td>
    
    <td>
      DateTime the Location was last updated in autoZnetwork's system.
    </td>
  </tr>
</tbody>
</table>

### Relationships

<table>
<thead>
  <tr>
    <th>
      Relationship
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a href="/docs/api/organizations">
        Organization
      </a>
    </td>
    
    <td>
      The Organization the Location Group belongs to.
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="/docs/api/locations">
        Locations
      </a>
    </td>
    
    <td>
      The locations that are contained within the Location Group.
    </td>
  </tr>
</tbody>
</table>

## List Location Groups

GET Request: `https://api.autoznetwork.com/v1/location_groups`

<code-group>

```bash [CURL]
AUTOZNETWORK_TOKEN="your API token"
AUTOZNETWORK_ORG_ID="your organization id"

curl https://api.autoznetwork.com/v1/location_groups \
  -H "Authorization: Bearer $AUTOZNETWORK_TOKEN" \
  -H "X-AutozNetwork-Organization-Id: $AUTOZNETWORK_ORG_ID" \
  -H 'Accept: application/json'
```

```php [PHP]
<?php 
$apiToken = 'ABCD12345 ...';
$organizationId = '1234';

$autoZnetwork = new AutozNetwork($apiToken);

$locationGroups = $autoznetwork
              ->withOrganization($organizationId)
              ->locationGroups()
              ->get();

print($locationGroups)
```

</code-group>

## Add a Location Group

POST Request: `https://api.autoznetwork.com/v1/location_groups`

<code-group>

```bash [CURL]
AUTOZNETWORK_TOKEN="your API token"
AUTOZNETWORK_ORG_ID="your organization id"

curl -X POST https://api.autoznetwork.com/v1/location_groups \
  -H "Authorization: Bearer $AUTOZNETWORK_TOKEN" \
  -H "X-AutozNetwork-Organization-Id: $AUTOZNETWORK_ORG_ID" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "your location group name",
  }'
```

```php [PHP]
<?php 
$apiToken = 'ABCD12345 ...';
$organizationId = '1234';

$autoZnetwork = new AutozNetwork($apiToken);

$locationGroup = $autoZnetwork
                  ->withOrganization($organizationId)
                  ->locationGrups()
                  ->create([
                    'active' => true,
                    'name' => 'your location name'
                  ]);

print($locationGroup)
```

</code-group>

## Update a Location Group

PUT Request: `https://api.autoznetwork.com/v1/location_groups/{LOCATION_GROUP_ID}`

<code-group>

```bash [CURL]
AUTOZNETWORK_TOKEN="your API token"
AUTOZNETWORK_ORG_ID="your organization id"

curl -X PUT https://api.autoznetwork.com/v1/location_groups \
  -H "Authorization: Bearer $AUTOZNETWORK_TOKEN" \
  -H "X-AutozNetwork-Organization-Id: $AUTOZNETWORK_ORG_ID" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "your NEW location group name",
  }'
```

```php [PHP]
<?php 
$apiToken = 'ABCD12345 ...';
$organizationId = '1234';

$autoZnetwork = new AutozNetwork($apiToken);

$locationGroup = $autoZnetwork
                  ->withOrganization($organizationId)
                  ->locationGroups()
                  ->update([
                    'name' => 'your NEW location group name'
                  ]);

print($locationGroup)
```

</code-group>

## Remove a Location Group

DELETE Request: `https://api.autoznetwork.com/v1/location_groups/{LOCATION_GROUP_ID}`

<code-group>

```bash [CURL]
AUTOZNETWORK_TOKEN="your API token"
AUTOZNETWORK_ORG_ID="your organization id"
AUTOZNETWORK_LOCATION_GROUP_ID="your location id"

curl -X DELETE https://api.autoznetwork.com/v1/location_groups/$AUTOZNETWORK_LOCATION_GROUP_ID \
  -H "Authorization: Bearer $AUTOZNETWORK_TOKEN" \
  -H "X-AutozNetwork-Organization-Id: $AUTOZNETWORK_ORG_ID" \
  -H 'Accept: application/json'
```

```php [PHP]
<?php 
$apiToken = 'ABCD12345 ...';
$organizationId = '1234';
$locationGroupId = '9876';

$autoZnetwork = new AutozNetwork($apiToken);

$location = $autoZnetwork
              ->withOrganization($organizationId)
              ->locationGroups($locationGroupId)
              ->delete();

print($location)
```

</code-group>

## Sitemap

See the full [sitemap](https://autoznetwork.com/sitemap.md) for all pages.
