Skip to content
Rigel docs
Open Rigel

Add a contractor the household uses

maintenance.contractor.add

POST/api/v1/households/{household_id}/commands/maintenance.contractor.add

  • Command
  • Rigel runs it
  • Applies offline

Records a business: a plumber, an HVAC company, a landscaper. Only the name is needed. Contractors belong to the household, not to one property. is_preferred defaults to false. An email address is also linked to that address in Email, so their mail shows on their page.

Parameters#

Add a contractor the household uses: 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.

Add a contractor the household uses: request body fields
FieldDescription
namestringrequired

A name as the household says it, 1–120 characters.

at most 120 characters
tradestringoptional

What they do, in words: HVAC, plumbing, landscaping.

at most 500 characters
phonestringoptional

A phone number as written.

at most 500 characters
emailstringoptional

An email address.

at most 500 characters
websitestring (uri)optional

A web address.

at most 2,000 characters
addressstringoptional

Their office address.

at most 500 characters
service_areastringoptional

Where they work: a town, a county, a radius.

at most 500 characters
notesstringoptional

Anything worth remembering about them.

at most 20,000 characters
is_preferredbooleanoptional

Whether this is the household's go-to for its trade. Defaults to false.

Response#

200 The command was applied.

Add a contractor the household uses: response fields
FieldDescription
resultobjectrequired

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

result.contractor_idstringrequired

The new contractor.

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.

Add a contractor the household uses: errors
StatusCodeWhen
400validation_failedA field is missing, misspelled or out of range. details.fields lists each problem.
401unauthenticatedThe request has no valid session.
404not_foundThe household doesn't exist, or you aren't a member of it.
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.

Only a name

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

{
  "name": "Smith HVAC"
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0DBEMN0PKTHSPG60A

{
  "result": {
    "contractor_id": "ctr_01JC4N0000MBGE5RJ6Q7V6V6T8"
  },
  "version": 1
}

Everything, preferred

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.contractor.add' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "name": "Jo'\''s Plumbing",
  "trade": "Plumbing",
  "phone": "555-0100",
  "email": "jo@example.com",
  "website": "https://jo.example.com",
  "address": "1 Main St",
  "service_area": "Marin County",
  "notes": "Ask for Jo",
  "is_preferred": true
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.contractor.add", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    name: "Jo's Plumbing",
    trade: "Plumbing",
    phone: "555-0100",
    email: "jo@example.com",
    website: "https://jo.example.com",
    address: "1 Main St",
    service_area: "Marin County",
    notes: "Ask for Jo",
    is_preferred: true,
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.contractor.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "name": "Jo's Plumbing",
  "trade": "Plumbing",
  "phone": "555-0100",
  "email": "jo@example.com",
  "website": "https://jo.example.com",
  "address": "1 Main St",
  "service_area": "Marin County",
  "notes": "Ask for Jo",
  "is_preferred": true
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0SQMCNGAGYJ1V2VET

{
  "result": {
    "contractor_id": "ctr_01JC4N0000MBGE5RJ6Q7V6V6T8"
  },
  "version": 1
}

Add a contractor

An email address links the contractor to that address in Email, so their mail shows on their page.

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/maintenance.contractor.add' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01M6V9CSWEAR8GHWXJV949B31Q' \
  -d '{
  "name": "Smith Heating & Air",
  "trade": "HVAC",
  "phone": "555-0142",
  "email": "pat@smithhvac.example.com",
  "website": "https://smithhvac.example.com",
  "service_area": "Within 25 miles of town",
  "notes": "Installed the furnace. Tune-up customers get same-week appointments.",
  "is_preferred": true
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/maintenance.contractor.add", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01M6V9CSWEAR8GHWXJV949B31Q",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    name: "Smith Heating & Air",
    trade: "HVAC",
    phone: "555-0142",
    email: "pat@smithhvac.example.com",
    website: "https://smithhvac.example.com",
    service_area: "Within 25 miles of town",
    notes: "Installed the furnace. Tune-up customers get same-week appointments.",
    is_preferred: true,
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/maintenance.contractor.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CSWEAR8GHWXJV949B31Q

{
  "name": "Smith Heating & Air",
  "trade": "HVAC",
  "phone": "555-0142",
  "email": "pat@smithhvac.example.com",
  "website": "https://smithhvac.example.com",
  "service_area": "Within 25 miles of town",
  "notes": "Installed the furnace. Tune-up customers get same-week appointments.",
  "is_preferred": true
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CSWEGNV0CC02RXP5TC4M

{
  "result": {
    "contractor_id": "ctr_01M6V9CSWEFJH8CRZCXNAH8109"
  },
  "version": 191
}

Add another contractor

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/maintenance.contractor.add' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01M6V9CSWH7EXFXDWYT9MP829M' \
  -d '{
  "name": "Riverbend Plumbing & Drain",
  "trade": "Plumbing",
  "phone": "555-0178",
  "email": "office@riverbendplumbing.example.com",
  "notes": "Charges a flat trip fee."
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/maintenance.contractor.add", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01M6V9CSWH7EXFXDWYT9MP829M",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    name: "Riverbend Plumbing & Drain",
    trade: "Plumbing",
    phone: "555-0178",
    email: "office@riverbendplumbing.example.com",
    notes: "Charges a flat trip fee.",
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/maintenance.contractor.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CSWH7EXFXDWYT9MP829M

{
  "name": "Riverbend Plumbing & Drain",
  "trade": "Plumbing",
  "phone": "555-0178",
  "email": "office@riverbendplumbing.example.com",
  "notes": "Charges a flat trip fee."
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CSWHH5HWK3QGA7346FM3

{
  "result": {
    "contractor_id": "ctr_01M6V9CSWHPNYAY4A5FBX3R14F"
  },
  "version": 193
}

For Rigel#

Rigel's tool for this command is maintenance_contractor_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