# Update a gift inventory

Section: Your data › Gift planner

```
PATCH https://ba.joexyz.online/api/v1/me/gift-inventories/:id
```

Updates a gift inventory and returns it. Fields you leave out keep their current values.

**Parameters**

- `id` (path): The gift inventory id.

## Authentication

Bearer Token — `Authorization: Bearer <token>` (inherited from folder "Your data")

## Path parameters

| Name | Value |
| --- | --- |
| `id` |  |

## Headers

| Name | Value |
| --- | --- |
| `Content-Type` | `application/json` |

## Body

Content type: `application/json`

```json
{
  "giftBoxes": 341
}
```

## Example responses

### 200 OK

```json
{
  "data": {
    "id": "k571k0c4p3bmntpnng4p8kcaan7vss8k",
    "createdAt": "2025-11-20T19:16:23.521Z",
    "name": "EU",
    "giftBoxes": 341,
    "gifts": [
      {
        "id": 5000,
        "count": 1
      },
      {
        "id": 5001,
        "count": 3
      },
      {
        "id": 5002,
        "count": 2
      },
      {
        "id": 5004,
        "count": 7
      },
      {
        "id": 5005,
        "count": 36
      },
      {
        "id": 5006,
        "count": 30
      }
    ],
    "targets": [
      {
        "id": "k972n7c56aqv7mp1n09hnkam118622jj",
        "createdAt": "2026-05-04T20:28:31.806Z",
        "studentId": "kei",
        "currentExp": 0,
        "giftBoxCount": 309,
        "giftInventoryId": "k571k0c4p3bmntpnng4p8kcaan7vss8k",
        "gifts": [
          {
            "id": 5004,
            "count": 7,
            "enabled": true
          },
          {
            "id": 5005,
            "count": 36,
            "enabled": true
          },
          {
            "id": 5006,
            "count": 30,
            "enabled": true
          },
          {
            "id": 5016,
            "count": 55,
            "enabled": true
          },
          {
            "id": 5997,
            "count": 20,
            "enabled": true
          }
        ],
        "targetExp": 29175,
        "useGiftBoxes": true
      },
      {
        "id": "k9712fh2r075c1k2d0kjjbn9nh885wjf",
        "createdAt": "2026-06-06T16:06:04.181Z",
        "studentId": "aris_battle",
        "currentExp": 0,
        "giftBoxCount": 32,
        "giftInventoryId": "k571k0c4p3bmntpnng4p8kcaan7vss8k",
        "gifts": [
          {
            "id": 5010,
            "count": 33,
            "enabled": true
          },
          {
            "id": 5011,
            "count": 24,
            "enabled": true
          },
          {
            "id": 5018,
            "count": 34,
            "enabled": true
          },
          {
            "id": 5020,
            "count": 33,
            "enabled": true
          },
          {
            "id": 5022,
            "count": 14,
            "enabled": true
          },
          {
            "id": 5025,
            "count": 20,
            "enabled": true
          }
        ],
        "targetExp": 29175,
        "useGiftBoxes": true
      }
    ]
  }
}
```

## Examples

### cURL

```bash
curl -X PATCH https://ba.joexyz.online/api/v1/me/gift-inventories/:id \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {{api_key}}' \
  --data-raw '{
  "giftBoxes": 341
}'
```

### JavaScript

```javascript
const response = await fetch("https://ba.joexyz.online/api/v1/me/gift-inventories/:id", {
  method: "PATCH",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer {{api_key}}",
  },
  body: JSON.stringify({
    "giftBoxes": 341
  }),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

url = "https://ba.joexyz.online/api/v1/me/gift-inventories/:id"
headers = {
    "Authorization": "Bearer {{api_key}}",
}
payload = {
    "giftBoxes": 341,
}

response = requests.patch(url, headers=headers, json=payload)
print(response.json())
```

### Go

```go
package main

import (
	"fmt"
	"io"
	"net/http"
	"strings"
)

func main() {
	body := strings.NewReader(`{
  "giftBoxes": 341
}`)

	req, err := http.NewRequest("PATCH", "https://ba.joexyz.online/api/v1/me/gift-inventories/:id", body)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("Authorization", "Bearer {{api_key}}")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()

	data, _ := io.ReadAll(res.Body)
	fmt.Println(string(data))
}
```
