# Facility Network Map

<figure><img src="/files/Ag1aiPXo5vIHicnPRGJv" alt=""><figcaption></figcaption></figure>

### **Authentication**

Include the following headers in your requests:

* **Access-Token**: The access token obtained from the "Create Access Token" endpoint.
* **x-api-key:** The API key provided by GenLogs. This header must be included in the request.

### Permissions

Make sure that your api user is created with a role that has `external-api-shipper-network-map` permission

### **Endpoint**

* **URL**: `https://api.genlogs.io/facility/<facility_id>/network-map`
* **Method**: `GET`

### **Response**

* **200 OK**: Returns the facility network map in GeoJSON format. The payload is normalized as a FeatureCollection.
* **400 Bad Request**: If required parameters are missing or invalid.
* **401 Unauthorized**: If the `Access-Token` or `x-api-key` is missing or invalid.
* **403 Forbidden**: If the user is not allowed to access this endpoint.
* **500 Internal Server Error**: If an error occurs on the server while processing the request.

### **Response Body**

When the request succeeds, the endpoint returns a GeoJSON `FeatureCollection` whose structure follows `FacilityNetworkMapSchema`:

* `type`: Always `FeatureCollection`.
* `features`: Array of GeoJSON `Feature` objects.
* Each feature has:
  * `geometry`: standard GeoJSON geometry (point, line, polygon) with coordinates relative to the facility.
  * `properties`: metadata about the lane (analysis window, history window, etc.).

### **Request example**

```
curl --location 'https://api.genlogs.io/facility/0x4Y4CTmYr6kauPugLT9k4zg/network-map' \
--header 'Content-Type: application/json' \
--header 'access-token: <access-token>' \
--header 'x-api-key: <x-api-key>'
```

## Retrieve the GeoJSON network map for a facility

> Returns the GeoJSON network map associated with the specified facility.

```json
{"openapi":"3.0.2","info":{"title":"Shipper API - Facility Network Map","version":"1.0.0"},"tags":[{"name":"Facilities","description":"Returns the facility network map in GeoJSON format"}],"servers":[{"url":"https://api.genlogs.io"}],"paths":{"/facility/{facility_id}/network-map":{"get":{"summary":"Retrieve the GeoJSON network map for a facility","description":"Returns the GeoJSON network map associated with the specified facility.","operationId":"getFacilityNetworkMap","tags":["Facilities"],"parameters":[{"name":"facility_id","in":"path","required":true,"schema":{"type":"string"},"description":"Trimble identifier for the facility."}],"responses":{"200":{"description":"Facility GeoJSON network map (FeatureCollection)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FacilityNetworkMap"}}}},"401":{"description":"Missing or invalid token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthError"}}}},"403":{"description":"Token expired or user lacks the required role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthError"}}}},"500":{"description":"Unexpected error while fetching or parsing GeoJSON.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}}},"components":{"schemas":{"FacilityNetworkMap":{"type":"object","required":["type","features"],"properties":{"type":{"type":"string"},"features":{"type":"array","items":{"$ref":"#/components/schemas/FacilityNetworkFeature"}}}},"FacilityNetworkFeature":{"type":"object","required":["type","geometry","properties"],"properties":{"type":{"type":"string"},"geometry":{"$ref":"#/components/schemas/GeoJSONGeometry"},"properties":{"type":"object","additionalProperties":true,"description":"Arbitrary metadata associated with the feature."}}},"GeoJSONGeometry":{"type":"object","required":["type","coordinates"],"properties":{"type":{"type":"string","enum":["Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon"]},"coordinates":{"type":"array","items":{},"description":"GeoJSON coordinate array whose structure depends on geometry type."}}},"AuthError":{"type":"object","properties":{"message":{"type":"string"},"subcode":{"type":"integer","description":"Optional subcode with additional error context."}}}}}}
```


---

# 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.genlogs.io/shipper/facility-network-map.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.
