Record an ongoing service
maintenance.service.add
POST/api/v1/households/{household_id}/commands/maintenance.service.add
- Command
- Rigel runs it
- Applies offline
Records a recurring provider and the agreed terms: a cleaner, a landscaper, pest control. These are the terms, not the payments. Starts active. A price needs a currency (currency_required); ends_on before starts_on fails with invalid_range.
Parameters#
| Field | Description |
|---|---|
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.
| Field | Description |
|---|---|
property_idstringoptional | Which property. Leave it out when the household has one property (it's made on first use); with several, give it, or the command is rejected with property_required. |
contractor_idstringoptional | Who provides it. |
namestringrequired | What the service is called: Lawn care, Pest control. |
scopestringoptional | What they do each time. |
cadencestringoptional | How often, in words: every other week, April to October. |
priceintegeroptional | What it costs per period, in minor units. Needs a currency. |
currencystringoptional | An ISO 4217 currency code, such as USD. |
price_perstringoptional | What the price is for: visit, month, season. |
starts_onstring (date)optional | A calendar date, YYYY-MM-DD. |
ends_onstring (date)optional | A calendar date, YYYY-MM-DD. |
renews_onstring (date)optional | When the agreement renews, YYYY-MM-DD. |
notesstringoptional | Anything else worth keeping, such as the contract terms. |
Response#
200 The command was applied.
| Field | Description |
|---|---|
resultobjectrequired | What the command returned, such as the IDs it created. |
result.service_idstringrequired | The new service. |
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.
| Status | Code | When |
|---|---|---|
400 | validation_failed | A field is missing, misspelled or out of range. details.fields lists each problem. |
401 | unauthenticated | The request has no valid session. |
404 | contractor_not_found | A contractor that isn't there. |
404 | not_found | The household doesn't exist, or you aren't a member of it. |
409 | currency_required | A price needs a currency. |
409 | invalid_range | Ending before it starts. |
409 | property_required | Several properties need one named. |
409 | idempotency_key_reused | The 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.
Active, with the agreed terms
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.service.add' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"contractor_id": "ctr_01JC00000000000000000000K1",
"name": "Lawn care",
"scope": "Mow and edge",
"cadence": "every other week, April to October",
"price": 6000,
"currency": "USD",
"price_per": "visit",
"starts_on": "2025-04-01",
"renews_on": "2026-04-01",
"notes": "Cash"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.service.add", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
contractor_id: "ctr_01JC00000000000000000000K1",
name: "Lawn care",
scope: "Mow and edge",
cadence: "every other week, April to October",
price: 6000,
currency: "USD",
price_per: "visit",
starts_on: "2025-04-01",
renews_on: "2026-04-01",
notes: "Cash",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.service.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"contractor_id": "ctr_01JC00000000000000000000K1",
"name": "Lawn care",
"scope": "Mow and edge",
"cadence": "every other week, April to October",
"price": 6000,
"currency": "USD",
"price_per": "visit",
"starts_on": "2025-04-01",
"renews_on": "2026-04-01",
"notes": "Cash"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0CP162BJTGX8CJR0R
{
"result": {
"service_id": "osv_01JC4N0000MBGE5RJ6Q7V6V6T8"
},
"version": 1
}Only a name makes the property on first use
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.service.add' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"name": "Pest control"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.service.add", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
name: "Pest control",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.service.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"name": "Pest control"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0BXMTVRFZC1BPFMHN
{
"result": {
"service_id": "osv_01JC4N0000JVP6PWJ6S8P7WZ6B"
},
"version": 1
}A price needs a currency
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.service.add' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"property_id": "prp_01JC00000000000000000000P1",
"name": "x",
"price": 100
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.service.add", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
property_id: "prp_01JC00000000000000000000P1",
name: "x",
price: 100,
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.service.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"property_id": "prp_01JC00000000000000000000P1",
"name": "x",
"price": 100
}HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01K9D9S2R09B5TVD6RY0VS0DC6
{
"error": {
"code": "currency_required",
"message": "A price needs a currency. No changes were applied.",
"details": {},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R09B5TVD6RY0VS0DC6"
}
}Ending before it starts
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.service.add' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"property_id": "prp_01JC00000000000000000000P1",
"name": "x",
"starts_on": "2025-05-01",
"ends_on": "2025-04-01"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.service.add", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
property_id: "prp_01JC00000000000000000000P1",
name: "x",
starts_on: "2025-05-01",
ends_on: "2025-04-01",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.service.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"property_id": "prp_01JC00000000000000000000P1",
"name": "x",
"starts_on": "2025-05-01",
"ends_on": "2025-04-01"
}HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0K68YV0H33XRPJMA8
{
"error": {
"code": "invalid_range",
"message": "The service can't end before it starts. No changes were applied.",
"details": {},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R0K68YV0H33XRPJMA8"
}
}A contractor that isn't there
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.service.add' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"property_id": "prp_01JC00000000000000000000P1",
"name": "x",
"contractor_id": "ctr_01JC00000000000000000000K1"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.service.add", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
property_id: "prp_01JC00000000000000000000P1",
name: "x",
contractor_id: "ctr_01JC00000000000000000000K1",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.service.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"property_id": "prp_01JC00000000000000000000P1",
"name": "x",
"contractor_id": "ctr_01JC00000000000000000000K1"
}HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0TCQ1KXV6QTM9TCZ8
{
"error": {
"code": "contractor_not_found",
"message": "That contractor isn't there any more. No changes were applied.",
"details": {
"contractor_id": "ctr_01JC00000000000000000000K1"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R0TCQ1KXV6QTM9TCZ8"
}
}Several properties need one named
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.service.add' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"name": "x"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.service.add", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
name: "x",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.service.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"name": "x"
}HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0R74D04CJCRA0MSVD
{
"error": {
"code": "property_required",
"message": "This household has more than one property. Say which one. No changes were applied.",
"details": {},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R0R74D04CJCRA0MSVD"
}
}Record an ongoing service
The terms, not the payments.
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/maintenance.service.add' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01M6V9CSZM6NF2YZXQMJ0Q0QAK' \
-d '{
"contractor_id": "ctr_01M6V9CSWEFJH8CRZCXNAH8109",
"name": "Furnace and AC service plan",
"scope": "One tune-up for the furnace and one for the AC each year, with priority scheduling.",
"cadence": "Once a year",
"price": 18900,
"currency": "USD",
"price_per": "year",
"starts_on": "2026-09-08",
"renews_on": "2027-09-08"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/maintenance.service.add", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01M6V9CSZM6NF2YZXQMJ0Q0QAK",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
contractor_id: "ctr_01M6V9CSWEFJH8CRZCXNAH8109",
name: "Furnace and AC service plan",
scope: "One tune-up for the furnace and one for the AC each year, with priority scheduling.",
cadence: "Once a year",
price: 18900,
currency: "USD",
price_per: "year",
starts_on: "2026-09-08",
renews_on: "2027-09-08",
}),
});
const data = await response.json();POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/maintenance.service.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CSZM6NF2YZXQMJ0Q0QAK
{
"contractor_id": "ctr_01M6V9CSWEFJH8CRZCXNAH8109",
"name": "Furnace and AC service plan",
"scope": "One tune-up for the furnace and one for the AC each year, with priority scheduling.",
"cadence": "Once a year",
"price": 18900,
"currency": "USD",
"price_per": "year",
"starts_on": "2026-09-08",
"renews_on": "2027-09-08"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CSZMXJH446BZMHTFB3MQ
{
"result": {
"service_id": "osv_01M6V9CSZMV4CA4S1QG2QF9796"
},
"version": 225
}For Rigel#
Rigel's tool for this command is maintenance_service_add. Rigel runs this on its own, then says what it did. The agent guide has the rest.