# Points of interest

> Documentation index: https://ridewithgps.com/api/v1/doc/llms.txt

**Organizations only.** Manage your organization's points of interest and attach them to its routes.

See also: [Points of interest](https://ridewithgps.com/api/v1/doc/reference/points_of_interest.md).

OpenAPI specification for these endpoints: https://ridewithgps.com/api/v1/openapi/openapi_points_of_interest.yaml

## Returns a list of points of interest

`GET /api/v1/points_of_interest.json`

Returns a paginated list of points of interest for the authenticated organization.

**Note**: This endpoint is available for organizations only.

### Headers

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `x-rwgps-api-key` | string | yes | API key for identifying the client application |
| `x-rwgps-auth-token` | string | yes | Authentication token for the user |

### Parameters

| Name | Type | In | Required | Description |
| --- | --- | --- | --- | --- |
| `page` | integer | query | no | Page number for pagination |
| `page_size` | integer | query | no | Number of items per page (20-200) |

### Response `200`

| Name | Type | Description |
| --- | --- | --- |
| `points_of_interest` | array of objects |  |
| `points_of_interest[].id` | integer |  |
| `points_of_interest[].user_id` | integer |  |
| `points_of_interest[].type` | string |  |
| `points_of_interest[].type_id` | integer |  |
| `points_of_interest[].type_name` | string |  |
| `points_of_interest[].name` | string |  |
| `points_of_interest[].description` | string or null |  |
| `points_of_interest[].url` | string |  |
| `points_of_interest[].lat` | number |  |
| `points_of_interest[].lng` | number |  |
| `meta` | object |  |
| `meta.pagination` | object |  |
| `meta.pagination.record_count` | integer | Total number of records |
| `meta.pagination.page_count` | integer | Total number of pages |
| `meta.pagination.page_size` | integer | Number of records per page |
| `meta.pagination.next_page_url` | string or null | URL for the next page (null if last page) |

### Errors

- `401` Unauthorized

### Example request

```bash
curl \
  -H "x-rwgps-api-key: $API_KEY" \
  -H "x-rwgps-auth-token: $AUTH_TOKEN" \
  https://ridewithgps.com/api/v1/points_of_interest.json
```

### Example response

```json
{
  "points_of_interest": [
    {
      "id": 123,
      "user_id": 123,
      "type": "coffee",
      "type_id": 123,
      "type_name": "Coffee",
      "name": "Coffee stop",
      "description": "Good espresso before the climb",
      "url": "https://ridewithgps.com/api/v1/points_of_interest/123.json",
      "lat": 45.521529,
      "lng": -122.691804
    }
  ],
  "meta": {
    "pagination": {
      "record_count": 45,
      "page_count": 3,
      "page_size": 20,
      "next_page_url": "https://ridewithgps.com/api/v1/points_of_interest.json?page=2"
    }
  }
}
```

## Returns the specified point of interest

`GET /api/v1/points_of_interest/{id}.json`

Returns detailed information about a specific point of interest.

**Note**: This endpoint is available for organizations only.

### Headers

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `x-rwgps-api-key` | string | yes | API key for identifying the client application |
| `x-rwgps-auth-token` | string | yes | Authentication token for the user |

### Parameters

| Name | Type | In | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | integer | path | yes |  |

### Response `200`

| Name | Type | Description |
| --- | --- | --- |
| `point_of_interest` | object |  |
| `point_of_interest.id` | integer |  |
| `point_of_interest.user_id` | integer |  |
| `point_of_interest.type` | string |  |
| `point_of_interest.type_id` | integer |  |
| `point_of_interest.type_name` | string |  |
| `point_of_interest.name` | string |  |
| `point_of_interest.description` | string or null |  |
| `point_of_interest.url` | string |  |
| `point_of_interest.lat` | number |  |
| `point_of_interest.lng` | number |  |
| `point_of_interest.distances` | array of numbers | Distances from start in meters for waypoints |
| `point_of_interest.tag_names` | array of strings |  |

### Errors

- `401` Unauthorized
- `404` Point of interest not found

### Example request

```bash
curl \
  -H "x-rwgps-api-key: $API_KEY" \
  -H "x-rwgps-auth-token: $AUTH_TOKEN" \
  https://ridewithgps.com/api/v1/points_of_interest/123.json
```

### Example response

```json
{
  "point_of_interest": {
    "id": 123,
    "user_id": 123,
    "type": "coffee",
    "type_id": 123,
    "type_name": "Coffee",
    "name": "Coffee stop",
    "description": "Good espresso before the climb",
    "url": "https://ridewithgps.com/api/v1/points_of_interest/123.json",
    "lat": 45.521529,
    "lng": -122.691804,
    "distances": [
      12487.3
    ],
    "tag_names": [
      "Tag names"
    ]
  }
}
```

## Creates a point of interest

`POST /api/v1/points_of_interest.json`

Create a new point of interest in the authenticated organization's library.

**Note**: This endpoint is available for organizations only.

### Headers

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `x-rwgps-api-key` | string | yes | API key for identifying the client application |
| `x-rwgps-auth-token` | string | yes | Authentication token for the user |

### Request body (`application/json`)

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `point_of_interest` | object | yes |  |
| `point_of_interest.name` | string | no |  |
| `point_of_interest.description` | string or null | no |  |
| `point_of_interest.poi_type` | string | no |  |
| `point_of_interest.url` | string or null | no |  |
| `point_of_interest.lat` | number | no | Latitude |
| `point_of_interest.lng` | number | no | Longitude |
| `point_of_interest.tag_names` | array of strings | no | Replaces all tags. Send an empty array to remove them. |

### Response `200`

| Name | Type | Description |
| --- | --- | --- |
| `point_of_interest` | object |  |
| `point_of_interest.id` | integer |  |
| `point_of_interest.user_id` | integer |  |
| `point_of_interest.type` | string |  |
| `point_of_interest.type_id` | integer |  |
| `point_of_interest.type_name` | string |  |
| `point_of_interest.name` | string |  |
| `point_of_interest.description` | string or null |  |
| `point_of_interest.url` | string |  |
| `point_of_interest.lat` | number |  |
| `point_of_interest.lng` | number |  |

### Errors

- `401` Unauthorized

### Example request

```bash
curl \
  -H "x-rwgps-api-key: $API_KEY" \
  -H "x-rwgps-auth-token: $AUTH_TOKEN" \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{
  "point_of_interest": {
    "name": "Coffee stop",
    "description": "Good espresso before the climb",
    "poi_type": "coffee",
    "url": "https://example.com",
    "lat": 45.521529,
    "lng": -122.691804,
    "tag_names": [
      "Tag names"
    ]
  }
}' \
  https://ridewithgps.com/api/v1/points_of_interest.json
```

### Example response

```json
{
  "point_of_interest": {
    "id": 123,
    "user_id": 123,
    "type": "coffee",
    "type_id": 123,
    "type_name": "Coffee",
    "name": "Coffee stop",
    "description": "Good espresso before the climb",
    "url": "https://ridewithgps.com/api/v1/points_of_interest/123.json",
    "lat": 45.521529,
    "lng": -122.691804
  }
}
```

## Associates a point of interest with a route

`POST /api/v1/points_of_interest/{id}/routes/{route_id}.json`

Associates a point of interest with a specific route

**Note**: This endpoint is available for organizations only.

### Headers

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `x-rwgps-api-key` | string | yes | API key for identifying the client application |
| `x-rwgps-auth-token` | string | yes | Authentication token for the user |

### Parameters

| Name | Type | In | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | integer | path | yes |  |
| `route_id` | integer | path | yes |  |

### Errors

- `404` POI or route not found

### Example request

```bash
curl \
  -H "x-rwgps-api-key: $API_KEY" \
  -H "x-rwgps-auth-token: $AUTH_TOKEN" \
  -X POST \
  https://ridewithgps.com/api/v1/points_of_interest/123/routes/123.json
```

## Updates the specified point of interest

`PUT /api/v1/points_of_interest/{id}.json`

Updates an existing point of interest in the authenticated organization's library.

**Note**: This endpoint is available for organizations only.

### Headers

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `x-rwgps-api-key` | string | yes | API key for identifying the client application |
| `x-rwgps-auth-token` | string | yes | Authentication token for the user |

### Parameters

| Name | Type | In | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | integer | path | yes |  |

### Request body (`application/json`)

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `point_of_interest` | object | yes |  |
| `point_of_interest.name` | string | no |  |
| `point_of_interest.description` | string or null | no |  |
| `point_of_interest.poi_type` | string | no |  |
| `point_of_interest.url` | string or null | no |  |
| `point_of_interest.lat` | number | no | Latitude |
| `point_of_interest.lng` | number | no | Longitude |
| `point_of_interest.tag_names` | array of strings | no | Replaces all tags. Send an empty array to remove them. |

### Response `200`

| Name | Type | Description |
| --- | --- | --- |
| `point_of_interest` | object |  |
| `point_of_interest.id` | integer |  |
| `point_of_interest.user_id` | integer |  |
| `point_of_interest.type` | string |  |
| `point_of_interest.type_id` | integer |  |
| `point_of_interest.type_name` | string |  |
| `point_of_interest.name` | string |  |
| `point_of_interest.description` | string or null |  |
| `point_of_interest.url` | string |  |
| `point_of_interest.lat` | number |  |
| `point_of_interest.lng` | number |  |
| `point_of_interest.distances` | array of numbers | Distances from start in meters for waypoints |
| `point_of_interest.tag_names` | array of strings |  |

### Errors

- `401` Unauthorized
- `404` Point of interest not found
- `422` Validation error

### Example request

```bash
curl \
  -H "x-rwgps-api-key: $API_KEY" \
  -H "x-rwgps-auth-token: $AUTH_TOKEN" \
  -X PUT \
  -H "Content-Type: application/json" \
  -d '{
  "point_of_interest": {
    "name": "Coffee stop",
    "description": "Good espresso before the climb",
    "poi_type": "coffee",
    "url": "https://example.com",
    "lat": 45.521529,
    "lng": -122.691804,
    "tag_names": [
      "Tag names"
    ]
  }
}' \
  https://ridewithgps.com/api/v1/points_of_interest/123.json
```

### Example response

```json
{
  "point_of_interest": {
    "id": 123,
    "user_id": 123,
    "type": "coffee",
    "type_id": 123,
    "type_name": "Coffee",
    "name": "Coffee stop",
    "description": "Good espresso before the climb",
    "url": "https://ridewithgps.com/api/v1/points_of_interest/123.json",
    "lat": 45.521529,
    "lng": -122.691804,
    "distances": [
      12487.3
    ],
    "tag_names": [
      "Tag names"
    ]
  }
}
```

## Deletes the specified point of interest

`DELETE /api/v1/points_of_interest/{id}.json`

Deletes a point of interest owned by the authenticated organization.

**Note**: This endpoint is available for organizations only.

### Headers

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `x-rwgps-api-key` | string | yes | API key for identifying the client application |
| `x-rwgps-auth-token` | string | yes | Authentication token for the user |

### Parameters

| Name | Type | In | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | integer | path | yes |  |

### Response `204`

Point of interest deleted successfully

### Errors

- `401` Unauthorized
- `404` Point of interest not found

### Example request

```bash
curl \
  -H "x-rwgps-api-key: $API_KEY" \
  -H "x-rwgps-auth-token: $AUTH_TOKEN" \
  -X DELETE \
  https://ridewithgps.com/api/v1/points_of_interest/123.json
```

## Disassociates a point of interest from a route

`DELETE /api/v1/points_of_interest/{id}/routes/{route_id}.json`

Removes the association between a point of interest and a specific route

**Note**: This endpoint is available for organizations only.

### Headers

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `x-rwgps-api-key` | string | yes | API key for identifying the client application |
| `x-rwgps-auth-token` | string | yes | Authentication token for the user |

### Parameters

| Name | Type | In | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | integer | path | yes |  |
| `route_id` | integer | path | yes |  |

### Response `204`

POI disassociated from route successfully

### Errors

- `401` Unauthorized
- `404` POI or route not found

### Example request

```bash
curl \
  -H "x-rwgps-api-key: $API_KEY" \
  -H "x-rwgps-auth-token: $AUTH_TOKEN" \
  -X DELETE \
  https://ridewithgps.com/api/v1/points_of_interest/123/routes/123.json
```
