# POST /user/:userID/upgrade

### **Upgrade the subscription plan of your user**

{% hint style="danger" %}
This feature is only available after contacting your account manager
{% endhint %}

Call the Rezi API below with the information required.&#x20;

## Upgrade plan of your user&#x20;

<mark style="color:green;">`POST`</mark> `https://open-api.rezi.ai/v1/plan/upgrade`

This endpoint allows you to upgrade an **already created users**. You will need to provide email of your user

#### Headers

| Name                                             | Type   | Description                                                                                                                                                   |
| ------------------------------------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Content-type<mark style="color:red;">\*</mark>   | string | "application/json"                                                                                                                                            |
| Authentication<mark style="color:red;">\*</mark> | string | <p>"Bearer PRIVATE\_TOKEN\_API\_KEY" <br>Authentication token to secure and track down your usage. Use this specific format with your Private API key<br></p> |

#### Request Body

| Name                                     | Type   | Description                                                                       |
| ---------------------------------------- | ------ | --------------------------------------------------------------------------------- |
| planId<mark style="color:red;">\*</mark> | string | ID of target plan to upgrade. Those plan ID is provided by your account manager   |
| email<mark style="color:red;">\*</mark>  | string | Email of the user your want to upgrade.                                           |
| aiTokenId                                | string | ID of AI credits join to the upgrade. This ID is provided by your account manager |

{% tabs %}
{% tab title="200 User successfully updated." %}

```
{
    "status": "success",
    "data": {
        "created": 1646034967,
        "current_period_start": 1646296033,
        "current_period_end": 1648974433,
        "status": "active",
        "plan_id": "planId_from_api"
    }
}
```

{% endtab %}

{% tab title="401: Unauthorized Error coming from Stripe, please contact your account manager" %}

```javascript
{
    "status": "error",
    "errorCode": "plan-upgrade-1",
    "errorMessage": "stripe error"
}
```

{% endtab %}

{% tab title="401: Unauthorized You used a wrong plan ID" %}

```javascript
{
    "status": "error",
    "errorCode": "plan-upgrade-2",
    "errorMessage": "wrong plan ID"
}
```

{% endtab %}

{% tab title="500: Internal Server Error " %}

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="401: Unauthorized Token is not authorized" %}

```javascript
{
    "status": "error",
    "errorCode": "plan-upgrade-3",
    "errorMessage": "unauthorized token"
}
```

{% endtab %}

{% tab title="401: Unauthorized Token type error" %}

```javascript
{
    "status": "error",
    "errorCode": "plan-upgrade-4",
    "errorMessage": "token type error"
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://rezi-1.gitbook.io/rms-guide/rezi-api/plans/upgrade.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
