# Upgrade quote or request

`POST /v1/service/@id/upgrade` · scope `services:write`

Calculate the upgrade price; send `send=true` to submit the upgrade request.

Format of the `resources` parameter:

```json
{
  "resource_id": "qty_value",
  "resource_id": "item_id",
  "resource_id": { "item_id": "qty_value" }
}
```

- `"qty_value"`: sliders and quantity fields
- `"item_id"`: select lists and radio buttons
- `{ "item_id": "qty_value" }`: select lists with a quantity field

## HTTP request

| Item | Value |
| --- | --- |
| URL | `https://api.tino.vn/v1/service/@id/upgrade` |
| Method | `POST` |
| Scope | `services:write` |
| Header | `Authorization: Bearer <token>` |
| Content-Type | `application/json` |
| Tokens that can call it | app tokens (`tinoat_`), personal API tokens (`tinopat_`) |

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Service ID |
| `resources` | body | array | no | array with resource values |
| `package` | body | integer | no | New package id, optonal when upgrading resources |
| `cycle` | body | string | no | New billing cycle, optonal when upgrading resources |
| `send` | body | boolean | no | Set to true when you want to send your upgrade request |

## Example request

```bash
curl -X POST "https://api.tino.vn/v1/service/100001/upgrade" \
  -H "Authorization: Bearer $TINO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "resources": "<resources>",
  "package": "<package>",
  "cycle": "<cycle>",
  "send": "<send>"
}'
```

`$TINO_TOKEN` is a token with the scope `services:write`. Path parameters in the example are sample values.

SDK ([SDK & examples](/en/docs/sdk)): Python `client.services.request_upgrade(id, id=...)`, Node.js `await client.services.requestUpgrade(id, { id: ... });`, PHP `$client->services->requestUpgrade($id, ['id' => ...]);`.

## Example response

```json
{
 "total": {
  "subtotal": 0,
  "total": 0,
  "credit": 0,
  "items": [
   {
    "amount": 0,
    "taxed": 1,
    "tax_group_id": 3,
    "type": "Other",
    "qty": 1,
    "tax_rate": null,
    "level": {
     "L1": {
      "priority": 1,
      "type": "L1",
      "name": "VAT",
      "rate": "8.00",
      "tax_group_id": 3,
      "applyto": "net",
      "negative": true,
      "condition": null,
      "id": "4",
      "country": "0",
      "state": "0",
      "source": "region",
      "taxtotal": 8,
      "tax": 0
     }
    },
    "linetotal": 0,
    "discount": 0,
    "net_discount": 0,
    "off": 0,
    "net_off": 0,
    "net": 0,
    "gross": 0,
    "tax": 0
   }
  ],
  "recurring": {
   "m_taxed": "85320"
  },
  "taxes": {
  … 52 more line(s)
```

Live sample from a test account with personal data masked; long arrays and strings are trimmed (`… N more item(s)`, `… N more line(s)`).
