# Locations

## Get Locations

<mark style="color:blue;">`GET`</mark> `https://api.binity.io/v1/companies/:uuid/locations`

Get all locations of that specific company.

#### Headers

| Name          | Type   | Description  |
| ------------- | ------ | ------------ |
| Authorization | string | Bearer Token |

{% tabs %}
{% tab title="200 Cake successfully retrieved." %}

```
{
  "locations":[
    {
      "uuid":"f0634f09-e8d4-48dc-93ea-717aae9a47ca",
      "name":"Stuttgart",
      "lat":"48.76288512",
      "lng":"9.26070838",
      "street_name":"Am Mittelkai",
      "street_number":"23",
      "zip_code":"70327",
      "city":"Stuttgart",
      "state":"Baden-Württemberg",
      "country":"DE",
      "preformatted":"Am Mittelkai 23, 70327 Stuttgart, Germany",
      "created_at":"2020-06-08T10:16:16.508+02:00",
      "updated_at":"2021-03-16T06:56:42.764+01:00"
    }
  ],
  "meta":{
    "pagination":{
      "per_page":25,
      "total_pages":1,
      "total_objects":4,
      "links":{
        "first":"/v1/companies/f0634f09-e8d4-48dc-93ea-717aae9a47ca/locations?page=1",
        "last":"/v1/companies/f0634f09-e8d4-48dc-93ea-717aae9a47ca/locations?page=1"
      }
    }
  }
}
```

{% endtab %}
{% endtabs %}

## Create Location

<mark style="color:green;">`POST`</mark> `https://api.binity.io/v1/companies/:uuid/locations`

Create a new location for that company.

#### Headers

| Name          | Type   | Description  |
| ------------- | ------ | ------------ |
| Authorization | string | Bearer Token |

#### Request Body

| Name | Type   | Description             |
| ---- | ------ | ----------------------- |
| name | string | Name of the location    |
| lat  | string | Coordinates (Latitude)  |
| lng  | string | Coordinates (Longitude) |

{% tabs %}
{% tab title="200 " %}

```
{
  "location":{
    "uuid":"f0634f09-e8d4-48dc-93ea-717aae9a47ca",
    "name":"Stuttgart",
    "lat":"48.76288512",
    "lng":"9.26070838",
    "street_name":"Am Mittelkai",
    "street_number":"23",
    "zip_code":"70327",
    "city":"Stuttgart",
    "state":"Baden-Württemberg",
    "country":"DE",
    "preformatted":"Am Mittelkai 23, 70327 Stuttgart, Germany",
    "created_at":"2020-06-08T10:16:16.508+02:00",
    "updated_at":"2021-03-16T06:56:42.764+01:00"
  }
}
```

{% endtab %}
{% endtabs %}

## Get Location

<mark style="color:blue;">`GET`</mark> `https://api.binity.io/v1/companies/:uuid/locations/:location_uuid`

Get data of a single location.

#### Headers

| Name          | Type   | Description  |
| ------------- | ------ | ------------ |
| Authorization | string | Bearer Token |

{% tabs %}
{% tab title="200 " %}

```
{
  "location":{
    "uuid":"f0634f09-e8d4-48dc-93ea-717aae9a47ca",
    "name":"Stuttgart",
    "lat":"48.76288512",
    "lng":"9.26070838",
    "street_name":"Am Mittelkai",
    "street_number":"23",
    "zip_code":"70327",
    "city":"Stuttgart",
    "state":"Baden-Württemberg",
    "country":"DE",
    "preformatted":"Am Mittelkai 23, 70327 Stuttgart, Germany",
    "created_at":"2020-06-08T10:16:16.508+02:00",
    "updated_at":"2021-03-16T06:56:42.764+01:00"
  }
}
```

{% endtab %}
{% endtabs %}

## Update Location

<mark style="color:purple;">`PATCH`</mark> `https://api.binity.io/v1/companies/:uuid/locations/:location_uuid`

Update data of a single location.

#### Headers

| Name          | Type   | Description  |
| ------------- | ------ | ------------ |
| Authorization | string | Bearer Token |

{% tabs %}
{% tab title="200 " %}

```
{
  "location":{
    "uuid":"f0634f09-e8d4-48dc-93ea-717aae9a47ca",
    "name":"Stuttgart",
    "lat":"48.76288512",
    "lng":"9.26070838",
    "street_name":"Am Mittelkai",
    "street_number":"23",
    "zip_code":"70327",
    "city":"Stuttgart",
    "state":"Baden-Württemberg",
    "country":"DE",
    "preformatted":"Am Mittelkai 23, 70327 Stuttgart, Germany",
    "created_at":"2020-06-08T10:16:16.508+02:00",
    "updated_at":"2021-03-16T06:56:42.764+01:00"
  }
}
```

{% endtab %}
{% endtabs %}

## Delete Location

<mark style="color:red;">`DELETE`</mark> `https://api.binity.io/v1/companies/:uuid/locations/:location_uuid`

Delete a single location.

#### Headers

| Name          | Type   | Description  |
| ------------- | ------ | ------------ |
| Authorization | string | Bearer Token |

{% tabs %}
{% tab title="200 " %}

```
{
  "deleted": true
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.binity.io/locations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
