> For the complete documentation index, see [llms.txt](https://navixy.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://navixy.com/docs/navixy-api/user-api/resources/tracking/map_layer.md).

# Map layer

User-supplied KML overlays drawn on top of the Navixy platform's map.

A map layer is a KML file a user uploads to draw their own geometry over the platform's map.

A layer is created by uploading its file and is read back as that same file. The layer object itself is metadata only, an ID and a name, so `map_layer/update` renames a layer and does nothing else. To replace the geometry, upload a new layer and delete the old one.

## Map layer object

## The MapLayer object

```json
{"openapi":"3.1.0","info":{"title":"Navixy Platform API","version":"1.0.0"},"components":{"schemas":{"MapLayer":{"type":"object","description":"A user-supplied KML overlay shown on the map. This object is the metadata only; the KML body is read separately.","properties":{"id":{"type":"integer","description":"Map layer ID. Read-only, assigned on upload, and required when updating.","minimum":1},"label":{"type":"string","description":"Name of the layer. Trimmed, and cannot be empty.","minLength":1}}}}}}
```

## API actions

API base path: `/map_layer`.

Operations that list no errors of their own return only the [general error codes](/docs/navixy-api/general/errors.md#error-codes).

***

## Read map layer

> Return the body of a map layer.\
> \
> \*\*The response is the KML file itself\*\*, served as \`application/vnd.google-earth.kml+xml; charset=utf-8\`, not a JSON envelope. Only a failure comes back as JSON.\
> \
> Reachable from a geo-link session as well as an ordinary one.\
> \
> Also accepts GET with the same parameters as query-string values.

```json
{"openapi":"3.1.0","info":{"title":"Navixy Platform API","version":"1.0.0"},"tags":[{"name":"Tracking services","description":"Services supporting tracking rather than the trackers themselves: APN lookup, BLE beacon data, delivery tracking, geocoding, map layers and data forwarding. Resources under the /apn_settings/, /beacon/, /delivery/, /geocoder/, /map_layer/ and /retranslator/ paths."}],"servers":[{"url":"https://api.eu.navixy.com/v2","description":"Navixy production server on European platform"},{"url":"https://api.us.navixy.com/v2","description":"Navixy production server on American platform"},{"url":"https://api.me.navixy.com/v2","description":"Navixy production server on Middle East platform"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{"api_key":{"type":"apiKey","description":"Either a user session hash or an API key, with the \"NVX \" prefix, for example \"NVX 22eac1c27af4be7b9d04da2ce1af111b\". Obtain a session hash from the userAuth operation, or create an API key from the API keys operations. A small number of operations accept a session hash only and reject an API key with error code 4; each says so in its description.","name":"Authorization","in":"header"}},"responses":{"ResponseError":{"description":"Error response object","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"Always false."},"status":{"type":"object","description":"Error status. Present only when an error occurred.","properties":{"code":{"type":"integer","description":"An error code in this API, not an HTTP code."},"description":{"type":"string","description":"An error description."}}},"errors":{"type":"array","description":"Per-parameter detail, returned with validation failures such as error code 7. A parameter name here may be an internal field name rather than the documented parameter name.","items":{"type":"object","properties":{"parameter":{"type":"string","description":"Name of the parameter that failed validation."},"error":{"type":"string","description":"What was wrong with it."}}}}}}}}}}},"paths":{"/map_layer/read":{"post":{"tags":["Tracking services"],"summary":"Read map layer","description":"Return the body of a map layer.\n\n**The response is the KML file itself**, served as `application/vnd.google-earth.kml+xml; charset=utf-8`, not a JSON envelope. Only a failure comes back as JSON.\n\nReachable from a geo-link session as well as an ordinary one.\n\nAlso accepts GET with the same parameters as query-string values.","operationId":"mapLayerRead","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"integer","description":"ID of the map layer.","minimum":1}},"required":["id"]}}}},"responses":{"200":{"description":"The layer body as KML","content":{"application/vnd.google-earth.kml+xml":{"schema":{"type":"string","description":"The KML document."}}}},"400":{"description":"Bad request. The response body carries the API-level error code in `status.code`. Validation failures also include an `errors` array naming each offending parameter.","$ref":"#/components/responses/ResponseError"},"default":{"$ref":"#/components/responses/ResponseError"}}}}}}
```

#### Errors

These errors come in addition to the [general error codes](/docs/navixy-api/general/errors.md#error-codes):

* 201 - Not found in the database, when the current user has no map layer with the given ID.

***

## List map layers

> Return the metadata of every map layer belonging to the account. Bodies are not included; read them one at a time with \`map\_layer/read\`.\
> \
> Callable with an empty body. Reachable from a geo-link session as well as an ordinary one. Also accepts GET.

```json
{"openapi":"3.1.0","info":{"title":"Navixy Platform API","version":"1.0.0"},"tags":[{"name":"Tracking services","description":"Services supporting tracking rather than the trackers themselves: APN lookup, BLE beacon data, delivery tracking, geocoding, map layers and data forwarding. Resources under the /apn_settings/, /beacon/, /delivery/, /geocoder/, /map_layer/ and /retranslator/ paths."}],"servers":[{"url":"https://api.eu.navixy.com/v2","description":"Navixy production server on European platform"},{"url":"https://api.us.navixy.com/v2","description":"Navixy production server on American platform"},{"url":"https://api.me.navixy.com/v2","description":"Navixy production server on Middle East platform"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{"api_key":{"type":"apiKey","description":"Either a user session hash or an API key, with the \"NVX \" prefix, for example \"NVX 22eac1c27af4be7b9d04da2ce1af111b\". Obtain a session hash from the userAuth operation, or create an API key from the API keys operations. A small number of operations accept a session hash only and reject an API key with error code 4; each says so in its description.","name":"Authorization","in":"header"}},"schemas":{"MapLayer":{"type":"object","description":"A user-supplied KML overlay shown on the map. This object is the metadata only; the KML body is read separately.","properties":{"id":{"type":"integer","description":"Map layer ID. Read-only, assigned on upload, and required when updating.","minimum":1},"label":{"type":"string","description":"Name of the layer. Trimmed, and cannot be empty.","minLength":1}}}},"responses":{"ResponseError":{"description":"Error response object","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"Always false."},"status":{"type":"object","description":"Error status. Present only when an error occurred.","properties":{"code":{"type":"integer","description":"An error code in this API, not an HTTP code."},"description":{"type":"string","description":"An error description."}}},"errors":{"type":"array","description":"Per-parameter detail, returned with validation failures such as error code 7. A parameter name here may be an internal field name rather than the documented parameter name.","items":{"type":"object","properties":{"parameter":{"type":"string","description":"Name of the parameter that failed validation."},"error":{"type":"string","description":"What was wrong with it."}}}}}}}}}}},"paths":{"/map_layer/list":{"post":{"tags":["Tracking services"],"summary":"List map layers","description":"Return the metadata of every map layer belonging to the account. Bodies are not included; read them one at a time with `map_layer/read`.\n\nCallable with an empty body. Reachable from a geo-link session as well as an ordinary one. Also accepts GET.","operationId":"mapLayerList","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{}}}}},"responses":{"200":{"description":"The map layers","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"`true` if request finished successfully.","readOnly":true},"list":{"type":"array","items":{"$ref":"#/components/schemas/MapLayer"}}}}}}},"400":{"description":"Bad request. The response body carries the API-level error code in `status.code`. Validation failures also include an `errors` array naming each offending parameter.","$ref":"#/components/responses/ResponseError"},"default":{"$ref":"#/components/responses/ResponseError"}}}}}}
```

***

## Upload map layer

> Create a map layer from a KML file.\
> \
> \*\*This is a multipart request\*\*, not JSON: \`multipart/form-data\` with the KML in a part named \`file\`. The file is validated against the KML 2.0 and 2.2 schemas and rejected if it does not conform.

```json
{"openapi":"3.1.0","info":{"title":"Navixy Platform API","version":"1.0.0"},"tags":[{"name":"Tracking services","description":"Services supporting tracking rather than the trackers themselves: APN lookup, BLE beacon data, delivery tracking, geocoding, map layers and data forwarding. Resources under the /apn_settings/, /beacon/, /delivery/, /geocoder/, /map_layer/ and /retranslator/ paths."}],"servers":[{"url":"https://api.eu.navixy.com/v2","description":"Navixy production server on European platform"},{"url":"https://api.us.navixy.com/v2","description":"Navixy production server on American platform"},{"url":"https://api.me.navixy.com/v2","description":"Navixy production server on Middle East platform"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{"api_key":{"type":"apiKey","description":"Either a user session hash or an API key, with the \"NVX \" prefix, for example \"NVX 22eac1c27af4be7b9d04da2ce1af111b\". Obtain a session hash from the userAuth operation, or create an API key from the API keys operations. A small number of operations accept a session hash only and reject an API key with error code 4; each says so in its description.","name":"Authorization","in":"header"}},"responses":{"ResponseError":{"description":"Error response object","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"Always false."},"status":{"type":"object","description":"Error status. Present only when an error occurred.","properties":{"code":{"type":"integer","description":"An error code in this API, not an HTTP code."},"description":{"type":"string","description":"An error description."}}},"errors":{"type":"array","description":"Per-parameter detail, returned with validation failures such as error code 7. A parameter name here may be an internal field name rather than the documented parameter name.","items":{"type":"object","properties":{"parameter":{"type":"string","description":"Name of the parameter that failed validation."},"error":{"type":"string","description":"What was wrong with it."}}}}}}}}}}},"paths":{"/map_layer/upload":{"post":{"tags":["Tracking services"],"summary":"Upload map layer","description":"Create a map layer from a KML file.\n\n**This is a multipart request**, not JSON: `multipart/form-data` with the KML in a part named `file`. The file is validated against the KML 2.0 and 2.2 schemas and rejected if it does not conform.","operationId":"mapLayerUpload","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","description":"The KML file to import.","format":"binary"},"label":{"type":"string","description":"Name for the new layer. Trimmed, and cannot be empty.","minLength":1},"redirect_target":{"type":"string","description":"Optional. URL to redirect to after the upload. When given, the response is a redirect to `<redirect_target>?response=<urlencoded_response_json>` instead of a JSON body."}},"required":["file","label"]}}}},"responses":{"200":{"description":"The created layer","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"`true` if request finished successfully.","readOnly":true},"id":{"type":"integer","description":"ID of the new map layer."}}}}}},"400":{"description":"Bad request. The response body carries the API-level error code in `status.code`. Validation failures also include an `errors` array naming each offending parameter.","$ref":"#/components/responses/ResponseError"},"402":{"description":"Error 268: the account's quota for map layers is exhausted.","$ref":"#/components/responses/ResponseError"},"403":{"description":"Error 233: the `file` part is missing. Error 234: the file has the wrong MIME type. Error 242: the file is not valid KML.","$ref":"#/components/responses/ResponseError"},"default":{"$ref":"#/components/responses/ResponseError"}}}}}}
```

#### Errors

These errors come in addition to the [general error codes](/docs/navixy-api/general/errors.md#error-codes):

* 233 - No data file, when the `file` part is missing.
* 234 - Invalid data format, when the file has the wrong MIME type.
* 242 - Validation error, when the uploaded file is not valid KML.
* 268 - Over quota, when the user's quota for map layers is exceeded.

***

## Update map layer

> Rename a map layer.\
> \
> Only the metadata changes. To replace the KML body, upload a new layer and delete the old one.

```json
{"openapi":"3.1.0","info":{"title":"Navixy Platform API","version":"1.0.0"},"tags":[{"name":"Tracking services","description":"Services supporting tracking rather than the trackers themselves: APN lookup, BLE beacon data, delivery tracking, geocoding, map layers and data forwarding. Resources under the /apn_settings/, /beacon/, /delivery/, /geocoder/, /map_layer/ and /retranslator/ paths."}],"servers":[{"url":"https://api.eu.navixy.com/v2","description":"Navixy production server on European platform"},{"url":"https://api.us.navixy.com/v2","description":"Navixy production server on American platform"},{"url":"https://api.me.navixy.com/v2","description":"Navixy production server on Middle East platform"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{"api_key":{"type":"apiKey","description":"Either a user session hash or an API key, with the \"NVX \" prefix, for example \"NVX 22eac1c27af4be7b9d04da2ce1af111b\". Obtain a session hash from the userAuth operation, or create an API key from the API keys operations. A small number of operations accept a session hash only and reject an API key with error code 4; each says so in its description.","name":"Authorization","in":"header"}},"schemas":{"MapLayer":{"type":"object","description":"A user-supplied KML overlay shown on the map. This object is the metadata only; the KML body is read separately.","properties":{"id":{"type":"integer","description":"Map layer ID. Read-only, assigned on upload, and required when updating.","minimum":1},"label":{"type":"string","description":"Name of the layer. Trimmed, and cannot be empty.","minLength":1}}}},"responses":{"OK":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"`true` if request finished successfully.","readOnly":true}}}}}},"ResponseError":{"description":"Error response object","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"Always false."},"status":{"type":"object","description":"Error status. Present only when an error occurred.","properties":{"code":{"type":"integer","description":"An error code in this API, not an HTTP code."},"description":{"type":"string","description":"An error description."}}},"errors":{"type":"array","description":"Per-parameter detail, returned with validation failures such as error code 7. A parameter name here may be an internal field name rather than the documented parameter name.","items":{"type":"object","properties":{"parameter":{"type":"string","description":"Name of the parameter that failed validation."},"error":{"type":"string","description":"What was wrong with it."}}}}}}}}}}},"paths":{"/map_layer/update":{"post":{"tags":["Tracking services"],"summary":"Update map layer","description":"Rename a map layer.\n\nOnly the metadata changes. To replace the KML body, upload a new layer and delete the old one.","operationId":"mapLayerUpdate","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"layer":{"allOf":[{"$ref":"#/components/schemas/MapLayer"}],"description":"The layer to update. `id` is required and identifies it."}},"required":["layer"]}}}},"responses":{"200":{"description":"Layer updated","$ref":"#/components/responses/OK"},"400":{"description":"Bad request. The response body carries the API-level error code in `status.code`. Validation failures also include an `errors` array naming each offending parameter.","$ref":"#/components/responses/ResponseError"},"default":{"$ref":"#/components/responses/ResponseError"}}}}}}
```

#### Errors

These errors come in addition to the [general error codes](/docs/navixy-api/general/errors.md#error-codes):

* 201 - Not found in the database, when the current user has no map layer with the given ID.

***

## Delete map layer

> Delete a map layer and its body.\
> \
> Also accepts GET with the same parameters as query-string values.

```json
{"openapi":"3.1.0","info":{"title":"Navixy Platform API","version":"1.0.0"},"tags":[{"name":"Tracking services","description":"Services supporting tracking rather than the trackers themselves: APN lookup, BLE beacon data, delivery tracking, geocoding, map layers and data forwarding. Resources under the /apn_settings/, /beacon/, /delivery/, /geocoder/, /map_layer/ and /retranslator/ paths."}],"servers":[{"url":"https://api.eu.navixy.com/v2","description":"Navixy production server on European platform"},{"url":"https://api.us.navixy.com/v2","description":"Navixy production server on American platform"},{"url":"https://api.me.navixy.com/v2","description":"Navixy production server on Middle East platform"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{"api_key":{"type":"apiKey","description":"Either a user session hash or an API key, with the \"NVX \" prefix, for example \"NVX 22eac1c27af4be7b9d04da2ce1af111b\". Obtain a session hash from the userAuth operation, or create an API key from the API keys operations. A small number of operations accept a session hash only and reject an API key with error code 4; each says so in its description.","name":"Authorization","in":"header"}},"responses":{"OK":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"`true` if request finished successfully.","readOnly":true}}}}}},"ResponseError":{"description":"Error response object","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"Always false."},"status":{"type":"object","description":"Error status. Present only when an error occurred.","properties":{"code":{"type":"integer","description":"An error code in this API, not an HTTP code."},"description":{"type":"string","description":"An error description."}}},"errors":{"type":"array","description":"Per-parameter detail, returned with validation failures such as error code 7. A parameter name here may be an internal field name rather than the documented parameter name.","items":{"type":"object","properties":{"parameter":{"type":"string","description":"Name of the parameter that failed validation."},"error":{"type":"string","description":"What was wrong with it."}}}}}}}}}}},"paths":{"/map_layer/delete":{"post":{"tags":["Tracking services"],"summary":"Delete map layer","description":"Delete a map layer and its body.\n\nAlso accepts GET with the same parameters as query-string values.","operationId":"mapLayerDelete","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"integer","description":"ID of the map layer.","minimum":1}},"required":["id"]}}}},"responses":{"200":{"description":"Layer deleted","$ref":"#/components/responses/OK"},"400":{"description":"Bad request. The response body carries the API-level error code in `status.code`. Validation failures also include an `errors` array naming each offending parameter.","$ref":"#/components/responses/ResponseError"},"default":{"$ref":"#/components/responses/ResponseError"}}}}}}
```

#### Errors

These errors come in addition to the [general error codes](/docs/navixy-api/general/errors.md#error-codes):

* 201 - Not found in the database, when the current user has no map layer with the given ID.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://navixy.com/docs/navixy-api/user-api/resources/tracking/map_layer.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
