---
title: "Locations"
description: "Interface with the autoZnetwork locations."
canonical_url: "https://autoznetwork.com/docs/api/locations"
---

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

# Locations (Rooftops)

**A location belongs to an [organization](https://autoznetwork.com/docs/api/organizations) and is a traditional rooftop for a dealership. This is a parent child relationship, an organization should always have at least one location.

A Location instance resource represents a location within your Organization.

The inventory list resource represents all of the locations that you have created in your account within autoZnetwork. You can POST to the Location resource to create a new location.

### 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>
        active
      </code>
    </td>
    
    <td>
      Boolean
    </td>
    
    <td>
      Identifies the Location as active. Use this as an alternative to deleting the location.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        name
      </code>
    </td>
    
    <td>
      String
    </td>
    
    <td>
      Friendly name for the Location.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        phone_number
      </code>
    </td>
    
    <td>
      String
    </td>
    
    <td>
      Associated phone number.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        email
      </code>
    </td>
    
    <td>
      String
    </td>
    
    <td>
      Associated email address.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        crm_email
      </code>
    </td>
    
    <td>
      String
    </td>
    
    <td>
      Associated CRM email for ADF formatted emails.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        street_address
      </code>
    </td>
    
    <td>
      String
    </td>
    
    <td>
      Associated street address.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        city
      </code>
    </td>
    
    <td>
      String
    </td>
    
    <td>
      Associated city.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        state
      </code>
    </td>
    
    <td>
      String
    </td>
    
    <td>
      Associated state (2 Characters IE: WA, TX, AZ).
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        zip
      </code>
    </td>
    
    <td>
      String
    </td>
    
    <td>
      Associated zip code.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        coordinates
      </code>
    </td>
    
    <td>
      Object
    </td>
    
    <td>
      Latitude and Longitude for the location.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        ip_address
      </code>
    </td>
    
    <td>
      String
    </td>
    
    <td>
      IP address associated the location.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        active
      </code>
    </td>
    
    <td>
      Boolean
    </td>
    
    <td>
      Toggles the location's active status.
    </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 belongs to.
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="/docs/api/location-groups">
        Location Group
      </a>
    </td>
    
    <td>
      The Location Group that the Location belongs to.
    </td>
  </tr>
</tbody>
</table>

## List Locations

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

<code-group>

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

curl https://api.autoznetwork.com/v1/locations \
  -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);

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

print($locations)
```

</code-group>

## Add a Location

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

<code-group>

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

curl -X POST https://api.autoznetwork.com/v1/locations \
  -H "Authorization: Bearer $AUTOZNETWORK_TOKEN" \
  -H "X-AutozNetwork-Organization-Id: $AUTOZNETWORK_ORG_ID" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
    "active": true,
    "name": "your location name",
    "phone_number": "+1234567890",
    "email": "location@mydealership.com",
    "crm_email": "crm_email@mydealership.com",
    "street_address": "1234 N St",
    "city": "Seattle",
    "state": "WA",
    "zip": "12345"
  }'
```

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

$autoZnetwork = new AutozNetwork($apiToken);

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

print($location)
```

</code-group>

## Update a Location

PUT Request: `https://api.autoznetwork.com/v1/locations/{LOCATION_ID}`

<code-group>

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

curl -X PUT https://api.autoznetwork.com/v1/locations/$AUTOZNETWORK_LOCATION_ID \
  -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 name",
  }'
```

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

$autoZnetwork = new AutozNetwork($apiToken);

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

print($location)
```

</code-group>

## Remove a Location

DELETE Request: `https://api.autoznetwork.com/v1/locations/{LOCATION_ID}`

<code-group>

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

curl -X DELETE https://api.autoznetwork.com/v1/locations/$AUTOZNETWORK_LOCATION_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';
$locationId = '9876';

$autoZnetwork = new AutozNetwork($apiToken);

$location = $autoZnetwork
              ->withOrganization($organizationId)
              ->locations($locationId)
              ->delete();

print($location)
```

</code-group>

## Sitemap

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