# Update plan

Source: https://docs.orbytelabs.com/api-reference/plans/updatePlan

## PATCH /v1/plans/{key}

```json
{
  "operationId": "updatePlan",
  "tags": [
    "Plans"
  ],
  "summary": "Update plan",
  "description": "Updates the plan for new subscriptions. Existing subscriptions keep their current terms.",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "schema": {
        "type": "string",
        "minLength": 1,
        "maxLength": 80,
        "pattern": "^[a-z0-9][a-z0-9_-]*$"
      },
      "required": true,
      "name": "key",
      "in": "path"
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 120
            },
            "amountCents": {
              "type": "integer",
              "minimum": 0,
              "maximum": 99999999
            },
            "currency": {
              "type": "string",
              "pattern": "^[a-z]{3}$"
            },
            "interval": {
              "type": "string",
              "enum": [
                "month",
                "year"
              ]
            },
            "featureLimits": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "featureKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80,
                    "pattern": "^[a-z0-9][a-z0-9_-]*$"
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "period": {
                    "type": "string",
                    "enum": [
                      "month",
                      "billing"
                    ],
                    "default": "month"
                  },
                  "overage": {
                    "type": "string",
                    "enum": [
                      "block",
                      "credits"
                    ],
                    "default": "block"
                  }
                },
                "required": [
                  "featureKey",
                  "limit"
                ],
                "additionalProperties": false
              },
              "maxItems": 100
            },
            "creditGrants": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "creditKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80,
                    "pattern": "^[a-z0-9][a-z0-9_-]*$"
                  },
                  "amountNanocredits": {
                    "type": "string",
                    "maxLength": 19,
                    "pattern": "^(0|[1-9][0-9]*)$"
                  }
                },
                "required": [
                  "creditKey",
                  "amountNanocredits"
                ],
                "additionalProperties": false
              },
              "maxItems": 100
            },
            "featureMultipliers": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "featureKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80,
                    "pattern": "^[a-z0-9][a-z0-9_-]*$"
                  },
                  "basisPoints": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000000
                  }
                },
                "required": [
                  "featureKey",
                  "basisPoints"
                ],
                "additionalProperties": false
              },
              "maxItems": 100
            },
            "topupsEnabled": {
              "type": "boolean"
            },
            "active": {
              "type": "boolean"
            },
            "expectedRevision": {
              "type": "integer",
              "exclusiveMinimum": 0
            }
          },
          "additionalProperties": false
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Plan updated; existing subscriptions keep their terms",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "key": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80,
                "pattern": "^[a-z0-9][a-z0-9_-]*$"
              },
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "amountCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 99999999
              },
              "currency": {
                "type": "string",
                "pattern": "^[a-z]{3}$"
              },
              "interval": {
                "type": "string",
                "enum": [
                  "month",
                  "year"
                ]
              },
              "featureLimits": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "featureKey": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80,
                      "pattern": "^[a-z0-9][a-z0-9_-]*$"
                    },
                    "limit": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "period": {
                      "type": "string",
                      "enum": [
                        "month",
                        "billing"
                      ],
                      "default": "month"
                    },
                    "overage": {
                      "type": "string",
                      "enum": [
                        "block",
                        "credits"
                      ],
                      "default": "block"
                    }
                  },
                  "required": [
                    "featureKey",
                    "limit"
                  ],
                  "additionalProperties": false
                },
                "maxItems": 100
              },
              "creditGrants": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "creditKey": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80,
                      "pattern": "^[a-z0-9][a-z0-9_-]*$"
                    },
                    "amountNanocredits": {
                      "type": "string",
                      "maxLength": 19,
                      "pattern": "^(0|[1-9][0-9]*)$"
                    }
                  },
                  "required": [
                    "creditKey",
                    "amountNanocredits"
                  ],
                  "additionalProperties": false
                },
                "maxItems": 100,
                "default": []
              },
              "featureMultipliers": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "featureKey": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80,
                      "pattern": "^[a-z0-9][a-z0-9_-]*$"
                    },
                    "basisPoints": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 1000000
                    }
                  },
                  "required": [
                    "featureKey",
                    "basisPoints"
                  ],
                  "additionalProperties": false
                },
                "maxItems": 100,
                "default": []
              },
              "topupsEnabled": {
                "type": "boolean",
                "default": true
              },
              "active": {
                "type": "boolean",
                "default": true
              },
              "id": {
                "type": "string"
              },
              "revision": {
                "type": "number"
              },
              "createdAt": {
                "type": "number"
              },
              "stripeProductId": {
                "type": "string"
              },
              "stripePriceId": {
                "type": "string"
              },
              "syncStatus": {
                "type": "string",
                "enum": [
                  "pending",
                  "synced",
                  "error"
                ]
              },
              "syncError": {
                "type": "string"
              }
            },
            "required": [
              "key",
              "name",
              "amountCents",
              "currency",
              "interval",
              "featureLimits",
              "id",
              "revision",
              "createdAt",
              "syncStatus"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "400": {
      "description": "Invalid request",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "error",
              "message"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "401": {
      "description": "Missing, expired, or revoked API key",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "error",
              "message"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "403": {
      "description": "Insufficient permission or unsupported key kind",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "error",
              "message"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "404": {
      "description": "Resource not found",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "error",
              "message"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "409": {
      "description": "Conflict or insufficient balance",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "error",
              "message"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "413": {
      "description": "Body exceeds 16 KiB",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "error",
              "message"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "415": {
      "description": "Content-Type must be application/json",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "error",
              "message"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "422": {
      "description": "Unsupported pricing or billing configuration",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "error",
              "message"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "429": {
      "description": "Rate limit exceeded; see Retry-After",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "error",
              "message"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "500": {
      "description": "Unexpected server error",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "error",
              "message"
            ],
            "additionalProperties": false
          }
        }
      }
    }
  }
}
```

Complete schema: [OpenAPI 3.1 document](https://docs.orbytelabs.com/openapi.json)