> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getswitch.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Download Grid File For Single Data Scenario

> Downloads the spatial grid your company's forecasts and imbalance are computed on, for one location, grid type and tile size, as a `grid.geojson` file. The file is a GeoJSON FeatureCollection with one Polygon feature per zone; each feature's only property is `zone_id`, the same zone id used as key in forecast and imbalance responses.

**Use this endpoint to download the complete grid file.**

**Failure Modes:**
- **400**: Location, grid type or tile size not enabled for your company
- **401**: Invalid or missing authentication credentials
- **403**: Insufficient permissions for grid:read scope
- **404**: Your company has no forecast data configured
- **422**: Request validation errors (invalid grid_type, missing location)
- **500**: The grid file could not be read

**Required Auth Scopes:**
- `grid:read`



## OpenAPI

````yaml /api-reference/openapi.json get /grids/stream
openapi: 3.1.0
info:
  title: SWITCH API
  version: '1.0'
  description: >-
    The SWITCH API gives mobility and logistics teams programmatic access to
    SWITCH forecasts, fleet operations, routing and analytics. Every request is
    authenticated with an API key sent as a bearer token.
servers:
  - url: https://api.getswitch.io
    description: Production
security: []
tags:
  - name: Forecast
    description: Demand forecasts per zone and time window.
  - name: Operations
    description: Fleet imbalance, rebalancing suggestions and generated tasks.
  - name: Routing
    description: Route optimisation for single and multiple fleets.
  - name: Routing Sessions
    description: Saved routing sessions, their routes and drivers.
  - name: Routing Operations
    description: Complete, undo and re-route the stops of a route.
  - name: Fleet Management
    description: Your depots, stations, drivers and cargo vehicles.
  - name: Integrations
    description: Vehicles, statuses and commands on your fleet platform.
  - name: Station Based Analytics
    description: Analytics for station-based (docked) services.
  - name: Zone Based Analytics
    description: Analytics for free-floating services, by zone.
  - name: Free Float Analytics
    description: Trip history for free-floating services.
  - name: Transit Analytics
    description: Punctuality and service delivery for public transit.
  - name: Live
    description: Real-time fleet, delivery and transit status.
  - name: Grids
    description: Spatial grids used by forecasts and analytics.
  - name: API Keys
    description: Create and manage the API keys you call this API with.
paths:
  /grids/stream:
    get:
      tags:
        - Grids
      summary: Download Grid File For Single Data Scenario
      description: >-
        Downloads the spatial grid your company's forecasts and imbalance are
        computed on, for one location, grid type and tile size, as a
        `grid.geojson` file. The file is a GeoJSON FeatureCollection with one
        Polygon feature per zone; each feature's only property is `zone_id`, the
        same zone id used as key in forecast and imbalance responses.


        **Use this endpoint to download the complete grid file.**


        **Failure Modes:**

        - **400**: Location, grid type or tile size not enabled for your company

        - **401**: Invalid or missing authentication credentials

        - **403**: Insufficient permissions for grid:read scope

        - **404**: Your company has no forecast data configured

        - **422**: Request validation errors (invalid grid_type, missing
        location)

        - **500**: The grid file could not be read


        **Required Auth Scopes:**

        - `grid:read`
      operationId: download_grid
      parameters:
        - name: grid_type
          in: query
          required: true
          schema:
            type: string
            enum:
              - squares
              - categorical
              - hdbscan
              - agent-3
              - agent-2
              - agent-1
              - agent-4
              - agent-5
              - agent-6
              - agent-7
              - agent-8
              - agent-9
              - custom-polygons
            title: Grid Type
            description: >-
              Type of spatial grid, e.g. `squares` for a regular grid of square
              tiles. Only the grid types (and tile sizes) enabled for your
              company are accepted; a 400 response lists them.
          description: >-
            Type of spatial grid, e.g. `squares` for a regular grid of square
            tiles. Only the grid types (and tile sizes) enabled for your company
            are accepted; a 400 response lists them.
        - name: tile_size
          in: query
          required: false
          schema:
            type:
              - integer
              - 'null'
            title: Tile Size
            description: >-
              Side of each square tile in meters, e.g. 1000 for the `squares`
              grid. Leave empty for grid types without a tile size.
          description: >-
            Side of each square tile in meters, e.g. 1000 for the `squares`
            grid. Leave empty for grid types without a tile size.
        - name: location
          in: query
          required: true
          schema:
            type: string
            title: Location
            description: >-
              Location (city) of the grid, e.g. `milan`. Only the locations
              enabled for your company are accepted; a 400 response lists them.
          description: >-
            Location (city) of the grid, e.g. `milan`. Only the locations
            enabled for your company are accepted; a 400 response lists them.
      responses:
        '200':
          description: >-
            Grid GeoJSON file downloaded successfully. Returns a GeoJSON
            FeatureCollection containing polygon features with zone_id
            properties representing the company's grid configuration.
          content:
            application/json:
              schema: {}
              example:
                type: FeatureCollection
                features:
                  - type: Feature
                    geometry:
                      type: Polygon
                      coordinates:
                        - - - 9.18
                            - 45.46
                          - - 9.1928
                            - 45.46
                          - - 9.1928
                            - 45.469
                          - - 9.18
                            - 45.469
                          - - 9.18
                            - 45.46
                    properties:
                      zone_id: '1042'
                  - type: Feature
                    geometry:
                      type: Polygon
                      coordinates:
                        - - - 9.1928
                            - 45.46
                          - - 9.2056
                            - 45.46
                          - - 9.2056
                            - 45.469
                          - - 9.1928
                            - 45.469
                          - - 9.1928
                            - 45.46
                    properties:
                      zone_id: '1043'
        '400':
          description: >-
            Bad Request. Location, grid type or tile size not enabled for your
            company.
        '401':
          description: Unauthorized. Token is missing or invalid.
        '403':
          description: Forbidden. Insufficient permissions for grid:read scope.
        '404':
          description: >-
            Not Found. No forecast data configured for your company, or unknown
            data scenario.
        '422':
          description: Unprocessable Entity. Invalid request parameters.
        '500':
          description: Internal Server Error. Grid file access errors.
      security:
        - HTTPBearer: []
        - HTTPBearer: []
components:
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer
      description: >-
        An API key, sent as `Authorization: Bearer <key>`. Create one in the
        SWITCH Copilot under **Settings → API keys** (needs the API keys
        permission in your company), or with `POST /auth/api-keys`. The key is
        shown once, at creation.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.