# Map API

Source: https://frameleaf.app/docs/api/reference/map/

Use your own server and its scoped API keys.

## Retrieve map markers

GET /api/map/markers

Retrieve a list of latitude and longitude coordinates for every asset with location data.

```json
{
  "description": "Retrieve a list of latitude and longitude coordinates for every asset with location data.",
  "operationId": "getMapMarkers",
  "parameters": [
    {
      "name": "fileCreatedAfter",
      "required": false,
      "in": "query",
      "description": "Filter assets created after this date",
      "schema": {
        "format": "date-time",
        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
        "example": "2024-01-01T00:00:00.000Z",
        "type": "string"
      }
    },
    {
      "name": "fileCreatedBefore",
      "required": false,
      "in": "query",
      "description": "Filter assets created before this date",
      "schema": {
        "format": "date-time",
        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
        "example": "2024-01-01T00:00:00.000Z",
        "type": "string"
      }
    },
    {
      "name": "isArchived",
      "required": false,
      "in": "query",
      "description": "Filter by archived status",
      "schema": {
        "type": "boolean"
      }
    },
    {
      "name": "isFavorite",
      "required": false,
      "in": "query",
      "description": "Filter by favorite status",
      "schema": {
        "type": "boolean"
      }
    },
    {
      "name": "withSharedAlbums",
      "required": false,
      "in": "query",
      "description": "Include shared album assets",
      "schema": {
        "type": "boolean"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "items": {
              "$ref": "#/components/schemas/MapMarkerResponseDto"
            },
            "type": "array"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Retrieve map markers",
  "tags": [
    "Map"
  ],
  "x-frameleaf-permission": "map.read"
}
```

## Reverse geocode coordinates

GET /api/map/reverse-geocode

Retrieve location information (e.g., city, country) for given latitude and longitude coordinates.

```json
{
  "description": "Retrieve location information (e.g., city, country) for given latitude and longitude coordinates.",
  "operationId": "reverseGeocode",
  "parameters": [
    {
      "name": "lat",
      "required": true,
      "in": "query",
      "description": "Latitude (-90 to 90)",
      "schema": {
        "format": "double",
        "type": "number"
      }
    },
    {
      "name": "lon",
      "required": true,
      "in": "query",
      "description": "Longitude (-180 to 180)",
      "schema": {
        "format": "double",
        "type": "number"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "items": {
              "$ref": "#/components/schemas/MapReverseGeocodeResponseDto"
            },
            "type": "array"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Reverse geocode coordinates",
  "tags": [
    "Map"
  ],
  "x-frameleaf-permission": "map.search"
}
```

## Retrieve map statistics

GET /api/map/statistics

Count what the map settings would add: the viewer's own located archived items and the located items of partners who share their locations, under the same date and favorite filters, and the viewer's own items without a location.

```json
{
  "description": "Count what the map settings would add: the viewer's own located archived items and the located items of partners who share their locations, under the same date and favorite filters, and the viewer's own items without a location.",
  "operationId": "getMapStatistics",
  "parameters": [
    {
      "name": "fileCreatedAfter",
      "required": false,
      "in": "query",
      "description": "Filter assets created after this date",
      "schema": {
        "format": "date-time",
        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
        "example": "2024-01-01T00:00:00.000Z",
        "type": "string"
      }
    },
    {
      "name": "fileCreatedBefore",
      "required": false,
      "in": "query",
      "description": "Filter assets created before this date",
      "schema": {
        "format": "date-time",
        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
        "example": "2024-01-01T00:00:00.000Z",
        "type": "string"
      }
    },
    {
      "name": "isArchived",
      "required": false,
      "in": "query",
      "description": "Filter by archived status",
      "schema": {
        "type": "boolean"
      }
    },
    {
      "name": "isFavorite",
      "required": false,
      "in": "query",
      "description": "Filter by favorite status",
      "schema": {
        "type": "boolean"
      }
    },
    {
      "name": "withSharedAlbums",
      "required": false,
      "in": "query",
      "description": "Include shared album assets",
      "schema": {
        "type": "boolean"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/MapStatisticsResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Retrieve map statistics",
  "tags": [
    "Map"
  ],
  "x-frameleaf-permission": "map.read"
}
```
