# updateSubscription

```graphql
mutation UpdateSubscription($input: UpdateSubscriptionInput!) {
  updateSubscription(input: $input) {
    status
    amount
    currency
    checkoutUrl
  }
}
```

Change the plan, billing cycle, seats or add-ons of an account; returns what changed, or a checkout URL when the change needs payment. Requires account.billing.manage.

## Arguments

| Name                    | Type                     | Required | Description                                 |
| ----------------------- | ------------------------ | -------- | ------------------------------------------- |
| `input`                 | UpdateSubscriptionInput! | Yes      |                                             |
| `input.type`            | SubscriptionType!        | Yes      | One of `free`, `pro`, `enterprise`.         |
| `input.cycle`           | SubscriptionCycle!       | Yes      | One of `monthly`, `yearly`.                 |
| `input.quantity`        | Int                      |          | Seat quantity for licensed subscriptions    |
| `input.serverQuantity`  | Int                      |          | Recurring server add-on quantity            |
| `input.sandboxQuantity` | Int                      |          | Recurring sandbox add-on quantity           |
| `input.successUrl`      | String                   |          | URL to redirect to after successful payment |
| `input.cancelUrl`       | String                   |          | URL to redirect to if payment is canceled.  |

## Variables

```json
{
  "input": {
    "type": "free",
    "cycle": "monthly"
  }
}
```

## Responses

| Status | Description                                         |
| ------ | --------------------------------------------------- |
| 200    | The SubscriptionChange! in data.updateSubscription. |

## Call it

```bash
curl -X POST "https://api.veryfront.com/graphql" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "mutation UpdateSubscription($input: UpdateSubscriptionInput!) {\n  updateSubscription(input: $input) {\n    status\n    amount\n    currency\n    checkoutUrl\n  }\n}",
  "variables": {
    "input": {
      "type": "free",
      "cycle": "monthly"
    }
  }
}'
```

## Example response

```json
{
  "data": {
    "updateSubscription": {
      "status": "string",
      "amount": "string",
      "currency": "string",
      "checkoutUrl": "https://example.com"
    }
  }
}
```
