---
title: Save the plan changes
description: Save the plan changes after re-optimization without distributing
  it. This endpoint is optional since re-distribute already saves the changes.
url: /api/v0.2b/live-plans/savePlan
---

# Save the plan changes

`POST /plans/{planId}:save`

````yaml
openapi: 3.1.0
info:
  title: Spoke API
  version: v0.2b
servers:
  - url: https://api.spoke.com/public/v0.2b
security:
  - BasicAuth: []
paths:
  /plans/{planId}:save:
    post:
      operationId: savePlan
      summary: Save the plan changes
      tags:
        - Live Plans
      description: Save the plan changes after re-optimization without distributing it. This endpoint is optional since re-distribute already saves the changes.
      parameters:
        - schema:
            type: string
            pattern: ^[a-zA-Z0-9---_]{1,50}$
          in: path
          name: planId
          required: true
          description: The plan id
      responses:
        "204":
          description: Plan saved successfully
        "400":
          description: ID format is invalid
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: The error message.
                  code:
                    type: string
                    description: The error code.
                  param:
                    type: string
                    description: The parameter that caused the error.
                  url:
                    type: string
                    description: The URL with more information about the error.
                required:
                  - message
                description: ID format is invalid
                title: The request is invalid
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: The error message.
                  url:
                    type: string
                    description: The URL with more information about the error.
                required:
                  - message
                description: Unauthorized
        "403":
          description: Plan is no longer accessible due to data access restrictions. Upgrade to a plan that supports a longer delivery history period to access it.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    enum:
                      - Plan is no longer accessible due to data access restrictions. Upgrade to a plan that supports a longer delivery history period to access it.
                  code:
                    type: string
                    enum:
                      - plan_inaccessible
                  url:
                    type: string
                    enum:
                      - https://dispatch.spoke.com/paywall
                required:
                  - message
                  - code
                  - url
                description: Plan is no longer accessible due to data access restrictions. Upgrade to a plan that supports a longer delivery history period to access it.
        "404":
          description: The provided plan id does not exist
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    enum:
                      - Plan not found
                required:
                  - message
                description: The provided plan id does not exist
                title: Plan not found
        "409":
          description: The plan is not yet optimized, an optimization is in progress or it was modified whilst processing request.
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    properties:
                      message:
                        type: string
                        enum:
                          - Plan not optimized
                      code:
                        type: string
                        enum:
                          - plan_not_optimized
                    required:
                      - message
                      - code
                    description: The plan is not optimized.
                    title: Plan not optimized
                  - type: object
                    properties:
                      message:
                        type: string
                        enum:
                          - Plan optimization in progress
                      code:
                        type: string
                        enum:
                          - plan_optimization_in_progress
                    required:
                      - message
                      - code
                    description: The plan's optimization is in progress.
                    title: Plan optimization in progress
                  - type: object
                    properties:
                      message:
                        type: string
                        enum:
                          - Plan was modified by a concurrent request. Please retry your request.
                      code:
                        type: string
                        enum:
                          - plan_concurrent_modification
                    required:
                      - message
                      - code
                    description: Plan modified whilst processing request
                    title: Plan modified whilst processing request
                description: The plan is not yet optimized, an optimization is in progress or it was modified whilst processing request.
        "500":
          description: An internal server error occurred
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: The error message.
                  code:
                    type: string
                    description: The error code.
                  param:
                    type: string
                    description: The parameter that caused the error.
                  url:
                    type: string
                    description: The URL with more information about the error.
                required:
                  - message
                description: An internal server error occurred
        default:
          description: The default error model
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: The error message.
                  code:
                    type: string
                    description: The error code.
                  param:
                    type: string
                    description: The parameter that caused the error.
                  url:
                    type: string
                    description: The URL with more information about the error.
                required:
                  - message
                description: The default error model
components:
  securitySchemes:
    BasicAuth:
      type: http
      scheme: basic
      description: Use the API key as the username and leave the password empty.
````