Skip to content
Rigel docs
Open Rigel

Make a throwaway test account

test_accounts.post

POST/api/v1/test-accounts

  • Route

Makes a test user with a household of their own, for trying something without touching real data, and returns a token and a session for them. It's deleted, with its household, a day later. Needs a session of a person who isn't a test user; at most 10 live test accounts each.

Request body#

JSON, as application/json.

Make a throwaway test account: request body fields
FieldDescription
namestringoptional

The test user's name. Default "Test person".

1 to 80 characters
sample_databooleanoptional

Add the sample family's records (docs/sample-data.md). Default false.

Response#

201 The test account.

Make a throwaway test account: response fields
FieldDescription
userobjectrequired
user.idstringrequired

The test user's ID, usr_….

user.emailstringrequired

Always <user id>@test.invalid, which can't receive mail or sign in with Google.

user.namestringrequiredNo description.
household_idstringrequired

The test user's own household, where they're the admin.

expires_atstringrequired

When the account and its household are deleted, UTC: a day after it was made.

tokenstringrequired

A read_write personal API token for the household, tok_….<secret>.

sessionstringrequired

A session for a browser: set it as the rigel_session cookie. Your own cookie isn't changed.

sample_recordsintegerrequired

How many sample records were added; 0 without sample_data.

Errors#

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

Make a throwaway test account: errors
StatusCodeWhen
401unauthenticatedThe request has no valid session.
403Read error.codeDescribed above.
409Read error.codeDescribed above.

Examples#

No call has been recorded for this operation yet, so this example is built from its schema. The values are placeholders.

Built from the schema

Not recorded from a real call: the fields are filled in from the schema, so the values are placeholders.

Request, curl
curl -X POST 'https://rigel.house/api/v1/test-accounts' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "Example",
  "sample_data": true
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/test-accounts", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    name: "Example",
    sample_data: true,
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/test-accounts HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json

{
  "name": "Example",
  "sample_data": true
}
Response, 201
HTTP/1.1 201 Created
Content-Type: application/json
X-Request-Id: req_01K9BKNGK0ENW3AHRZ6DMV29GQ

{
  "user": {
    "id": "usr_01K9BKNGK0ENW3AHRZ6DMV29GQ",
    "email": "example",
    "name": "Example"
  },
  "household_id": "hh_01K9BKQB60S07ENW3AHRZ6DMV2",
  "expires_at": "example",
  "token": "example",
  "session": "example",
  "sample_records": 1
}

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