Skip to content
Rigel docs
Open Rigel

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#

Record an ongoing service: 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.

Record an ongoing service: request body fields
FieldDescription
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.

at most 120 characters
scopestringoptional

What they do each time.

at most 20,000 characters
cadencestringoptional

How often, in words: every other week, April to October.

at most 500 characters
priceintegeroptional

What it costs per period, in minor units. Needs a currency.

-1,000,000,000 to 1,000,000,000
currencystringoptional

An ISO 4217 currency code, such as USD.

pattern ^[A-Z]{3}$
price_perstringoptional

What the price is for: visit, month, season.

at most 500 characters
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.

at most 20,000 characters

Response#

200 The command was applied.

Record an ongoing service: response fields
FieldDescription
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.

Record an ongoing service: errors
StatusCodeWhen
400validation_failedA field is missing, misspelled or out of range. details.fields lists each problem.
401unauthenticatedThe request has no valid session.
404contractor_not_foundA contractor that isn't there.
404not_foundThe household doesn't exist, or you aren't a member of it.
409currency_requiredA price needs a currency.
409invalid_rangeEnding before it starts.
409property_requiredSeveral properties need one named.
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.

Active, with the agreed terms

Request, curl
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"
}'
Request, TypeScript
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();
Request, HTTP
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"
}
Response, 200
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

Request, curl
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"
}'
Request, TypeScript
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();
Request, HTTP
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"
}
Response, 200
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

Request, curl
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
}'
Request, TypeScript
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();
Request, HTTP
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
}
Response, 409
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

Request, curl
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"
}'
Request, TypeScript
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();
Request, HTTP
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"
}
Response, 409
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

Request, curl
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"
}'
Request, TypeScript
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();
Request, HTTP
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"
}
Response, 404
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

Request, curl
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"
}'
Request, TypeScript
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();
Request, HTTP
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"
}
Response, 409
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.

Request, curl
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"
}'
Request, TypeScript
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();
Request, HTTP
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"
}
Response, 200
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.

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