incident.io
incident.io
Connect incident.io so your agents can follow your incidents: what is happening now, who leads each incident and who else holds a role, the updates shared so far, its timeline and key timestamps, and the follow-ups that came out of it. They can also look up your alerts, see who is on call on each schedule now or next week, and read your catalog of services, teams and other entries.
With write access, agents can also declare incidents, change an incident's name, summary, severity, status, roles, timestamps or custom fields, share updates, and create follow-ups. Declaring an incident is real: incident.io announces it, opens its channel and runs your workflows, which can page the people on call. Agents declare one only when you ask.
The API key's own permissions still apply, and it stays on Houston's server.
Setup instructions
Setup instructions
Connect incident.io
- With Manage API keys permission, open Settings → API keys and create a key.
- Grant View data, View catalog and View on-call resources. Add View all incident data only if agents may see private incidents.
- For writes, also grant Create incidents and Edit incidents; optionally Opt out of post-incident flow if agents may skip it.
- Paste API key into Houston, choose Read or Write for Access to match the intended access, and save.
Advanced
A personal key from Settings →
Authentication methods → User keys uses your permissions and stops working when
your account is deactivated. For missing data or forbidden actions, check the key's
permissions and their scope badges; follow-up creation needs follow_ups.create.
Your incident type may require fields such as severity or custom fields.
Files
Files
connector.luau
-- incident.io REST API (v1, v2 and v3 routes). Arguments and results keep incident.io's native snake_case field names. type Options = {[string]: any} type Endpoint = {method: string, path: string, query: {string}?, extra: {string}?, required: {string}?, access: string?, body: (boolean | string)?, fields: {string}?, page_max: number?, doc: string, about: string} local PROVIDER = "incident.io" local API = "https://api.incident.io" local DOCS = "https://docs.incident.io/api-reference/" local PAGE = {"page_size", "after"} local CHANGED = {"created_at", "updated_at"} local function with(...: {string}): {string} local fields: {string} = {} for _, group in {...} do table.move(group, 1, #group, #fields + 1, fields) end return fields end -- Operations in incident.io's OpenAPI (https://api.incident.io/v1/openapiV3.json), checked on -- 2026-10-30, at their newest version: severities, statuses, incident types, custom field -- options and the key's identity exist only in v1. Path {fields} are required; listed query -- fields are taken from the options and the other fields form the JSON body. local endpoints: {[string]: Endpoint} = { getIdentity = {method = "GET", path = "/v1/identity", doc = "utilities-v1/show-identity", about = "The API key's {identity={name, roles, team_roles, teams, dashboard_url}}: roles lists the permissions it was created with, such as viewer, global_access, incident_creator, incident_editor, catalog_viewer or on_call_viewer."}, listIncidents = {method = "GET", path = "/v2/incidents", query = with({"status", "status_category", "severity", "incident_type", "incident_role", "custom_field", "mode", "filter_mode", "sort_by"}, CHANGED, PAGE), doc = "incidents-v2/list", about = "Incidents, newest first unless sort_by='created_at_oldest_first': {incidents, pagination_meta={after, page_size, total_record_count}}. Each has id, reference (INC-123), name, summary, permalink, visibility, mode, incident_status {id, name, category}, severity {id, name, rank}, incident_type, created_at, updated_at, incident_role_assignments [{role {id, name, role_type}, assignee {id, name, email}}], incident_timestamp_values [{incident_timestamp {id, name}, value {value}}], duration_metrics, custom_field_entries, slack_channel_url and call_url. Filters are objects of operator to values, sent as status[one_of]=...: status={one_of={id}} or not_in; status_category={one_of={'live'}} with triage, live (shown as Active), learning (Post-incident), paused, closed, declined, canceled or merged; severity with one_of, not_in, gte or lte a severity id; incident_type with one_of or not_in; created_at and updated_at with gte, lte or date_range='2026-10-01~2026-10-31'; incident_role={[role_id]={one_of={user_id}}} or {[role_id]={is_blank={'true'}}}; custom_field={[field_id]={one_of={option_id}}}; mode={one_of={'test'}} (test and tutorial incidents are left out by default). filter_mode='any' ORs the filters. incident.io answers at most 60 incident lists a minute."}, getIncident = {method = "GET", path = "/v2/incidents/{id}", doc = "incidents-v2/show", about = "One incident, {incident}, by id or by the number of its reference (123 for INC-123), with the fields of listIncidents."}, listIncidentUpdates = {method = "GET", path = "/v2/incident_updates", query = with({"incident_id"}, PAGE), doc = "incident-updates-v2/list", about = "Updates shared on incidents: {incident_updates=[{id, incident_id, message, new_incident_status, new_severity, updater, created_at}], pagination_meta}. Without incident_id, updates across all incidents."}, listIncidentTimelineItems = {method = "GET", path = "/v2/incident_timeline_items", query = with({"incident_id"}, PAGE), required = {"incident_id"}, doc = "incident-timeline-items-v2/list", about = "An incident's timeline as the dashboard shows it, oldest first: {incident_timeline_items=[{id, title, description, timestamp, creator}], pagination_meta}."}, listIncidentAlerts = {method = "GET", path = "/v2/incident_alerts", query = with({"incident_id", "alert_id"}, PAGE), page_max = 50, doc = "incident-alerts-v2/list", about = "Links between alerts and incidents, {incident_alerts=[{id, alert {id, title, status}, incident {id, reference, name}, alert_route_id}], pagination_meta}; page_size at most 50."}, listFollowUps = {method = "GET", path = "/v3/follow_ups", query = with({"incident_id", "incident_mode", "assignee_team_id"}, CHANGED, PAGE), doc = "follow-ups-v3/list", about = "Follow-ups, {follow_ups=[{id, incident_id, title, description, status (outstanding, completed, not_doing or deleted), assignee, assignee_team, priority, category, labels, external_issue_reference, created_at, completed_at}], pagination_meta}. created_at and updated_at filter like listIncidents; incident_mode: standard, retrospective, test, tutorial or stream (default standard and retrospective)."}, getFollowUp = {method = "GET", path = "/v3/follow_ups/{id}", doc = "follow-ups-v3/show", about = "One follow-up, {follow_up}."}, listAlerts = {method = "GET", path = "/v2/alerts", query = with({"status", "alert_source", "alert_group_id", "deduplication_key", "attributes", "tags", "has_notes", "include_maintenance_window"}, CHANGED, PAGE), page_max = 50, doc = "alerts-v2/list", about = "Alerts from your alert sources: {alerts=[{id, title, description, status (firing or resolved), alert_source_id, deduplication_key, source_url, attributes, tags, created_at, resolved_at}], pagination_meta}; page_size at most 50. Filters work like listIncidents: status={one_of={'firing'}}, alert_source={one_of={source_id}}, deduplication_key={is={key}}, tags={one_of={'known issue'}}, attributes={[attribute_id]={one_of={value}}}, has_notes={is={'true'}}, include_maintenance_window={is={'true'}}, created_at={gte={'2026-10-01'}}."}, getAlert = {method = "GET", path = "/v2/alerts/{id}", doc = "alerts-v2/show", about = "One alert, {alert}."}, listSchedules = {method = "GET", path = "/v2/schedules", query = PAGE, doc = "schedules-v2/list", about = "On-call schedules, {schedules=[{id, name, timezone, team_ids, current_shifts, next_shifts, config {rotations}}], pagination_meta}; current_shifts lists who is on call now, [{user {id, name, email}, start_at, end_at, rotation_id}]. next_shifts is filled only when page_size is 25 or less."}, getSchedule = {method = "GET", path = "/v2/schedules/{id}", doc = "schedules-v2/show", about = "One schedule, {schedule}, with its current_shifts, next_shifts and rotations."}, listScheduleEntries = {method = "GET", path = "/v2/schedule_entries", query = {"schedule_id", "entry_window_start", "entry_window_end"}, required = {"schedule_id"}, doc = "schedule-entries-v2/list", about = "Who is on call on a schedule over a window (ISO 8601 times; by default from now): {schedule_entries={final, scheduled, overrides}, pagination_meta?}. final is the effective rota after overrides, [{user, start_at, end_at, rotation_id}]. When pagination_meta.after is set, call again with entry_window_start=pagination_meta.after and the same entry_window_end."}, listUsers = {method = "GET", path = "/v2/users", query = with({"email", "slack_user_id", "include_inactive"}, PAGE), doc = "users-v2/list", about = "Users, {users=[{id, name, email, role, slack_user_id}], pagination_meta}; email or slack_user_id finds one person."}, getUser = {method = "GET", path = "/v2/users/{id}", doc = "users-v2/show", about = "One user, {user}."}, listTeams = {method = "GET", path = "/v3/teams", query = PAGE, doc = "teams-v3/list", about = "Teams, {teams=[{id, name, members, catalog_entry}], pagination_meta}."}, listSeverities = {method = "GET", path = "/v1/severities", doc = "severities-v1/list", about = "Severities, {severities=[{id, name, description, rank}]}; a higher rank is more severe."}, listIncidentStatuses = {method = "GET", path = "/v1/incident_statuses", doc = "incident-statuses-v1/list", about = "Incident statuses, {incident_statuses=[{id, name, description, rank, category}]}; category is triage, live, learning, paused, closed, declined, canceled or merged."}, listIncidentTypes = {method = "GET", path = "/v1/incident_types", doc = "incident-types-v1/list", about = "Incident types, {incident_types=[{id, name, description, is_default, private_incidents_only}]}."}, listIncidentRoles = {method = "GET", path = "/v2/incident_roles", doc = "incident-roles-v2/list", about = "Incident roles, {incident_roles=[{id, name, shortform, description, instructions, role_type (lead, reporter or custom)}]}."}, listIncidentTimestamps = {method = "GET", path = "/v2/incident_timestamps", doc = "incident-timestamps-v2/list", about = "Incident timestamps, such as when an incident was reported, accepted or resolved: {incident_timestamps=[{id, name, rank}]}."}, listCustomFields = {method = "GET", path = "/v2/custom_fields", doc = "custom-fields-v2/list", about = "Incident custom fields, {custom_fields=[{id, name, description, field_type (single_select, multi_select, text, link or numeric), catalog_type_id}]}."}, listCustomFieldOptions = {method = "GET", path = "/v1/custom_field_options", query = with({"custom_field_id"}, PAGE), required = {"custom_field_id"}, doc = "custom-field-options-v1/list", about = "A select custom field's options, {custom_field_options=[{id, value, sort_key}], pagination_meta}."}, listCatalogTypes = {method = "GET", path = "/v3/catalog_types", doc = "catalog-types-v3/list-types", about = "Catalog types, such as services, teams or features, {catalog_types=[{id, name, description, type_name, schema {attributes}, categories, is_editable}]}."}, listCatalogEntries = {method = "GET", path = "/v3/catalog_entries", query = with({"catalog_type_id", "identifier"}, PAGE), required = {"catalog_type_id"}, doc = "catalog-entries-v3/list-entries", about = "A catalog type's entries, {catalog_entries=[{id, name, external_id, aliases, rank, attribute_values {[attribute_id]={value or array_value}}}], catalog_type, pagination_meta}. identifier matches an entry's id, external id or alias."}, getCatalogEntry = {method = "GET", path = "/v3/catalog_entries/{id}", query = {"expand"}, doc = "catalog-entries-v3/show-entry", about = "One catalog entry, {catalog_entry, catalog_type}; expand=true adds the entries that link to it."}, createIncident = {method = "POST", path = "/v2/incidents", access = "data:write", required = {"idempotency_key", "visibility"}, fields = {"idempotency_key", "visibility", "name", "summary", "severity_id", "incident_type_id", "incident_status_id", "mode", "incident_role_assignments", "incident_timestamp_values", "custom_field_entries", "slack_team_id", "slack_channel_name_override", "retrospective_incident_options"}, doc = "incidents-v2/create", about = "Declares an incident and returns {incident}; read PAGING above first. visibility: public or private. mode: standard (default), retrospective, test or tutorial. Most accounts require name and severity_id, and the incident type's required custom fields. incident_role_assignments=[{incident_role_id, assignee={id or email or slack_user_id}}], incident_timestamp_values=[{incident_timestamp_id, value}], custom_field_entries=[{custom_field_id, values=[{value_option_id or value_text or value_link or value_numeric or value_catalog_entry_id}]}]. incident.io de-duplicates requests by idempotency_key, so repeating one with the same key cannot declare a second incident; list incidents to see what the first call did."}, editIncident = {method = "POST", path = "/v2/incidents/{id}/actions/edit", access = "data:write", required = {"incident", "notify_incident_channel"}, fields = {"incident", "notify_incident_channel"}, doc = "incidents-v2/edit", about = "Changes only the fields given in incident={name, summary, severity_id, incident_status_id, custom_field_entries, incident_role_assignments, incident_timestamp_values, call_url, slack_channel_name_override} and returns {incident}; notify_incident_channel=true posts the change in the incident's channel. Statuses move within their category, from triage or live to learning or closed (resolving), or from learning to closed; resolving to learning starts the post-incident flow, and closing directly needs the key's post-incident opt-out permission."}, createIncidentUpdate = {method = "POST", path = "/v2/incident_updates", access = "data:write", required = {"incident_id", "idempotency_key"}, fields = {"incident_id", "idempotency_key", "message", "to_incident_status_id", "to_severity_id"}, doc = "incident-updates-v2/create", about = "Shares an update in the incident's channel and returns {incident_update}: a Markdown message, a new status, a new severity, or a combination (at least one). Retrying with the same idempotency_key returns the update already shared."}, createFollowUp = {method = "POST", path = "/v3/follow_ups", access = "data:write", required = {"incident_id", "title"}, fields = {"incident_id", "title", "description", "assignee_id", "assignee_team_id", "follow_up_priority_option_id", "follow_up_category_id", "labels", "external_issue_reference_id"}, doc = "follow-ups-v3/create", about = "Adds a follow-up to an incident and returns {follow_up}; description is Markdown, assignee_id a user id and assignee_team_id a team id. Each call creates another follow-up."}, } -- Request layer shared verbatim by the endpoint-table connectors -- (tools/validate checks they match). It uses each connector's PROVIDER, DOCS and Endpoint type. local NULL = json.decode("null") local NONE: {string} = table.freeze({}) local function options(input: Options?): Options if input == nil then return {} end assert(type(input) == "table", "opts must be an object") for key in input do assert(type(key) == "string", "opts must have named fields") end return table.clone(input) end local function scalar(value: any, field: string): string local kind = type(value) assert(kind == "string" or kind == "boolean" or kind == "number", field .. " must be a string, boolean, number or array of those") return url.encode(value) end -- A query value's encoded parts: one for a scalar, one per item of a nonempty array. Each -- connector joins them as its provider expects, comma-separated or with the key repeated. local function queryParts(value: any, field: string): {string} if type(value) ~= "table" then return {scalar(value, field)} end local parts: {string} = {} for index, item in value do assert(type(index) == "number" and index == #parts + 1, field .. " must be an array, not an object") table.insert(parts, scalar(item, field)) end assert(#parts > 0, field .. " must not be an empty array") return parts end -- POST, PATCH and PUT send the remaining options as the JSON body unless body is false -- (no body) or names the one option to send. local function hasBody(endpoint: Endpoint): boolean return endpoint.body ~= false and (endpoint.method == "POST" or endpoint.method == "PATCH" or endpoint.method == "PUT") end local function fail(name: string, response: HttpResponse, message: string): never return houston.fail({operation = name, layer = "upstream", upstream_status = response.statusCode, retryable = response.statusCode == 429 or response.statusCode >= 500, message = message}) end -- A successful response's JSON object, or nil when a write answers without a body. With arrays, -- a top-level JSON array is accepted too, and the second result tells which one came back. local function object(name: string, endpoint: Endpoint, response: HttpResponse, arrays: boolean?): (any, boolean) local raw = await(response.body:readAll()) if endpoint.method ~= "GET" and endpoint.access and string.match(raw, "^%s*$") then return nil, false end local ok, value = pcall(json.decode, raw) local list = arrays == true and string.match(raw, "^%s*%[") ~= nil if not ok or type(value) ~= "table" or not (list or string.match(raw, "^%s*{")) then fail(name, response, PROVIDER .. " returned an invalid JSON object") end return value, list end -- name({path fields, query fields?, extra fields?, required body fields, ...body}) built from the -- endpoint itself. -- Extra fields are options the connector's own request consumes, such as a request header. local function signature(endpoint: Endpoint): string local fields: {string} = {} for field in string.gmatch(endpoint.path, "{([%w_]+)}") do table.insert(fields, field) end for _, group in {endpoint.query or NONE, endpoint.extra or NONE} do for _, field in group do table.insert(fields, if table.find(endpoint.required or NONE, field) then field else field .. "?") end end if type(endpoint.body) == "string" then table.insert(fields, endpoint.body) elseif hasBody(endpoint) then for _, field in endpoint.required or NONE do if not table.find(fields, field) then table.insert(fields, field) end end table.insert(fields, "...body") end return "({" .. table.concat(fields, ", ") .. "})" end -- A function for each endpoint the connection's access allows, and help listing them after intro. local function operations(endpoints: {[string]: Endpoint}, request: (string, Endpoint, Options?) -> any, intro: {string}): {[string]: any} local exports: {[string]: any} = {} for name, endpoint in endpoints do if not endpoint.access or houston.allows(endpoint.access) then exports[name] = function(args: Options?): any return request(name, endpoint, args) end end end exports.help = function(): string local names: {string} = {} for name in exports do if name ~= "help" then table.insert(names, name) end end table.sort(names) local lines = table.clone(intro) table.insert(lines, "Each function below names its route and reference page, " .. DOCS .. "<page>.") for _, name in names do local endpoint = endpoints[name] table.insert(lines, name .. signature(endpoint) .. ": " .. endpoint.about .. " " .. endpoint.method .. " " .. endpoint.path .. " (" .. endpoint.doc .. ")") end return table.concat(lines, "\n") end return exports end -- End of the shared request layer. -- A request waits this long for incident.io's headers, Houston's 429 retries included, and then -- for the body, so a slow answer fails clearly within the 30-second call. local WAIT_MS, BODY_MS = 15000, 10000 local TIMED_OUT = "did not answer within " .. (WAIT_MS + BODY_MS) // 1000 .. " s" local MAX_PAGE = 250 -- incident.io's deep-object filters, sent as status[one_of]=a or custom_field[id][one_of]=b. local FILTERS = {"status", "status_category", "severity", "incident_type", "incident_role", "custom_field", "mode", "created_at", "updated_at", "alert_source", "alert_group_id", "deduplication_key", "attributes", "tags", "has_notes", "include_maintenance_window"} local function timedOut(err: any): boolean return type(err) == "table" and err.code == "timeout" end -- Reads, and the writes incident.io de-duplicates by idempotency_key, are safe to repeat. local function repeatable(endpoint: Endpoint): boolean return not endpoint.access or table.find(endpoint.required or NONE, "idempotency_key") ~= nil end local function writeHint(endpoint: Endpoint): string if not endpoint.access then return "" end return if repeatable(endpoint) then "; it may still have applied the change: read it back, and repeat it only with the same idempotency_key" else "; it may still have applied the change, so read it back before repeating it" end -- A call left without a complete answer. local function unanswered(name: string, endpoint: Endpoint, status: number?, problem: string): never local hint = writeHint(endpoint) if hint == "" then hint = if table.find(endpoint.query or NONE, "page_size") then "; request a smaller page_size" else "; try again" end return houston.fail({operation = name, layer = "upstream", upstream_status = status, retryable = repeatable(endpoint), message = PROVIDER .. " " .. problem .. hint}) end -- A body that stalls, or a write's body that breaks off after its 2xx headers; cancellation passes through. local function unreadable(name: string, endpoint: Endpoint, status: number?, err: any): never if timedOut(err) then unanswered(name, endpoint, status, TIMED_OUT) end if endpoint.access and not (type(err) == "table" and err.code == "cancelled") then unanswered(name, endpoint, status, "did not finish its answer") end return error(err, 0) end -- incident.io errors are {type, status, request_id, errors=[{code, message, source={field}}]}. local function failStatus(name: string, endpoint: Endpoint, response: HttpResponse): never local status = response.statusCode local message = PROVIDER .. " HTTP " .. tostring(status) local read, raw = pcall(function(): any return await(response.body:readPrefix(16 * 1024), BODY_MS) end) if not read and type(raw) == "table" and raw.code == "cancelled" then error(raw, 0) end local ok, value = pcall(json.decode, if read then raw else "") if ok and type(value) == "table" then if type(value.type) == "string" then message ..= " (" .. string.sub(value.type, 1, 100) .. ")" end local details: {string} = {} if type(value.errors) == "table" then for _, problem in value.errors do if type(problem) == "table" and type(problem.message) == "string" and #details < 5 then local field = if type(problem.source) == "table" and type(problem.source.field) == "string" then " (" .. string.sub(problem.source.field, 1, 100) .. ")" else "" table.insert(details, string.sub(problem.message, 1, 300) .. field) end end end if #details > 0 then message ..= ": " .. table.concat(details, "; ") end if type(value.request_id) == "string" then message ..= "; request_id " .. string.sub(value.request_id, 1, 64) end end local retry = response.headers["retry-after"] if status == 429 and retry and string.match(retry[1] or "", "^%d+$") then message ..= "; retry after " .. string.sub(retry[1], 1, 10) .. " s" end if status >= 500 then message ..= writeHint(endpoint) end return houston.fail({operation = name, layer = "upstream", upstream_status = status, retryable = status == 429 or (status >= 500 and repeatable(endpoint)), message = message}) end -- A query value's key and encoded parts; filters nest objects of ids and operators. local function addQuery(query: {string}, key: string, value: any, field: string, nested: boolean) if not nested then for _, part in queryParts(value, field) do table.insert(query, url.encode(key) .. "=" .. part) end return end assert(type(value) == "table" and type((next(value))) == "string", field .. " must be an object such as {one_of={...}}") local keys: {string} = {} for item in value do assert(type(item) == "string" and string.match(item, "^[^%[%]]+$"), field .. " must be an object of operators or ids, without [ or ]") table.insert(keys, item) end table.sort(keys) for _, item in keys do local inner = value[item] addQuery(query, key .. "[" .. item .. "]", inner, field, type(inner) == "table" and type((next(inner))) == "string") end end local function request(name: string, endpoint: Endpoint, input: Options?): any local args = options(input) local path = string.gsub(endpoint.path, "{([%w_]+)}", function(field: string) local value = args[field] args[field] = nil assert(value ~= nil and value ~= NULL, field .. " is required") assert(type(value) == "string" or (type(value) == "number" and value == math.floor(value)), field .. " must be a string") local ok, segment = pcall(url.segment, tostring(value), field) assert(ok, field .. " must be an incident.io id") return segment end) for _, field in endpoint.required or NONE do assert(args[field] ~= nil and args[field] ~= NULL, field .. " is required") end local query: {string} = {} for _, field in endpoint.query or NONE do local value = args[field] if field == "page_size" then local most = endpoint.page_max or MAX_PAGE value = if value == nil then 25 else value assert(type(value) == "number" and value == math.floor(value) and value >= 1 and value <= most, "page_size must be a whole number from 1 to " .. most) end if value ~= nil then addQuery(query, field, value, field, table.find(FILTERS, field) ~= nil) end args[field] = nil end if #query > 0 then path ..= "?" .. table.concat(query, "&") end if endpoint.fields then for field in args do assert(table.find(endpoint.fields :: {string}, field), name .. " has no option " .. field) end end local headers: HttpHeaders = {Accept = {"application/json"}} local body: string? = nil if hasBody(endpoint) then headers["Content-Type"] = {"application/json"} body = json.encode(args) args = {} end local unknown = next(args) assert(unknown == nil, name .. " has no option " .. tostring(unknown)) local sent, response = pcall(function(): any return await(http.request({url = API .. path, method = endpoint.method, headers = headers, body = body, timeoutMs = WAIT_MS})) end) if not sent then if not timedOut(response) then error(response, 0) end unanswered(name, endpoint, nil, TIMED_OUT) end if response.statusCode < 200 or response.statusCode >= 300 then failStatus(name, endpoint, response) end local read, raw = pcall(function(): any return await(response.body:readAll(), BODY_MS) end) if not read then unreadable(name, endpoint, response.statusCode, raw) end local ok, value = pcall(json.decode, raw) if not ok or type(value) ~= "table" or not string.match(raw, "^%s*{") then fail(name, response, PROVIDER .. " returned an invalid JSON object") end return value end local intro = { "incident.io API on " .. API .. ", with the connection's API key. Every function takes one named options object with incident.io's native names; ? marks optional fields and ...body the JSON body fields. Results are incident.io's JSON unchanged, wrapped as incident.io wraps them ({incidents}, {incident}...). Connector calls return completed values: use them directly, without await.", "Ids are ULIDs such as 01FDAG4SAP5TYPT98WGR2N7W91; getIncident also takes an incident's number (123 for INC-123). Times are ISO 8601. Send an empty list as json.decode('[]'), since an empty Lua table is sent as {}. Severities, statuses, incident types, roles, timestamps and custom fields are your account's own: list them to find their ids before filtering or writing.", "Lists return one page with pagination_meta.after: while it is a string, pass it as after for the next page, even after a short page. page_size is 1 to " .. MAX_PAGE .. " (default 25; at most 50 for alerts and incident alerts). Configuration lists (severities, statuses, types, roles, timestamps, custom fields, catalog types) return everything at once.", "Examples: local live = incidentio.listIncidents({status_category={one_of={'live'}}, page_size=10}); local inc = incidentio.getIncident({id=live.incidents[1].id}).incident; local ups = incidentio.listIncidentUpdates({incident_id=inc.id}).incident_updates; local s = incidentio.listSchedules({}).schedules[1]; local now = s.current_shifts; local rota = incidentio.listScheduleEntries({schedule_id=s.id, entry_window_start='2026-11-02T00:00:00Z', entry_window_end='2026-11-09T00:00:00Z'}).schedule_entries.final.", "The API key's permissions apply: an HTTP 403 means the key lacks a permission, and private incidents (and their follow-ups, alerts and updates) need View all incident data; getIdentity lists the key's roles. incident.io allows 1,200 requests a minute per key; Houston retries an HTTP 429 up to twice when incident.io asks to wait 5 seconds or less, and otherwise reports how long to wait. Errors report the HTTP status, incident.io's error type and messages, and its request_id. A call that gets no complete answer within " .. (WAIT_MS + BODY_MS) // 1000 .. " s fails.", } if houston.allows("data:write") then table.insert(intro, "PAGING: createIncident declares an incident, and incident.io acts on it at once. A standard incident is announced in your announcement channels, gets its own Slack or Microsoft Teams channel, and runs your workflows, which can escalate to on-call responders and page them by phone, SMS or app notification at any hour. Declare one only when the person explicitly asks for it, with the name, severity and visibility they confirmed. mode='retrospective' records a past incident without announcing it; mode='test' runs a practice incident that is not announced, stays out of dashboards and runs only workflows set to include test incidents. incident.io lets a key declare 10 incidents an hour that open a channel and 300 that do not.") table.insert(intro, "Other side effects: editIncident with notify_incident_channel=true, and createIncidentUpdate, post in the incident channel, and a status or severity change can run workflows and escalations; createFollowUp may be exported to your issue tracker. Apart from Houston's 429 retries, writes are not retried. After a timeout or 5xx, read the incident, its updates or its follow-ups before repeating a write; incident.io de-duplicates createIncident and createIncidentUpdate by idempotency_key, so repeat those only with the same key: their timeouts and 5xx errors are marked retryable on that basis, while editIncident and createFollowUp failures are not.") else table.insert(intro, "This read-only connection omits writes: declaring and editing incidents, sharing updates and creating follow-ups.") end return operations(endpoints, request, intro)houston.json
{ "schema_version": 2, "name": "incident.io", "files": [ "connector.luau" ], "icon": "icon.svg", "access": [ { "name": "data", "label": "Access", "levels": [ { "value": "read", "label": "Read" }, { "value": "write", "label": "Write" } ], "default": "read" } ], "auth": { "token": { "type": "manual", "label": "API key", "config": { "token": { "label": "API key", "required": true, "type": "secret" } } } }, "proxy": [ { "match": { "protocol": "http", "host": [ "api.incident.io" ], "method": [ "GET" ], "path": [ "/v1/custom_field_options", "/v1/identity", "/v1/incident_statuses", "/v1/incident_types", "/v1/severities", "/v2/alerts", "/v2/alerts/{id}", "/v2/custom_fields", "/v2/incident_alerts", "/v2/incident_roles", "/v2/incident_timeline_items", "/v2/incident_timestamps", "/v2/incident_updates", "/v2/incidents", "/v2/incidents/{id}", "/v2/schedule_entries", "/v2/schedules", "/v2/schedules/{id}", "/v2/users", "/v2/users/{id}", "/v3/catalog_entries", "/v3/catalog_entries/{id}", "/v3/catalog_types", "/v3/follow_ups", "/v3/follow_ups/{id}", "/v3/teams" ] }, "action": { "headers": { "set": { "Authorization": "Bearer {{auth.token.token}}" } } } }, { "if": "{{ allows access.data \"write\" }}", "match": { "protocol": "http", "host": [ "api.incident.io" ], "method": [ "POST" ], "path": [ "/v2/incident_updates", "/v2/incidents", "/v2/incidents/{id}/actions/edit", "/v3/follow_ups" ] }, "action": { "headers": { "set": { "Authorization": "Bearer {{auth.token.token}}" } } } } ] }icon.svg
README.md
--- description: Follow incident.io incidents, updates, follow-ups, alerts, on-call schedules and the catalog, and declare and update incidents. --- # incident.io Connect incident.io so your agents can follow your incidents: what is happening now, who leads each incident and who else holds a role, the updates shared so far, its timeline and key timestamps, and the follow-ups that came out of it. They can also look up your alerts, see who is on call on each schedule now or next week, and read your catalog of services, teams and other entries. With write access, agents can also declare incidents, change an incident's name, summary, severity, status, roles, timestamps or custom fields, share updates, and create follow-ups. Declaring an incident is real: incident.io announces it, opens its channel and runs your workflows, which can page the people on call. Agents declare one only when you ask. The API key's own permissions still apply, and it stays on Houston's server. [Connect incident.io](SETUP.md).SETUP.md
# Connect incident.io 1. With **Manage API keys** permission, open [Settings → API keys](https://app.incident.io/~/settings/api-keys) and create a key. 2. Grant **View data**, **View catalog** and **View on-call resources**. Add **View all incident data** only if agents may see private incidents. 3. For writes, also grant **Create incidents** and **Edit incidents**; optionally **Opt out of post-incident flow** if agents may skip it. 4. Paste **API key** into Houston, choose **Read** or **Write** for **Access** to match the intended access, and save. [Official API key guide](https://docs.incident.io/admin/api-keys). ## Advanced A [personal key](https://docs.incident.io/admin/user-api-keys) from **Settings → Authentication methods → User keys** uses your permissions and stops working when your account is deactivated. For missing data or forbidden actions, check the key's permissions and their scope badges; follow-up creation needs `follow_ups.create`. Your incident type may require fields such as severity or custom fields.tests
authentication.luau
return { contract = function(m) m.authentication({ { auth = { token = "synthetic-method-secret" }, config = {}, endpoint = { "GET", "https://api.incident.io/v1/identity" }, expected = "Bearer synthetic-method-secret", header = "Authorization", method = "token", publisher = {}, }, }) end, }endpoints.luau
return { contract = function(m) m.endpointRules() end, }errors.luau
return { scenario = {publisher = {}, access = {data = "write"}, config = {}, auth_method = "token", auth_config = {token = "fixture-token"}}, configure = function() calls = 0 status = 200 payload = "{}" responseHeaders = {} http = {request = function(req) calls += 1 -- A table stands for a failure while waiting for headers, such as a timeout. if requestError then error(requestError, 0) end -- A body whose read fails stands in for a stalled answer or a cancelled invocation. local body = if readError then {readAll = function() error(readError, 0) end, readPrefix = function() error(readError, 0) end, close = function() end} else fixture.reader(payload) return fixture.operation({statusCode = status, headers = responseHeaders, body = body}) end} end, run = function(incidentio) local function failure(call, code, body, headers, expected) status, payload, responseHeaders = code, body, headers local before = calls local ok, err = pcall(call) for _, text in expected do assert(not ok and string.find(tostring(err), text, 1, true), "missing " .. text .. " in " .. tostring(err)) end assert(calls == before + 1, "failed request was retried") end local function declare() incidentio.createIncident({idempotency_key = "k1", visibility = "public", name = "Checkout down"}) end local function read() incidentio.getIncident({id = "01HZINC"}) end local function list() incidentio.listIncidents() end local function follow() incidentio.createFollowUp({incident_id = "01HZINC", title = "Add a canary"}) end failure(read, 401, '{"type":"authentication_error","status":401,"request_id":"req-1","errors":[{"code":"missing_authorization_material","message":"No authorization material provided in request"}]}', {}, {"incident.io HTTP 401 (authentication_error): No authorization material provided in request; request_id req-1", '"upstream_status":401', '"retryable":false'}) failure(declare, 403, '{"type":"authorization_error","status":403,"errors":[{"code":"missing_scope","message":"Your API key is missing a required scope"}]}', {}, {"HTTP 403 (authorization_error): Your API key is missing a required scope", '"retryable":false'}) failure(declare, 422, '{"type":"validation_error","status":422,"request_id":"req-3","errors":[{"code":"is_required","message":"A severity is required to open an incident","source":{"field":"severity_id"}},' .. '{"code":"is_required","message":"Pick a type","source":null}]}', {}, {"HTTP 422 (validation_error): A severity is required to open an incident (severity_id); Pick a type; request_id req-3", '"retryable":false'}) -- Nulls in the envelope are skipped rather than treated as values. failure(read, 404, '{"type":null,"status":404,"request_id":null,"errors":[null,{"code":"not_found","message":null},{"message":"Not found","source":{"field":null}}]}', {}, {"incident.io HTTP 404: Not found", '"retryable":false'}) failure(read, 404, '{"type":"not_found","errors":null}', {}, {"incident.io HTTP 404 (not_found)", '"retryable":false'}) failure(list, 400, json.encode({type = "invalid_request", errors = {{message = string.rep("x", 5000)}}}), {}, {"HTTP 400 (invalid_request): xxx"}) failure(list, 429, '{"type":"too_many_requests","status":429,"rate_limit":{"name":"Houston","limit":60,"remaining":0},"errors":[{"code":"too_many_requests","message":"Too many requests hit the API too quickly."}]}', {["retry-after"] = {"30"}}, {"HTTP 429 (too_many_requests): Too many requests hit the API too quickly.; retry after 30 s", '"retryable":true'}) failure(list, 429, '{"type":"too_many_requests"}', {["retry-after"] = {"Fri, 30 Oct 2026 18:00:00 GMT"}}, {'HTTP 429 (too_many_requests)"', '"retryable":true'}) failure(read, 502, "<html>Bad gateway</html>", {}, {"incident.io HTTP 502", '"upstream_status":502', '"retryable":true'}) -- A 5xx after a write may hide a saved change: only writes incident.io de-duplicates are retryable. failure(declare, 503, "", {}, {"incident.io HTTP 503; it may still have applied the change: read it back, and repeat it only with the same idempotency_key", '"retryable":true'}) failure(follow, 502, "<html>Bad gateway</html>", {}, {"incident.io HTTP 502; it may still have applied the change, so read it back before repeating it", '"retryable":false'}) failure(read, 200, "<html>Maintenance</html>", {}, {"incident.io returned an invalid JSON object"}) failure(read, 200, "[1,2]", {}, {"incident.io returned an invalid JSON object"}) -- A read that gets no answer in time can be retried; a write may have been applied. requestError = {code = "timeout", message = "request deadline"} failure(list, 200, "", {}, {"incident.io did not answer within 25 s; request a smaller page_size", '"retryable":true'}) failure(read, 200, "", {}, {"incident.io did not answer within 25 s; try again", '"retryable":true'}) failure(declare, 200, "", {}, {"did not answer within 25 s; it may still have applied the change: read it back, and repeat it only with the same idempotency_key", '"retryable":true'}) failure(follow, 200, "", {}, {"did not answer within 25 s; it may still have applied the change, so read it back", '"retryable":false'}) -- Other request failures pass through instead of becoming upstream failures. requestError = {code = "access_denied", message = "origin not allowed"} local ok, err = pcall(read) assert(not ok and not string.find(tostring(err), "retryable", 1, true), tostring(err)) requestError = nil -- A body that stalls is bounded too; an error body that stalls still reports the status. readError = {code = "timeout", message = "await timed out"} failure(follow, 200, "", {}, {"did not answer within 25 s; it may still have applied the change", '"upstream_status":200', '"retryable":false'}) failure(read, 429, "", {}, {"incident.io HTTP 429", '"upstream_status":429', '"retryable":true'}) -- A write's answer that breaks off after its 2xx headers keeps the status and the read-back hint; a read's error passes through. readError = {code = "io_error", message = "connection reset by peer"} failure(follow, 201, "", {}, {"incident.io did not finish its answer; it may still have applied the change", '"upstream_status":201', '"retryable":false'}) ok, err = pcall(read) assert(not ok and not string.find(tostring(err), "retryable", 1, true), tostring(err)) readError = {code = "cancelled", message = "invocation cancelled"} ok, err = pcall(read) assert(not ok and not string.find(tostring(err), "retryable", 1, true), "cancellation became an upstream error: " .. tostring(err)) readError = nil end, }manifest.luau
return { contract = function(m) -- TestIncidentioAccessRoutes do local api = "https://api.incident.io" for _, access in { "read", "write" } do local r, err = m.resolve(nil, {}, { token = "inc_fixture" }, "token", { data = access }) assert(not err, tostring(err)) m.routes(r, "Bearer inc_fixture", true, { "GET " .. api .. "/v1/identity", "GET " .. api .. "/v2/incidents?status_category%5Bone_of%5D=live&page_size=25", "GET " .. api .. "/v2/incidents/42", "GET " .. api .. "/v2/incident_updates?incident_id=01HZINC", "GET " .. api .. "/v2/incident_timeline_items?incident_id=01HZINC", "GET " .. api .. "/v2/incident_alerts?page_size=50", "GET " .. api .. "/v3/follow_ups?incident_id=01HZINC", "GET " .. api .. "/v3/follow_ups/01HZFU", "GET " .. api .. "/v2/alerts?page_size=25", "GET " .. api .. "/v2/alerts/01HZAL", "GET " .. api .. "/v2/schedules", "GET " .. api .. "/v2/schedules/01HZSC", "GET " .. api .. "/v2/schedule_entries?schedule_id=01HZSC", "GET " .. api .. "/v2/users?email=ada%40example.com", "GET " .. api .. "/v2/users/01HZU", "GET " .. api .. "/v3/teams", "GET " .. api .. "/v1/severities", "GET " .. api .. "/v1/incident_statuses", "GET " .. api .. "/v1/incident_types", "GET " .. api .. "/v2/incident_roles", "GET " .. api .. "/v2/incident_timestamps", "GET " .. api .. "/v2/custom_fields", "GET " .. api .. "/v1/custom_field_options?custom_field_id=01HZCF", "GET " .. api .. "/v3/catalog_types", "GET " .. api .. "/v3/catalog_entries?catalog_type_id=01HZCT", "GET " .. api .. "/v3/catalog_entries/01HZCE?expand=true", }) m.routes(r, "Bearer inc_fixture", (access == "write"), { "POST " .. api .. "/v2/incidents", "POST " .. api .. "/v2/incidents/01HZINC/actions/edit", "POST " .. api .. "/v2/incident_updates", "POST " .. api .. "/v3/follow_ups", }) m.routes(r, "Bearer inc_fixture", false, { "PUT " .. api .. "/v3/follow_ups/01HZFU", "DELETE " .. api .. "/v3/follow_ups/01HZFU", "POST " .. api .. "/v3/follow_ups/01HZFU/actions/connect_external_issue", "POST " .. api .. "/v2/incidents/01HZINC/actions/connect_external_issue", "POST " .. api .. "/v2/incidents/01HZINC", "PATCH " .. api .. "/v2/incidents/01HZINC", "DELETE " .. api .. "/v2/incidents/01HZINC", "POST " .. api .. "/v2/alerts/01HZAL/actions/resolve", "POST " .. api .. "/v2/escalations", "POST " .. api .. "/v2/alert_events/http/01HZSRC", "POST " .. api .. "/v2/incident_alerts", "POST " .. api .. "/v1/incident_memberships", "POST " .. api .. "/v3/catalog_entries", "PUT " .. api .. "/v3/catalog_entries/01HZCE", "POST " .. api .. "/v2/schedule_overrides", "POST " .. api .. "/v2/status_page_incidents", "GET " .. api .. "/v1/incidents", "POST " .. api .. "/v1/incidents", "GET " .. api .. "/v2/follow_ups", "POST " .. api .. "/v2/follow_ups", "GET " .. api .. "/v2/catalog_entries", "GET " .. api .. "/v1/api_keys", "POST " .. api .. "/v1/api_keys", "POST " .. api .. "/v1/api_keys/01HZK/actions/rotate", "GET " .. api .. "/v2/secrets", "GET " .. api .. "/v2/users/01HZU/notification_methods", "GET " .. api .. "/v2/users/01HZU/paging_provider", "GET " .. api .. "/v1/ip_allowlists", "GET " .. api .. "/v2/incidents/%2e%2e", "GET " .. api .. "/v2/incidents/01HZINC/actions/edit", "GET " .. api .. "/v2/incidents/", "GET https://app.incident.io/api/incidents", "GET https://api.incident.io.example.com/v2/incidents", "GET http://api.incident.io/v2/incidents", "GET https://api.incident.io:8443/v2/incidents", }) end end end, }read_only.luau
return { scenario = {publisher = {}, config = {}, auth_method = "token", auth_config = {token = "fixture-token"}}, configure = function() requests = {} payload = "{}" http = {request = function(req) table.insert(requests, req) return fixture.operation({statusCode = 200, headers = {}, body = fixture.reader(payload)}) end} end, run = function(incidentio) local API = "https://api.incident.io" local NULL = json.decode("null") local function last() return requests[#requests] end local function got(target) local req = last() assert(req.method == "GET" and req.url == API .. target, req.method .. " " .. req.url) assert(req.body == nil and req.headers.Authorization == nil and req.headers.Accept[1] == "application/json" and req.headers["Content-Type"] == nil) assert(req.timeoutMs == 15000, "missing header wait") end local function rejected(fn, expected) local before = #requests local ok, err = pcall(fn) assert(not ok and string.find(tostring(err), expected, 1, true), "wrong validation error: " .. tostring(err)) assert(#requests == before, "invalid input reached incident.io") end local names = {} for name in incidentio do table.insert(names, name) end table.sort(names) assert(table.concat(names, ",") == "getAlert,getCatalogEntry,getFollowUp,getIdentity,getIncident,getSchedule,getUser,listAlerts,listCatalogEntries,listCatalogTypes,listCustomFieldOptions,listCustomFields,listFollowUps,listIncidentAlerts,listIncidentRoles,listIncidentStatuses,listIncidentTimelineItems,listIncidentTimestamps,listIncidentTypes,listIncidentUpdates,listIncidents,listScheduleEntries,listSchedules,listSeverities,listTeams,listUsers", "wrong read-only surface: " .. table.concat(names, ",")) assert(#requests == 0, "initialization reached incident.io") payload = '{"identity":{"name":"Houston","roles":["viewer","catalog_viewer"],"team_roles":[],"teams":[],"dashboard_url":"https://app.incident.io/acme"}}' assert(incidentio.getIdentity().identity.roles[2] == "catalog_viewer") got("/v1/identity") -- Incidents come back unchanged, nulls included, and filters become deep-object keys. payload = '{"incidents":[{"id":"01HZINC","reference":"INC-42","name":"Checkout down","summary":null,"call_url":null,' .. '"incident_status":{"id":"01HZST","name":"Investigating","category":"live"},"severity":{"id":"01HZSEV","name":"Major","rank":2},' .. '"incident_role_assignments":[{"role":{"id":"01HZLEAD","name":"Incident Lead","role_type":"lead"},"assignee":null}],' .. '"incident_timestamp_values":[{"incident_timestamp":{"id":"01HZTS","name":"Reported at","rank":1},"value":null}],' .. '"custom_field_entries":[]}],"pagination_meta":{"after":"01HZINC","page_size":2,"total_record_count":7}}' local opts = {status_category = {one_of = {"live", "triage"}}, severity = {gte = "01HZSEV"}, created_at = {date_range = "2026-10-01~2026-10-31"}, custom_field = {["01HZCF"] = {one_of = {"01HZOPT"}}}, incident_role = {["01HZLEAD"] = {one_of = {"01HZU"}}}, mode = {one_of = {"standard", "test"}}, filter_mode = "all", page_size = 2, after = "01HZPREV"} local page = incidentio.listIncidents(opts) got("/v2/incidents?status_category%5Bone_of%5D=live&status_category%5Bone_of%5D=triage&severity%5Bgte%5D=01HZSEV" .. "&incident_role%5B01HZLEAD%5D%5Bone_of%5D=01HZU&custom_field%5B01HZCF%5D%5Bone_of%5D=01HZOPT&mode%5Bone_of%5D=standard&mode%5Bone_of%5D=test" .. "&filter_mode=all&created_at%5Bdate_range%5D=2026-10-01~2026-10-31&page_size=2&after=01HZPREV") assert(opts.status_category.one_of[2] == "triage" and opts.page_size == 2, "caller options were modified") local incident = page.incidents[1] assert(incident.reference == "INC-42" and incident.summary == NULL and incident.call_url == NULL and incident.incident_role_assignments[1].assignee == NULL) assert(incident.incident_timestamp_values[1].value == NULL and json.encode(incident.custom_field_entries) == "[]" and page.pagination_meta.total_record_count == 7) -- The last page has no cursor; page_size defaults to incident.io's 25. payload = '{"incidents":[],"pagination_meta":{"page_size":25}}' page = incidentio.listIncidents({sort_by = "created_at_oldest_first", status = {not_in = "01HZST"}}) got("/v2/incidents?status%5Bnot_in%5D=01HZST&sort_by=created_at_oldest_first&page_size=25") assert(json.encode(page.incidents) == "[]" and page.pagination_meta.after == nil) payload = '{"incident":{"id":"01HZINC","reference":"INC-42"}}' assert(incidentio.getIncident({id = 42}).incident.id == "01HZINC") got("/v2/incidents/42") incidentio.getIncident({id = "01HZINC"}) got("/v2/incidents/01HZINC") payload = '{"incident_updates":[{"id":"01HZUP","incident_id":"01HZINC","message":"Rolled back","new_severity":null}],"pagination_meta":{"after":null,"page_size":25}}' local updates = incidentio.listIncidentUpdates({incident_id = "01HZINC"}) got("/v2/incident_updates?incident_id=01HZINC&page_size=25") assert(updates.incident_updates[1].new_severity == NULL and updates.pagination_meta.after == NULL) incidentio.listIncidentTimelineItems({incident_id = "01HZINC", page_size = 250, after = "01HZTL"}) got("/v2/incident_timeline_items?incident_id=01HZINC&page_size=250&after=01HZTL") incidentio.listIncidentAlerts({alert_id = "01HZAL", page_size = 50}) got("/v2/incident_alerts?alert_id=01HZAL&page_size=50") payload = '{"follow_ups":[{"id":"01HZFU","title":"Add alerting","assignee":null,"status":"outstanding"}],"pagination_meta":{"page_size":25}}' assert(incidentio.listFollowUps({incident_id = "01HZINC", incident_mode = "standard", updated_at = {gte = {"2026-10-01"}}}).follow_ups[1].assignee == NULL) got("/v3/follow_ups?incident_id=01HZINC&incident_mode=standard&updated_at%5Bgte%5D=2026-10-01&page_size=25") incidentio.getFollowUp({id = "01HZFU"}) got("/v3/follow_ups/01HZFU") payload = '{"alerts":[{"id":"01HZAL","title":"High error rate","status":"firing","resolved_at":null}],"pagination_meta":{"page_size":10}}' assert(incidentio.listAlerts({status = {one_of = {"firing"}}, tags = {one_of = {"known issue"}}, attributes = {["01HZAT"] = {one_of = {"api"}}}, page_size = 10}).alerts[1].resolved_at == NULL) got("/v2/alerts?status%5Bone_of%5D=firing&attributes%5B01HZAT%5D%5Bone_of%5D=api&tags%5Bone_of%5D=known%20issue&page_size=10") incidentio.getAlert({id = "01HZAL"}) got("/v2/alerts/01HZAL") -- Caller ids stay inside their encoded filter key. incidentio.listAlerts({attributes = {["a&b=c"] = {is = "x&y"}}, has_notes = {is = {"true"}}}) got("/v2/alerts?attributes%5Ba%26b%3Dc%5D%5Bis%5D=x%26y&has_notes%5Bis%5D=true&page_size=25") payload = '{"schedules":[{"id":"01HZSC","name":"Primary","current_shifts":[{"user":{"id":"01HZU","name":"Ada"},"start_at":"2026-10-30T09:00:00Z","end_at":"2026-10-31T09:00:00Z"}],"next_shifts":null}],"pagination_meta":{"page_size":25}}' local schedules = incidentio.listSchedules() got("/v2/schedules?page_size=25") assert(schedules.schedules[1].current_shifts[1].user.name == "Ada" and schedules.schedules[1].next_shifts == NULL) incidentio.getSchedule({id = "01HZSC"}) got("/v2/schedules/01HZSC") payload = '{"schedule_entries":{"final":[{"user":{"id":"01HZU"},"start_at":"2026-11-02T09:00:00Z","end_at":"2026-11-03T09:00:00Z"}],"scheduled":[],"overrides":[]},"pagination_meta":{"after":"opaque+cursor/1"}}' local rota = incidentio.listScheduleEntries({schedule_id = "01HZSC", entry_window_start = "2026-11-02T00:00:00Z", entry_window_end = "2026-11-09T00:00:00Z"}) got("/v2/schedule_entries?schedule_id=01HZSC&entry_window_start=2026-11-02T00%3A00%3A00Z&entry_window_end=2026-11-09T00%3A00%3A00Z") assert(rota.schedule_entries.final[1].user.id == "01HZU" and json.encode(rota.schedule_entries.overrides) == "[]") incidentio.listScheduleEntries({schedule_id = "01HZSC", entry_window_start = rota.pagination_meta.after, entry_window_end = "2026-11-09T00:00:00Z"}) got("/v2/schedule_entries?schedule_id=01HZSC&entry_window_start=opaque%2Bcursor%2F1&entry_window_end=2026-11-09T00%3A00%3A00Z") incidentio.listUsers({email = "[email protected]", include_inactive = true}) got("/v2/users?email=ada%40example.com&include_inactive=true&page_size=25") incidentio.getUser({id = "01HZU"}) got("/v2/users/01HZU") incidentio.listTeams({page_size = 100}) got("/v3/teams?page_size=100") for name, target in {listSeverities = "/v1/severities", listIncidentStatuses = "/v1/incident_statuses", listIncidentTypes = "/v1/incident_types", listIncidentRoles = "/v2/incident_roles", listIncidentTimestamps = "/v2/incident_timestamps", listCustomFields = "/v2/custom_fields", listCatalogTypes = "/v3/catalog_types"} do incidentio[name]() got(target) end incidentio.listCustomFieldOptions({custom_field_id = "01HZCF"}) got("/v1/custom_field_options?custom_field_id=01HZCF&page_size=25") payload = '{"catalog_entries":[{"id":"01HZCE","name":"checkout","external_id":null,"aliases":[],"attribute_values":{}}],"catalog_type":{"id":"01HZCT"},"pagination_meta":{"page_size":25}}' local entries = incidentio.listCatalogEntries({catalog_type_id = "01HZCT", identifier = "checkout"}) got("/v3/catalog_entries?catalog_type_id=01HZCT&identifier=checkout&page_size=25") assert(entries.catalog_entries[1].external_id == NULL and json.encode(entries.catalog_entries[1].aliases) == "[]") incidentio.getCatalogEntry({id = "01HZCE", expand = true}) got("/v3/catalog_entries/01HZCE?expand=true") assert(#requests == 30, tostring(#requests)) -- Writes are absent, and invalid input never reaches incident.io. assert(incidentio.createIncident == nil and incidentio.editIncident == nil and incidentio.createIncidentUpdate == nil and incidentio.createFollowUp == nil) rejected(function() incidentio.getIncident() end, "id is required") rejected(function() incidentio.getIncident({id = "../v1/api_keys"}) end, "id must be an incident.io id") rejected(function() incidentio.getIncident({id = 1.5}) end, "id must be a string") rejected(function() incidentio.getIncident({id = NULL}) end, "id is required") rejected(function() incidentio.listScheduleEntries({}) end, "schedule_id is required") rejected(function() incidentio.listCatalogEntries({identifier = "x"}) end, "catalog_type_id is required") rejected(function() incidentio.listIncidentTimelineItems() end, "incident_id is required") rejected(function() incidentio.listIncidents({page_size = 251}) end, "page_size must be a whole number from 1 to 250") rejected(function() incidentio.listIncidents({page_size = "10"}) end, "page_size must be a whole number") rejected(function() incidentio.listIncidents({status = {one_of = json.decode("[]")}}) end, "status must not be an empty array") rejected(function() incidentio.listIncidents({status = {one_of = {nested = {}}, [1] = "x"}}) end, "status must be") rejected(function() incidentio.listIncidents({status = "01HZST"}) end, "status must be an object such as {one_of={...}}") rejected(function() incidentio.listAlerts({has_notes = true}) end, "has_notes must be an object") rejected(function() incidentio.listIncidents({mode = {"test"}}) end, "mode must be an object") rejected(function() incidentio.listIncidents({custom_field = {["01HZCF][one_of"] = {one_of = {"x"}}}}) end, "without [ or ]") rejected(function() incidentio.listAlerts({attributes = {["01HZAT"] = {["is]"] = "x"}}}) end, "without [ or ]") rejected(function() incidentio.listAlerts({page_size = 51}) end, "page_size must be a whole number from 1 to 50") rejected(function() incidentio.listIncidentAlerts({page_size = 100}) end, "page_size must be a whole number from 1 to 50") rejected(function() incidentio.listIncidents({severity = {gte = {{"x"}}}}) end, "severity must be a string, boolean, number or array") rejected(function() incidentio.listIncidents({incident_id = "x"}) end, "listIncidents has no option incident_id") rejected(function() incidentio.listIncidents("live") end, "opts must be an object") end, }writes.luau
return { scenario = {publisher = {}, access = {data = "write"}, config = {}, auth_method = "token", auth_config = {token = "fixture-token"}}, configure = function() requests = {} status = 200 payload = "{}" http = {request = function(req) table.insert(requests, req) return fixture.operation({statusCode = status, headers = {}, body = fixture.reader(payload)}) end} end, run = function(incidentio) local API = "https://api.incident.io" local NULL = json.decode("null") local function sent(target, body) local req = requests[#requests] assert(req.method == "POST" and req.url == API .. target, req.method .. " " .. req.url) assert(req.headers.Authorization == nil and req.headers["Content-Type"][1] == "application/json" and req.headers.Accept[1] == "application/json") assert(json.encode(json.decode(req.body)) == json.encode(body), req.body) end local function rejected(fn, expected) local before = #requests local ok, err = pcall(fn) assert(not ok and string.find(tostring(err), expected, 1, true), "wrong validation error: " .. tostring(err)) assert(#requests == before, "invalid input reached incident.io") end local names = {} for name in incidentio do table.insert(names, name) end table.sort(names) assert(table.concat(names, ",") == "createFollowUp,createIncident,createIncidentUpdate,editIncident,getAlert,getCatalogEntry,getFollowUp,getIdentity,getIncident,getSchedule,getUser,listAlerts,listCatalogEntries,listCatalogTypes,listCustomFieldOptions,listCustomFields,listFollowUps,listIncidentAlerts,listIncidentRoles,listIncidentStatuses,listIncidentTimelineItems,listIncidentTimestamps,listIncidentTypes,listIncidentUpdates,listIncidents,listScheduleEntries,listSchedules,listSeverities,listTeams,listUsers", "wrong read-write surface: " .. table.concat(names, ",")) status, payload = 200, '{"incident":{"id":"01HZINC","reference":"INC-43","name":"Checkout down","summary":null,"mode":"standard"}}' local declared = {idempotency_key = "houston-checkout-2026-10-30", visibility = "public", name = "Checkout down", severity_id = "01HZSEV", incident_role_assignments = {{incident_role_id = "01HZLEAD", assignee = {email = "[email protected]"}}}, custom_field_entries = {{custom_field_id = "01HZCF", values = {{value_option_id = "01HZOPT"}}}}} local incident = incidentio.createIncident(declared).incident sent("/v2/incidents", declared) assert(incident.reference == "INC-43" and incident.summary == NULL) local retro = {idempotency_key = "import-7", visibility = "private", name = "Old outage", mode = "retrospective", retrospective_incident_options = {external_id = 7}, incident_timestamp_values = {{incident_timestamp_id = "01HZTS", value = "2026-01-02T03:04:05Z"}}} incidentio.createIncident(retro) sent("/v2/incidents", retro) status, payload = 200, '{"incident":{"id":"01HZINC","incident_status":{"category":"learning"}}}' local edit = {incident = {incident_status_id = "01HZRES", summary = "Rolled back the deploy"}, notify_incident_channel = false} assert(incidentio.editIncident({id = "01HZINC", incident = edit.incident, notify_incident_channel = false}).incident.incident_status.category == "learning") sent("/v2/incidents/01HZINC/actions/edit", edit) incidentio.editIncident({id = "01HZINC2", incident = {severity_id = "01HZSEV2"}, notify_incident_channel = true}) sent("/v2/incidents/01HZINC2/actions/edit", {incident = {severity_id = "01HZSEV2"}, notify_incident_channel = true}) -- An explicit null is sent as JSON null. incidentio.editIncident({id = "01HZINC", incident = {call_url = NULL}, notify_incident_channel = false}) assert(string.find(requests[#requests].body, '"incident":{"call_url":null}', 1, true), requests[#requests].body) status, payload = 201, '{"incident_update":{"id":"01HZUP","incident_id":"01HZINC","message":"Monitoring","new_severity":null}}' local update = {incident_id = "01HZINC", idempotency_key = "houston-update-1", message = "Monitoring the fix", to_incident_status_id = "01HZMON"} assert(incidentio.createIncidentUpdate(update).incident_update.new_severity == NULL) sent("/v2/incident_updates", update) status, payload = 201, '{"follow_up":{"id":"01HZFU","title":"Add a canary","status":"outstanding","assignee":null}}' local follow = {incident_id = "01HZINC", title = "Add a canary", description = "Gate deploys on **error rate**.", assignee_id = "01HZU", labels = {"deploys"}} assert(incidentio.createFollowUp(follow).follow_up.status == "outstanding") sent("/v3/follow_ups", follow) assert(#requests == 7) -- Required fields and unknown options fail before any request. rejected(function() incidentio.createIncident({visibility = "public", name = "x"}) end, "idempotency_key is required") rejected(function() incidentio.createIncident({idempotency_key = "k", name = "x"}) end, "visibility is required") rejected(function() incidentio.createIncident({idempotency_key = "k", visibility = "public", slack_channel_id = "C1"}) end, "createIncident has no option slack_channel_id") rejected(function() incidentio.editIncident({id = "01HZINC", incident = {name = "x"}}) end, "notify_incident_channel is required") rejected(function() incidentio.editIncident({incident = {name = "x"}, notify_incident_channel = false}) end, "id is required") rejected(function() incidentio.editIncident({id = "01HZINC/actions/merge", incident = {}, notify_incident_channel = false}) end, "id must be an incident.io id") rejected(function() incidentio.createIncidentUpdate({incident_id = "01HZINC", message = "x"}) end, "idempotency_key is required") rejected(function() incidentio.createFollowUp({incident_id = "01HZINC"}) end, "title is required") rejected(function() incidentio.createFollowUp({incident_id = "01HZINC", title = "x", status = "completed"}) end, "createFollowUp has no option status") end, }