{
  "openapi": "3.1.0",
  "info": {
    "title": "Skheria Resident Engine local API",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "http://127.0.0.1:8787"
    }
  ],
  "paths": {
    "/v1/residents": {
      "post": {
        "operationId": "register",
        "security": [
          {
            "appCredential": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9:_-]{1,128}$"
            }
          }
        ],
        "x-required-scope": "residents:create",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "profile_key": {
                    "const": "lea_reference_v1"
                  }
                },
                "required": [
                  "profile_key"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Sanitized JSON resource or page; see the implemented V1 contract.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "Machine-readable error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "request_id": {
                          "type": "string",
                          "pattern": "^re_[0-9a-f]{32}$"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/residents/{id}": {
      "get": {
        "operationId": "profile",
        "security": [
          {
            "appCredential": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^re_[0-9a-f]{32}$"
            }
          }
        ],
        "x-required-scope": "resident:read",
        "responses": {
          "200": {
            "description": "Sanitized JSON resource or page; see the implemented V1 contract.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "Machine-readable error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "request_id": {
                          "type": "string",
                          "pattern": "^re_[0-9a-f]{32}$"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/residents/{id}/state": {
      "get": {
        "operationId": "state",
        "security": [
          {
            "appCredential": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^re_[0-9a-f]{32}$"
            }
          }
        ],
        "x-required-scope": "resident:read",
        "responses": {
          "200": {
            "description": "Sanitized JSON resource or page; see the implemented V1 contract.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "Machine-readable error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "request_id": {
                          "type": "string",
                          "pattern": "^re_[0-9a-f]{32}$"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/residents/{id}/events": {
      "get": {
        "operationId": "events",
        "security": [
          {
            "appCredential": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^re_[0-9a-f]{32}$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(?:[1-9]|[1-9][0-9]|100)$"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096
            }
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "utc"
            }
          },
          {
            "name": "until",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "utc"
            }
          },
          {
            "name": "types",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(?:WORK_EVENT_OCCURRED|RESIDENT_MET_RESIDENT|RESIDENT_NOTICED_ITEM|ITEM_PURCHASED|PURCHASE_PLAN_CREATED|PURCHASE_PLAN_ACTIVATED|ITEM_OUT_OF_STOCK|PURCHASE_PLAN_CLOSED|PLAN_RESPONSE_RECEIVED|RESIDENT_WANTS_EXTERNAL_CONTACT)(?:,(?:WORK_EVENT_OCCURRED|RESIDENT_MET_RESIDENT|RESIDENT_NOTICED_ITEM|ITEM_PURCHASED|PURCHASE_PLAN_CREATED|PURCHASE_PLAN_ACTIVATED|ITEM_OUT_OF_STOCK|PURCHASE_PLAN_CLOSED|PLAN_RESPONSE_RECEIVED|RESIDENT_WANTS_EXTERNAL_CONTACT))*$"
            }
          }
        ],
        "x-required-scope": "events:read",
        "responses": {
          "200": {
            "description": "Sanitized JSON resource or page; see the implemented V1 contract.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "Machine-readable error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "request_id": {
                          "type": "string",
                          "pattern": "^re_[0-9a-f]{32}$"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/residents/{id}/simulate": {
      "post": {
        "operationId": "simulate",
        "security": [
          {
            "appCredential": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^re_[0-9a-f]{32}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9:_-]{1,128}$"
            }
          }
        ],
        "x-required-scope": "simulation:advance",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "until": {
                    "type": "string",
                    "format": "utc"
                  },
                  "reason": {
                    "enum": [
                      "app_open",
                      "scheduled",
                      "interaction",
                      "client_request"
                    ]
                  }
                },
                "required": [
                  "until",
                  "reason"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sanitized JSON resource or page; see the implemented V1 contract.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "202": {
            "description": "Sanitized JSON resource or page; see the implemented V1 contract.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "Machine-readable error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "request_id": {
                          "type": "string",
                          "pattern": "^re_[0-9a-f]{32}$"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/residents/{id}/actions": {
      "post": {
        "operationId": "action",
        "security": [
          {
            "appCredential": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^re_[0-9a-f]{32}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9:_-]{1,128}$"
            }
          }
        ],
        "x-required-scope": "actions:write",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "const": "GIFT_SKR"
                      },
                      "parameters": {
                        "type": "object",
                        "properties": {
                          "amount_minor": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 1000000000000
                          }
                        },
                        "required": [
                          "amount_minor"
                        ],
                        "additionalProperties": false
                      },
                      "external_relation_id": {
                        "type": "string",
                        "pattern": "^re_[0-9a-f]{32}$"
                      }
                    },
                    "required": [
                      "type",
                      "parameters",
                      "external_relation_id"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "const": "CREATE_PURCHASE_PLAN"
                      },
                      "parameters": {
                        "type": "object",
                        "properties": {
                          "sku_id": {
                            "type": "string",
                            "pattern": "^re_[0-9a-f]{32}$"
                          },
                          "funding_transaction_id": {
                            "type": "string",
                            "pattern": "^re_[0-9a-f]{32}$"
                          },
                          "budget_minor": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 1000000000000
                          },
                          "window_start": {
                            "type": "string",
                            "format": "utc"
                          },
                          "window_end": {
                            "type": "string",
                            "format": "utc"
                          }
                        },
                        "required": [
                          "sku_id",
                          "funding_transaction_id",
                          "budget_minor",
                          "window_start",
                          "window_end"
                        ],
                        "additionalProperties": false
                      },
                      "external_relation_id": {
                        "type": "string",
                        "pattern": "^re_[0-9a-f]{32}$"
                      }
                    },
                    "required": [
                      "type",
                      "parameters",
                      "external_relation_id"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "const": "CARRY_ITEM"
                      },
                      "parameters": {
                        "type": "object",
                        "properties": {
                          "item_id": {
                            "type": "string",
                            "pattern": "^re_[0-9a-f]{32}$"
                          },
                          "carried": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "item_id",
                          "carried"
                        ],
                        "additionalProperties": false
                      },
                      "external_relation_id": {
                        "type": "string",
                        "pattern": "^re_[0-9a-f]{32}$"
                      }
                    },
                    "required": [
                      "type",
                      "parameters",
                      "external_relation_id"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sanitized JSON resource or page; see the implemented V1 contract.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "202": {
            "description": "Sanitized JSON resource or page; see the implemented V1 contract.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "Machine-readable error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "request_id": {
                          "type": "string",
                          "pattern": "^re_[0-9a-f]{32}$"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/residents/{id}/plans": {
      "get": {
        "operationId": "plans",
        "security": [
          {
            "appCredential": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^re_[0-9a-f]{32}$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(?:[1-9]|[1-9][0-9]|100)$"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096
            }
          }
        ],
        "x-required-scope": "plans:read",
        "responses": {
          "200": {
            "description": "Sanitized JSON resource or page; see the implemented V1 contract.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "Machine-readable error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "request_id": {
                          "type": "string",
                          "pattern": "^re_[0-9a-f]{32}$"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/plans/{id}": {
      "get": {
        "operationId": "plan",
        "security": [
          {
            "appCredential": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^re_[0-9a-f]{32}$"
            }
          }
        ],
        "x-required-scope": "plans:read",
        "responses": {
          "200": {
            "description": "Sanitized JSON resource or page; see the implemented V1 contract.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "Machine-readable error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "request_id": {
                          "type": "string",
                          "pattern": "^re_[0-9a-f]{32}$"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/plans/{id}/respond": {
      "post": {
        "operationId": "respond",
        "security": [
          {
            "appCredential": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^re_[0-9a-f]{32}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9:_-]{1,128}$"
            }
          }
        ],
        "x-required-scope": "plans:respond",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "external_relation_id": {
                        "type": "string",
                        "pattern": "^re_[0-9a-f]{32}$"
                      },
                      "expected_version": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 1000000000000
                      },
                      "response": {
                        "const": "BUY_ALTERNATIVE"
                      },
                      "sku_id": {
                        "type": "string",
                        "pattern": "^re_[0-9a-f]{32}$"
                      }
                    },
                    "required": [
                      "external_relation_id",
                      "expected_version",
                      "response",
                      "sku_id"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "external_relation_id": {
                        "type": "string",
                        "pattern": "^re_[0-9a-f]{32}$"
                      },
                      "expected_version": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 1000000000000
                      },
                      "response": {
                        "const": "CANCEL"
                      }
                    },
                    "required": [
                      "external_relation_id",
                      "expected_version",
                      "response"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sanitized JSON resource or page; see the implemented V1 contract.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "Machine-readable error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "request_id": {
                          "type": "string",
                          "pattern": "^re_[0-9a-f]{32}$"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/residents/{id}/wallet": {
      "get": {
        "operationId": "wallet",
        "security": [
          {
            "appCredential": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^re_[0-9a-f]{32}$"
            }
          }
        ],
        "x-required-scope": "wallet:read",
        "responses": {
          "200": {
            "description": "Sanitized JSON resource or page; see the implemented V1 contract.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "Machine-readable error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "request_id": {
                          "type": "string",
                          "pattern": "^re_[0-9a-f]{32}$"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/residents/{id}/transactions": {
      "get": {
        "operationId": "transactions",
        "security": [
          {
            "appCredential": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^re_[0-9a-f]{32}$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(?:[1-9]|[1-9][0-9]|100)$"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096
            }
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "utc"
            }
          },
          {
            "name": "until",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "utc"
            }
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "schema": {
              "enum": [
                "INCOME_SALARY",
                "INCOME_GIFT",
                "INCOME_OTHER",
                "HOUSING",
                "UTILITIES",
                "PHONE",
                "TRANSPORT",
                "FOOD_AND_DRINK",
                "SHOPPING",
                "ENTERTAINMENT",
                "OTHER"
              ]
            }
          }
        ],
        "x-required-scope": "wallet:read",
        "responses": {
          "200": {
            "description": "Sanitized JSON resource or page; see the implemented V1 contract.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "Machine-readable error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "request_id": {
                          "type": "string",
                          "pattern": "^re_[0-9a-f]{32}$"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/residents/{id}/financial-summary": {
      "get": {
        "operationId": "financial",
        "security": [
          {
            "appCredential": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^re_[0-9a-f]{32}$"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "utc"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "utc"
            }
          }
        ],
        "x-required-scope": "wallet:read",
        "responses": {
          "200": {
            "description": "Sanitized JSON resource or page; see the implemented V1 contract.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "Machine-readable error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "request_id": {
                          "type": "string",
                          "pattern": "^re_[0-9a-f]{32}$"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/residents/{id}/inventory": {
      "get": {
        "operationId": "inventory",
        "security": [
          {
            "appCredential": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^re_[0-9a-f]{32}$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(?:[1-9]|[1-9][0-9]|100)$"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096
            }
          }
        ],
        "x-required-scope": "inventory:read",
        "responses": {
          "200": {
            "description": "Sanitized JSON resource or page; see the implemented V1 contract.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "Machine-readable error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "request_id": {
                          "type": "string",
                          "pattern": "^re_[0-9a-f]{32}$"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/residents/{id}/contact-intents": {
      "get": {
        "operationId": "contacts",
        "security": [
          {
            "appCredential": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^re_[0-9a-f]{32}$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(?:[1-9]|[1-9][0-9]|100)$"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096
            }
          }
        ],
        "x-required-scope": "contact:read",
        "responses": {
          "200": {
            "description": "Sanitized JSON resource or page; see the implemented V1 contract.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "Machine-readable error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "request_id": {
                          "type": "string",
                          "pattern": "^re_[0-9a-f]{32}$"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/contact-intents/{id}/ack": {
      "post": {
        "operationId": "contactAck",
        "security": [
          {
            "appCredential": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^re_[0-9a-f]{32}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9:_-]{1,128}$"
            }
          }
        ],
        "x-required-scope": "contact:ack",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "enum": [
                      "delivered",
                      "suppressed"
                    ]
                  },
                  "handled_at": {
                    "type": "string",
                    "format": "utc"
                  }
                },
                "required": [
                  "status",
                  "handled_at"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sanitized JSON resource or page; see the implemented V1 contract.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "Machine-readable error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "request_id": {
                          "type": "string",
                          "pattern": "^re_[0-9a-f]{32}$"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/external-relations/{id}/signals": {
      "post": {
        "operationId": "signal",
        "security": [
          {
            "appCredential": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^re_[0-9a-f]{32}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9:_-]{1,128}$"
            }
          }
        ],
        "x-required-scope": "relation:signal",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "importance": {
                    "enum": [
                      "normal",
                      "high"
                    ]
                  },
                  "attachment": {
                    "enum": [
                      "normal",
                      "high"
                    ]
                  },
                  "contact_allowed": {
                    "type": "boolean"
                  },
                  "contact_frequency_preference": {
                    "enum": [
                      "low",
                      "normal",
                      "high"
                    ]
                  },
                  "min_interval_seconds": {
                    "type": "integer",
                    "minimum": 3600,
                    "maximum": 604800
                  },
                  "quiet_until": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "utc"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "expires_at": {
                    "type": "string",
                    "format": "utc"
                  }
                },
                "required": [
                  "importance",
                  "attachment",
                  "contact_allowed",
                  "contact_frequency_preference",
                  "min_interval_seconds",
                  "quiet_until",
                  "expires_at"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sanitized JSON resource or page; see the implemented V1 contract.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "Machine-readable error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "request_id": {
                          "type": "string",
                          "pattern": "^re_[0-9a-f]{32}$"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/outbox": {
      "get": {
        "operationId": "outbox",
        "security": [
          {
            "appCredential": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(?:[1-9]|[1-9][0-9]|100)$"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096
            }
          }
        ],
        "x-required-scope": "outbox:read",
        "responses": {
          "200": {
            "description": "Sanitized JSON resource or page; see the implemented V1 contract.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "Machine-readable error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "request_id": {
                          "type": "string",
                          "pattern": "^re_[0-9a-f]{32}$"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/outbox/{id}/ack": {
      "post": {
        "operationId": "outboxAck",
        "security": [
          {
            "appCredential": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^re_[0-9a-f]{32}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9:_-]{1,128}$"
            }
          }
        ],
        "x-required-scope": "outbox:ack",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "required": [],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sanitized JSON resource or page; see the implemented V1 contract.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "Machine-readable error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "request_id": {
                          "type": "string",
                          "pattern": "^re_[0-9a-f]{32}$"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "appCredential": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "opaque relation-bound credential"
      }
    }
  }
}
