---
title: "Retrieve an operation"
method: GET
path: "/operations/{operationId}"
tags: ["Operations"]
---

# Retrieve an operation

`GET /operations/{operationId}`

## Request

- Base URL: `https://api.spoke.com/public/v1`
- URL: `https://api.spoke.com/public/v1/operations/{operationId}`
- Auth: HTTP basic
- TypeScript: <https://skmtc.dev/spoke/apis/spoke-api/docs/operations/:operationId/get.ts> (a function with typed inputs; its response is checked against the schema)

## Path parameters

- `operationId` string, required

## Response `200`

The requested operation

- OperationSchema
  - `id` string, required
  - `type` 'plan_optimization', required
  - `done` boolean, required: Whether the operation is done.
  - `metadata` object, required: Metadata related to a plan optimization operation.
    - `canceled` boolean, required: Whether the operation was canceled.
    - `startedAt` number, required: The time the operation started at, in seconds since epoch.
    - `finishedAt` number, nullable, required: The time the operation finished at, in seconds since epoch.
    - `startedBy` union, required: The entity that started the operation.
      - 'dispatcher'
      - 'api'
      - string
    - `targetPlanId` string, required
  - `result` union, required: The result of the plan optimization operation, or an error.
    - object
      - `numOptimizedStops` number, required: The number of stops that were considered for optimization.
      - `skippedStops` object[], required: The stops that were skipped, if any.
        - `id` string, required
        - `reason` union, required: The reason the stop was skipped.
          - 'impossible_time_window'
          - 'impossible_navigation'
          - 'impossible_number_of_stops'
          - 'impossible_order_of_stops'
          - string
    - object
      - `code` string, required: A code that identifies the error
      - `message` string, required: A human-readable message that describes the error. This message is not intended to be parsed by machines.

## Other responses

- `400`: ID format is invalid
- `401`: Unauthorized
- `404`: Not Found
- `500`: An internal server error occurred

---

[API](https://skmtc.dev/spoke/apis/spoke-api.md) - [All operations](https://skmtc.dev/spoke/apis/spoke-api/llms.txt) - [OpenAPI document](https://skmtc.dev/spoke/apis/spoke-api/revisions/a09d9194ae1c?raw)
