Skip to content
Rigel docs
Open Rigel

Use some of an item, or add some

inventory.item.adjust

POST/api/v1/households/{household_id}/commands/inventory.item.adjust

  • Command
  • Rigel runs it
  • Applies offline

Changes the amount by a delta (negative when some was used), or sets a level ("about half", "low"). When the quantity reaches zero or below the item is removed and removed is true. A delta on an item that has no quantity (only a level, or just "some") fails with no_quantity; use inventory.item.set_amount or a level instead. A level replaces any quantity. Counts as seen now, or at confirmed_at, and never moves the item's confirmation backwards. Errors: item_not_found, no_quantity.

Parameters#

Use some of an item, or add some: parameters
FieldDescription
household_idpathstringrequired

The household's ID.

Idempotency-Keyheaderstringoptional

The command's ID. Reuse it when retrying the same command.

Request body#

JSON, as application/json.

Use some of an item, or add some: request body fields
FieldDescription
item_idstringrequired

The item to change.

deltanumberoptional

How much to add to the quantity, in its own unit; negative to use some (-1, or -0.5 for half a pound). Not 0, at most 1,000,000 either way. Give this or level.

-1,000,000 to 1,000,000
levelone of: full, most, half, lowoptional

Set a rough level instead, which clears any number. Give this or delta.

confirmed_atstring (date-time)optional

When this was known to be true, if not now: for a photo, when it was taken. A time after the command is treated as now, and an item's confirmation never moves backwards.

Response#

200 The command was applied.

Use some of an item, or add some: response fields
FieldDescription
resultobjectrequired

What the command returned, such as the IDs it created.

result.removedbooleanrequired

True when nothing was left and the item was deleted.

versionintegerrequired

The household version after the command.

Errors#

Every error has the same envelope: error.code, error.message, error.details, error.recovery and error.request_id.

Use some of an item, or add some: errors
StatusCodeWhen
400validation_failedA field is missing, misspelled or out of range. details.fields lists each problem.
401unauthenticatedThe request has no valid session.
404item_not_found
  • The item doesn't exist in this household.
  • An unknown item.
404not_foundThe household doesn't exist, or you aren't a member of it.
409no_quantity
  • A delta on an item with only a level.
  • A delta on an item we only have some of.
409idempotency_key_reusedThe Idempotency-Key was already used for a different command.

Examples#

These are real. Each scenario is one of the command's test cases, run on a household when this site was built, and the response is what the API returned.

Using one leaves the rest and confirms the item

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "item_id": "inv_01JC000000000000000000000A",
  "delta": -1
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    item_id: "inv_01JC000000000000000000000A",
    delta: -1,
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "item_id": "inv_01JC000000000000000000000A",
  "delta": -1
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R00P9PSVKD5NKQNC51

{
  "result": {
    "removed": false
  },
  "version": 1
}

Adding some

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "item_id": "inv_01JC000000000000000000000A",
  "delta": 3
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    item_id: "inv_01JC000000000000000000000A",
    delta: 3,
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "item_id": "inv_01JC000000000000000000000A",
  "delta": 3
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0KCPG5YMVFKZKKG37

{
  "result": {
    "removed": false
  },
  "version": 1
}

A fraction of a pound

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "item_id": "inv_01JC000000000000000000000A",
  "delta": -0.5
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    item_id: "inv_01JC000000000000000000000A",
    delta: -0.5,
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "item_id": "inv_01JC000000000000000000000A",
  "delta": -0.5
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R060DEGF4P4TNKP21W

{
  "result": {
    "removed": false
  },
  "version": 1
}

Rounds to six decimals

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "item_id": "inv_01JC000000000000000000000A",
  "delta": 0.2
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    item_id: "inv_01JC000000000000000000000A",
    delta: 0.2,
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "item_id": "inv_01JC000000000000000000000A",
  "delta": 0.2
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R00R9GHR0R0AESWJX0

{
  "result": {
    "removed": false
  },
  "version": 1
}

A remainder under a millionth rounds to zero and the item is gone

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "item_id": "inv_01JC000000000000000000000A",
  "delta": -0.9999999
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    item_id: "inv_01JC000000000000000000000A",
    delta: -0.9999999,
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "item_id": "inv_01JC000000000000000000000A",
  "delta": -0.9999999
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0EF13GBPWDK00K2YE

{
  "result": {
    "removed": true
  },
  "version": 1
}

Using exactly what is left removes the item

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "item_id": "inv_01JC000000000000000000000A",
  "delta": -1
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    item_id: "inv_01JC000000000000000000000A",
    delta: -1,
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "item_id": "inv_01JC000000000000000000000A",
  "delta": -1
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R052AXW58DSKBMVTFM

{
  "result": {
    "removed": true
  },
  "version": 1
}

Using more than is left removes the item

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "item_id": "inv_01JC000000000000000000000A",
  "delta": -5
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    item_id: "inv_01JC000000000000000000000A",
    delta: -5,
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "item_id": "inv_01JC000000000000000000000A",
  "delta": -5
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R099HB9HAKF3VFZY41

{
  "result": {
    "removed": true
  },
  "version": 1
}

A level replaces the quantity and its unit

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "item_id": "inv_01JC000000000000000000000A",
  "level": "low"
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    item_id: "inv_01JC000000000000000000000A",
    level: "low",
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "item_id": "inv_01JC000000000000000000000A",
  "level": "low"
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0SPDP0W9FA4RPMTEC

{
  "result": {
    "removed": false
  },
  "version": 1
}

A level replaces a level

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "item_id": "inv_01JC000000000000000000000A",
  "level": "half"
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    item_id: "inv_01JC000000000000000000000A",
    level: "half",
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "item_id": "inv_01JC000000000000000000000A",
  "level": "half"
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0TQ4EKMGAJMMNSJC5

{
  "result": {
    "removed": false
  },
  "version": 1
}

Confirmed_at earlier than the item's own does not move it back

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "item_id": "inv_01JC000000000000000000000A",
  "delta": -1,
  "confirmed_at": "2025-11-01T12:26:40.000Z"
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    item_id: "inv_01JC000000000000000000000A",
    delta: -1,
    confirmed_at: "2025-11-01T12:26:40.000Z",
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "item_id": "inv_01JC000000000000000000000A",
  "delta": -1,
  "confirmed_at": "2025-11-01T12:26:40.000Z"
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0XGMVQZSF994Z9ZTE

{
  "result": {
    "removed": false
  },
  "version": 1
}

Confirmed_at later than the item's own moves it forward

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "item_id": "inv_01JC000000000000000000000A",
  "delta": -1,
  "confirmed_at": "2025-11-04T23:46:40.000Z"
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    item_id: "inv_01JC000000000000000000000A",
    delta: -1,
    confirmed_at: "2025-11-04T23:46:40.000Z",
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "item_id": "inv_01JC000000000000000000000A",
  "delta": -1,
  "confirmed_at": "2025-11-04T23:46:40.000Z"
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0058YJGPZ0XEPMY6Z

{
  "result": {
    "removed": false
  },
  "version": 1
}

Confirmed_at in the future counts as now

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "item_id": "inv_01JC000000000000000000000A",
  "delta": -1,
  "confirmed_at": "2026-11-06T19:20:00.000Z"
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    item_id: "inv_01JC000000000000000000000A",
    delta: -1,
    confirmed_at: "2026-11-06T19:20:00.000Z",
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "item_id": "inv_01JC000000000000000000000A",
  "delta": -1,
  "confirmed_at": "2026-11-06T19:20:00.000Z"
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R09EP9GX3CTDXD31KA

{
  "result": {
    "removed": false
  },
  "version": 1
}

A delta on an item with only a level

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "item_id": "inv_01JC000000000000000000000A",
  "delta": -1
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    item_id: "inv_01JC000000000000000000000A",
    delta: -1,
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "item_id": "inv_01JC000000000000000000000A",
  "delta": -1
}
Response, 409
HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01K9D9S2R02460NEYT22WJ3AJE

{
  "error": {
    "code": "no_quantity",
    "message": "That item has no number to change. Use inventory.item.set_amount to give it a quantity, or adjust it with a level. No changes were applied.",
    "details": {
      "item_id": "inv_01JC000000000000000000000A"
    },
    "recovery": "Read the current state, then send a command that fits it.",
    "request_id": "req_01K9D9S2R02460NEYT22WJ3AJE"
  }
}

A delta on an item we only have some of

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "item_id": "inv_01JC000000000000000000000A",
  "delta": 1
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    item_id: "inv_01JC000000000000000000000A",
    delta: 1,
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "item_id": "inv_01JC000000000000000000000A",
  "delta": 1
}
Response, 409
HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0BSC7RPY5XHP8FM92

{
  "error": {
    "code": "no_quantity",
    "message": "That item has no number to change. Use inventory.item.set_amount to give it a quantity, or adjust it with a level. No changes were applied.",
    "details": {
      "item_id": "inv_01JC000000000000000000000A"
    },
    "recovery": "Read the current state, then send a command that fits it.",
    "request_id": "req_01K9D9S2R0BSC7RPY5XHP8FM92"
  }
}

An unknown item

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "item_id": "inv_01JC000000000000000000000Z",
  "delta": -1
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    item_id: "inv_01JC000000000000000000000Z",
    delta: -1,
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "item_id": "inv_01JC000000000000000000000Z",
  "delta": -1
}
Response, 404
HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0CB5QR9W0M4AF29NP

{
  "error": {
    "code": "item_not_found",
    "message": "That item isn't in the inventory any more. No changes were applied.",
    "details": {
      "item_id": "inv_01JC000000000000000000000Z"
    },
    "recovery": "Read the current state, then send a command that fits it.",
    "request_id": "req_01K9D9S2R0CB5QR9W0M4AF29NP"
  }
}

Use one of something

A negative delta takes some; a positive one adds.

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/inventory.item.adjust' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01M6V9CSC8V28X1K79ZY1PJD71' \
  -d '{
  "item_id": "inv_01M6V9CSAPM8JH7W1W1YEBHPRS",
  "delta": -1
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/inventory.item.adjust", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01M6V9CSC8V28X1K79ZY1PJD71",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    item_id: "inv_01M6V9CSAPM8JH7W1W1YEBHPRS",
    delta: -1,
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CSC8V28X1K79ZY1PJD71

{
  "item_id": "inv_01M6V9CSAPM8JH7W1W1YEBHPRS",
  "delta": -1
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CSC87E29XDMBQX0TAM36

{
  "result": {
    "removed": false
  },
  "version": 38
}

Use the last of something

When the amount reaches zero the item is removed, and removed is true.

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/inventory.item.adjust' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01M6V9CSCBXPXZASR1QNMHV1S1' \
  -d '{
  "item_id": "inv_01M6V9CSB6S923R566WD7EAGGG",
  "delta": -1
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/inventory.item.adjust", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01M6V9CSCBXPXZASR1QNMHV1S1",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    item_id: "inv_01M6V9CSB6S923R566WD7EAGGG",
    delta: -1,
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CSCBXPXZASR1QNMHV1S1

{
  "item_id": "inv_01M6V9CSB6S923R566WD7EAGGG",
  "delta": -1
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CSCB8JG881MDXCX4WNPP

{
  "result": {
    "removed": true
  },
  "version": 39
}

Say how full something is now

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/inventory.item.adjust' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01M6V9CSCCW4QGCT7H0GA80G74' \
  -d '{
  "item_id": "inv_01M6V9CSB0YB2Y7WBZBMR3G5Z0",
  "level": "low"
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/inventory.item.adjust", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01M6V9CSCCW4QGCT7H0GA80G74",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    item_id: "inv_01M6V9CSB0YB2Y7WBZBMR3G5Z0",
    level: "low",
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CSCCW4QGCT7H0GA80G74

{
  "item_id": "inv_01M6V9CSB0YB2Y7WBZBMR3G5Z0",
  "level": "low"
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CSCCZXMPRV62FZ5DK0S9

{
  "result": {
    "removed": false
  },
  "version": 40
}

Use some of something with no count

An item tracked by level has no number to subtract from. Set a level instead, or give it an amount first.

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/inventory.item.adjust' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01M6V9CSCAQFTGPZHMD059CZET' \
  -d '{
  "item_id": "inv_01M6V9CSATNBB6KZZ14ZN1FE15",
  "delta": -1
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/inventory.item.adjust", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01M6V9CSCAQFTGPZHMD059CZET",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    item_id: "inv_01M6V9CSATNBB6KZZ14ZN1FE15",
    delta: -1,
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CSCAQFTGPZHMD059CZET

{
  "item_id": "inv_01M6V9CSATNBB6KZZ14ZN1FE15",
  "delta": -1
}
Response, 409
HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01M6V9CSCARJ6QD08PRWCJV03H

{
  "error": {
    "code": "no_quantity",
    "message": "That item has no number to change. Use inventory.item.set_amount to give it a quantity, or adjust it with a level. No changes were applied.",
    "details": {
      "item_id": "inv_01M6V9CSATNBB6KZZ14ZN1FE15"
    },
    "recovery": "Read the current state, then send a command that fits it.",
    "request_id": "req_01M6V9CSCARJ6QD08PRWCJV03H"
  }
}

For Rigel#

Rigel's tool for this command is inventory_item_adjust. Rigel runs this on its own, then says what it did. The agent guide has the rest.

Rigel is in early access, and sign-up is by invitation. Open Rigel