# Preview a plan change

`POST /api/v1/subscriptions/{id}/change-plan/preview`

The same computation as change-plan with every write skipped.

Needs the `subscriptions:write` scope, or a full-access key.

## Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | required |  |

## Headers

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `Idempotency-Key` | string | optional | A unique value for this operation, chosen by you. A retry with the same key and the same body returns the first response instead of running again. The same key with a different body answers 409 `idempotency_key_reused`; a key whose first request is still running answers 409 `idempotency_in_progress`. |

## Request body

JSON Schema:

```json
{
  "type": "object",
  "properties": {
    "plan_id": {
      "type": "string",
      "format": "uuid",
      "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "description": "Exactly one of `plan_id` / `plan_code`."
    },
    "plan_code": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200,
      "description": "A plan code; its latest active version is used.",
      "example": "gos_growth_annual"
    },
    "quantity": {
      "anyOf": [
        {
          "type": "integer",
          "exclusiveMinimum": 0
        },
        {
          "type": "string",
          "pattern": "^[1-9]\\d*$"
        }
      ]
    },
    "proration": {
      "type": "string",
      "enum": [
        "create",
        "none"
      ],
      "description": "`create` (default) bills the difference now; `none` switches and waits for the period."
    },
    "when": {
      "type": "string",
      "enum": [
        "now",
        "period_end"
      ],
      "description": "`now` (default) switches immediately; `period_end` stages the change for the renewal."
    }
  }
}
```

## Responses

### 200

The proration that WOULD be applied. Nothing was written.

JSON Schema:

```json
{
  "type": "object",
  "properties": {
    "data": {
      "allOf": [
        {
          "type": "object",
          "properties": {
            "subscription_id": {
              "type": "string",
              "format": "uuid",
              "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
            },
            "plan_id": {
              "type": "string",
              "format": "uuid",
              "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
            },
            "quantity": {
              "type": "integer"
            },
            "currency": {
              "type": "string",
              "enum": [
                "USD",
                "AUD",
                "CAD",
                "GBP",
                "EUR",
                "INR",
                "NPR"
              ],
              "example": "USD"
            },
            "net_cents": {
              "type": "string",
              "description": "Signed proration total in minor units as a decimal string. Positive = the customer owes.",
              "example": "3000"
            },
            "lines": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "description": {
                    "type": "string"
                  },
                  "line_type": {
                    "type": "string",
                    "enum": [
                      "proration_credit",
                      "proration_charge"
                    ]
                  },
                  "quantity": {
                    "type": "string"
                  },
                  "unit_amount_cents": {
                    "type": "string"
                  },
                  "amount_cents": {
                    "type": "string",
                    "description": "Signed minor units as a decimal string; credits are negative.",
                    "example": "-1500"
                  },
                  "currency": {
                    "type": "string",
                    "enum": [
                      "USD",
                      "AUD",
                      "CAD",
                      "GBP",
                      "EUR",
                      "INR",
                      "NPR"
                    ],
                    "example": "USD"
                  }
                },
                "required": [
                  "description",
                  "line_type",
                  "quantity",
                  "unit_amount_cents",
                  "amount_cents",
                  "currency"
                ]
              }
            },
            "invoice_id": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid",
              "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
            },
            "invoice_status": {
              "type": [
                "string",
                "null"
              ],
              "enum": [
                "draft",
                "finalized",
                "paid",
                null
              ]
            }
          },
          "required": [
            "subscription_id",
            "plan_id",
            "quantity",
            "currency",
            "net_cents",
            "lines",
            "invoice_id",
            "invoice_status"
          ]
        },
        {
          "type": "object",
          "properties": {
            "scheduled": {
              "type": "boolean"
            },
            "effective_at": {
              "type": [
                "string",
                "null"
              ],
              "format": "date-time"
            }
          },
          "required": [
            "scheduled",
            "effective_at"
          ]
        }
      ]
    },
    "_agent": {
      "type": "object",
      "properties": {
        "summary": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "ok"
          ]
        },
        "next_actions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "summary",
        "status",
        "next_actions",
        "warnings"
      ]
    },
    "api_version": {
      "type": "string",
      "example": "2026-07-01"
    }
  },
  "required": [
    "data",
    "_agent",
    "api_version"
  ]
}
```

### 404

Unknown `plan_code` (or `plan_id`), or unknown `customer_external_id`.

### 422

Validation failed, e.g. both `plan_id` and `plan_code` (give exactly one).
