> ## 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.

# Synchronize Company Stations

> Replace all your company's stations with the ones your connected fleet platform publishes, for every location configured for your operations. The import is all or nothing: if any station cannot be read or is invalid (missing name, address or capacity, bad coordinates or polygon), nothing changes. Only some fleet integrations publish stations.

**Failure Modes:**
- **401**: Token is missing or invalid
- **403**: Insufficient permissions
- **422**: No operations fleet or locations configured, or your fleet integration does not publish stations
- **502**: The fleet platform could not be read, or returned an invalid station

**Required Auth Scopes:**
- `copilot:optimize`



## OpenAPI

````yaml /api-reference/openapi.json post /operations/stations/sync
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:
  /operations/stations/sync:
    post:
      tags:
        - Fleet Management
      summary: Synchronize Company Stations
      description: >-
        Replace all your company's stations with the ones your connected fleet
        platform publishes, for every location configured for your operations.
        The import is all or nothing: if any station cannot be read or is
        invalid (missing name, address or capacity, bad coordinates or polygon),
        nothing changes. Only some fleet integrations publish stations.


        **Failure Modes:**

        - **401**: Token is missing or invalid

        - **403**: Insufficient permissions

        - **422**: No operations fleet or locations configured, or your fleet
        integration does not publish stations

        - **502**: The fleet platform could not be read, or returned an invalid
        station


        **Required Auth Scopes:**

        - `copilot:optimize`
      operationId: sync_stations
      responses:
        '200':
          description: Stations replaced. Returns how many were imported.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StationSyncPublic'
        '401':
          description: Unauthorized. Token is missing or invalid.
        '403':
          description: Forbidden. Insufficient permissions.
        '422':
          description: >-
            Unprocessable Entity. Operations fleet, locations or station-capable
            integration not configured.
        '502':
          description: >-
            Bad Gateway. Fleet platform unreachable or returned an invalid
            station.
      security:
        - HTTPBearer: []
        - HTTPBearer: []
components:
  schemas:
    StationSyncPublic:
      properties:
        stations_replaced:
          type: integer
          title: Stations Replaced
          description: Number of stations imported; they replace all previous ones.
      type: object
      required:
        - stations_replaced
      title: StationSyncPublic
      description: Result of a station synchronization.
      examples:
        - stations_replaced: 148
  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.