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

# Manage Locations and Service Areas

> Add and manage your business locations and define the areas where you provide services.

<Info>
  Use the Locations page to manage multiple business/office/practice addresses and specify where you can travel or work (service areas).
</Info>

## Overview

* **Locations**: Physical addresses for your business. You can add multiple locations and mark one as primary.
* **Service areas**: The regions where you operate, defined with flexible labels (e.g., cities, zip codes, regions) and optional radius.

<CardGroup cols={2}>
  <Card title="Add locations" icon="map-pin" href="#add-a-location">
    Create one or more business addresses with full address details.
  </Card>

  <Card title="Define service areas" icon="globe" href="#add-a-service-area">
    Specify where you travel or work, such as cities or zip codes.
  </Card>
</CardGroup>

## Prerequisites

* You must be part of an organization and signed in.
* Your organization is selected in the sidebar.

<Steps>
  <Step title="Open Locations">
    Go to Dashboard → Tools → Locations.

    <Check>
      You should see sections for Locations and Service areas.
    </Check>
  </Step>

  <Step title="Add a location" id="add-a-location">
    Click “Add location” and provide:

    * **Name**: The location label (e.g., Main Office).
    * **Address**: Address line 1/2, city, state/region, postal code, country.

    <Check>
      The new location appears in the list.
    </Check>
  </Step>

  <Step title="Edit or delete a location">
    Use the Edit or Delete actions on any location card.
  </Step>

  <Step title="Add a service area" id="add-a-service-area">
    Click “Add service area” and provide:

    * **Label**: Human-readable name (e.g., San Francisco, Bay Area, 94107).
    * **Type**: Optional—use your own conventions (e.g., city, postal\_code, region).
    * **Value**: Optional—structured value if you need it (e.g., 94107).
    * **Radius (km)**: Optional—use a radius to indicate coverage around a point.
    * **Country**: Optional—ISO or country name for clarity.

    <Tip>
      You can link a service area to a specific location later by editing it (UI linking will be added in a future update).
    </Tip>
  </Step>

  <Step title="Edit or delete a service area">
    Use the Edit or Delete actions on any service area card.
  </Step>
</Steps>

## API

These endpoints are available via the authenticated API and used by the app.

<AccordionGroup>
  <Accordion title="List locations">
    <RequestExample>
      ```bash cURL theme={null}
      curl -X GET '$SERVER_URL/locations' -H 'x-user-token: YOUR_TOKEN'
      ```
    </RequestExample>

    <ResponseExample>
      ```json Success theme={null}
      [
        {
          "id": "9ff0a7e0-2cbe-4a5a-9b8a-3d1b3e9c1234",
          "organization_id": "b2f0d8f0-2d3c-4d1e-a0a0-9eefaf2a0001",
          "name": "Main Office",
          "address_line1": "123 Market St",
          "address_line2": null,
          "city": "San Francisco",
          "state": "CA",
          "postal_code": "94107",
          "country": "US",
          "latitude": null,
          "longitude": null,
          "is_primary": false,
          "created_at": "2025-11-14T10:00:00Z",
          "updated_at": "2025-11-14T10:00:00Z"
        }
      ]
      ```
    </ResponseExample>
  </Accordion>

  <Accordion title="Create location">
    <RequestExample>
      ```bash cURL theme={null}
      curl -X POST '$SERVER_URL/locations' \
        -H 'Content-Type: application/json' \
        -H 'x-user-token: YOUR_TOKEN' \
        -d '{
          "name": "Main Office",
          "address_line1": "123 Market St",
          "city": "San Francisco",
          "state": "CA",
          "postal_code": "94107",
          "country": "US"
        }'
      ```
    </RequestExample>
  </Accordion>

  <Accordion title="List service areas">
    <RequestExample>
      ```bash cURL theme={null}
      curl -X GET '$SERVER_URL/service-areas' -H 'x-user-token: YOUR_TOKEN'
      ```
    </RequestExample>
  </Accordion>

  <Accordion title="Create service area">
    <RequestExample>
      ```bash cURL theme={null}
      curl -X POST '$SERVER_URL/service-areas' \
        -H 'Content-Type: application/json' \
        -H 'x-user-token: YOUR_TOKEN' \
        -d '{
          "label": "San Francisco",
          "area_type": "city",
          "value": "San Francisco",
          "country": "US"
        }'
      ```
    </RequestExample>
  </Accordion>
</AccordionGroup>

<Warning>
  All requests must include a valid `x-user-token`. Rate limits and RLS policies apply.
</Warning>

## Troubleshooting

* If you don’t see data: confirm your current organization is selected and you have access.
* If a request fails: check the response body and Sentry logs for details.
