Skip to main content
The configuration API lets you read and change your organization’s setup over HTTP: data sources, SLOs, alert routes, teams, the status page and more. It is the same set of actions that the MCP tools offer, shaped as resources, so a script or a Terraform run can do what an MCP client does. Business plan Every request goes to https://sreagent.app/api/v1/config. The OpenAPI document for the configuration API is rendered in this documentation under the API reference group.

Authenticate

Send a credential as a Bearer token on every request.
1

Open the API keys tab

In Settings, open API Keys.
2

Generate a key

Select Generate API Key, enter a Key Name, tick the scopes the key needs, and select Generate Key.
3

Copy the key

The key is shown once. Copy it into your secret store before you dismiss the message. To stop a key working, select Revoke on its card.
Treat an API key like a password. Never commit it, and give each job its own key so you can revoke one without breaking the others.
You can also give a key an expiry, limit the addresses it may be used from, and see when it was last used. See API key expiry and allowed addresses.

Scopes

Each key carries the scopes you tick when you generate it. api:config_read is a key of its own: it cannot be combined with another scope. compliance:read opens only that download route, no MCP tool and no listing; see Download an export with an API key. The configuration API accepts only api:admin and api:config_read, and the MCP endpoint accepts only the mcp:* scopes, so a key for one endpoint is refused at the other.

Personal tokens

A personal access token authenticates as you instead of as an organization. Create one on your Account page, under Personal access tokens, with Create Token. You choose which organizations it can act in and, under Maximum role, a ceiling: Viewer (read only), Member (can operate), Org admin, or no limit. The ceiling can only reduce what you can do. Picking a level above your own role grants nothing. You can change where a token acts later without making a new one. On the Account page, select Edit organizations on the token, tick or untick organizations, and select Save organizations. The same token string reaches the new set on its next request. You can add only organizations where you are a member, never one where you are a guest, and a token must keep at least one organization. To remove them all, revoke the token. The maximum role is not changed by an edit. Tick Include organizations I create or join later when you create or edit a token if it should also reach organizations you add after making it, such as a new child organization. It is off by default. With it on, the token reaches every organization where you hold a membership at the moment of each request, still limited by the maximum role. Guest access is never included, and leaving an organization ends the token’s access to it at once. With it off, the token reaches only the organizations ticked on it, even if you join others. Every change to a token’s organizations is recorded in the audit log, under the organization you were working in and under each organization it added or removed. If you edit a token in two tabs, the second save is refused with a message and the editor shows the token’s current organizations, so an old form never undoes a newer change. A personal token can carry an expiry and never lasts longer than a year, and it shows when it was last used. Unlike a key, it has no list of allowed addresses. See API key expiry and allowed addresses. A personal token works on the MCP endpoint, where each tool needs a minimum role: viewer for read tools, member for write tools, org admin for admin tools. The configuration API refuses personal tokens, so use an api:admin or api:config_read key there.

Plan requirement

The configuration API and the MCP endpoint are part of the Business plan. On a lower plan the key form hides the MCP and API scopes, and a request from an existing key answers 403 with “The configuration API is not included in your plan.” (or “MCP server is not included in your plan.” on the MCP endpoint).

Read

GET /{resource} lists a collection and GET /{resource}/{id} reads one row. A setting that exists once per organization, such as organization_settings or slack, is read with GET /{resource} and has no id.
A list answers {"organization": ..., "data": [...], "truncated": false}. Lists are not paged. When truncated is true, the list was cut at its cap. Reading one row returns an ETag header that identifies the row’s current configuration.
Secrets are never returned. A field such as api_key is answered as api_key_set: true or false. organization_settings also answers the organization’s two-step sign-in requirement as mfa_required, mfa_grace_days and the computed mfa_effective, and the idle sign-out and key lifetime limits as session_idle_minutes, session_idle_effective and api_key_max_days. They are decided by a person: a write from an API key is refused, so the configuration API reads them and never changes them. organization_settings also answers and accepts language (en, the default, or es): the language of the outcome lines SRE Agent writes into a card’s Slack threads and of the sentence a fix request’s answer adds when the request will wait or run on SRE Agent’s runner (see Language of a card’s outcome lines). Unlike the fields above, an API key with api:admin may write it. It also answers and accepts slack_thread_events_off: the events an organization switched off in a card’s Slack threads, as the whole list (an empty list posts everything, which is the default). The names are listed under Choose which card events are posted, and a name outside that list is refused with a sentence that lists them. An API key with api:admin may write it. It also carries board_tile_reactions, whether board tiles show a card’s top reactions (see Reactions on the board). An organization admin sets it in the app, over MCP or with an API key that has api:admin. With Terraform (provider 0.5.0 or later), set board_tile_reactions on sreagent_organization_settings; a block that leaves it out leaves the setting as it is. It also carries board_column_emoji, the emoji shown before each board column’s name: an object that maps backlog, triage, todo, in_progress, blocked and done to one emoji each (a character or a Slack name in colons; null removes one), written as the whole set (see Column emoji). An API key with api:admin may write it. The Terraform provider does not manage it yet, so the exported file names it in a comment when it is set and never writes it. It carries looking_window_hours and reaction_meanings_off the same way (see Reactions that mean something). They are set in the app, over MCP or with an API key that has api:admin. With Terraform (provider 0.6.0 or later), set reaction_meanings_off (the meanings switched off; [] leaves all on) and looking_window_hours (4, 8, 24 or 72, or 0 for until the reaction is removed) on sreagent_organization_settings. The platform stores until the reaction is removed as no number, and the provider writes it as 0, which is never a real number of hours. A block that leaves either out leaves the setting as it is. Provider 0.7.0 lists all four meanings (looking, take_it, tell_author, which tells people about reactions to their cards and comments, and answer_feedback, which records a thumbs on an assistant answer as a rating) and adds board_column_emoji (a map of board column to emoji; it is the whole set, and {} removes every column emoji), slack_reaction_sync (both, from_slack or off) and slack_reaction_counts. If you adopted the settings under 0.6.0 and an admin switched tell_author or answer_feedback off in the app, add it to reaction_meanings_off when you upgrade: 0.7.0 shows a meaning your configuration does not name as removed, and applying would switch it back on. data.sreagent_organization_settings shows every value the platform holds, and data.sreagent_alert_follow_up_settings reads the follow-up switches. It also carries slack_reaction_sync (both, from_slack or off) and slack_reaction_counts (true or false), which choose how reactions on the Slack messages of a card travel between the card and Slack (see Reactions in a card’s Slack messages). An organization admin sets them in the app, over MCP or with an API key that has api:admin. The Terraform provider does not declare them yet.

Create

POST /{resource} creates a row and answers 201 with the new row, its ETag, and a Location header.
If a row already matches the resource’s natural key, the call answers 409 with the existing row, and nothing is overwritten.

Update

PUT /{resource}/{id} changes one row, and PUT /{resource} changes a once-per-organization setting. Only the fields you send change, and a missing row answers 404. Add If-Match with the ETag you last read, so a change made by someone else in the meantime is not overwritten.
If the row changed after that version, the call answers 412 with the current row, and nothing is written. Read the row again and retry against the new ETag. If-Match: * skips the version check. Without the header the write goes through unchecked.
The ETag follows the configuration you can set, not the last-modified time. Routine activity, such as a check recording a result, does not change it, so a plan and an apply an hour apart still match when nobody edited the configuration. The check runs just before the write and is not a lock.
A few changes ask you to preview first. PUT /github_child_access/<child-id>?account=<login> changes what a parent organization gives one child of one GitHub account (see What a child may use of the parent’s GitHub). A change that takes a repository away or switches context sharing off, sent without expected_fingerprint, answers 428 with the preview in the body and writes nothing. Send the same body with the preview’s fingerprint to write it. If what would move changed in between, the answer is 409 with a fresh preview. A change that takes nothing away answers 200 with the row. Terraform manages it as sreagent_github_child_access (see Manage GitHub accounts and child access with Terraform). github_accounts lists the GitHub accounts your organization connected, GET /github_accounts/<login or installation number> reads one and PUT on the same path changes its settings: the toggles and the review severity floor, the account being named by the path. It has no create and no delete, because connecting an account needs a person’s proof on GitHub and disconnecting is its own action. An unknown account answers 404. github_settings describes the account connected longest. With more than one connected account its read answers that account, a PUT with no account writes it, and its accounts answer lists every account. A child organization with accounts of its own reads and writes its own accounts the same way. See Connect more than one GitHub account.

Delete

DELETE /{resource}/{id} removes one row. The API confirms the deletion for you, so you do not send confirm. It accepts If-Match the same way as an update.

Manage GitHub accounts and child access with Terraform

Version 0.8.0 of the segfaultpw/sreagent provider adds two resources.
  • sreagent_github_account manages the settings of a GitHub account your organization connected: open fix pull requests automatically, revise a pull request when a review asks, open them as drafts, review pull requests, comment links on linked issues, “Auto-merge only what SRE Agent verified” and the lowest severity a review comments on.
  • sreagent_github_child_access manages what a parent organization gives one child organization of one of its GitHub accounts: all repositories, only the ones you name (up to 500), or none, and whether the child may use the parent’s context repository. Use it in the parent, one block for each child and account.
Neither resource connects an account or links a child: you do that in the app, so each resource adopts what exists. Creating one reads the row and writes only the difference, and a setting the block leaves out is left as it is. An account or child that does not exist is an error that says where to connect or link it. Destroying a resource leaves the row in place and changes nothing. To take access away from a child, state mode = "none" (or a narrower list), apply, and then remove the block. sreagent_github_settings manages the account connected longest and the context repository. Use sreagent_github_account for every other account. A block for the account connected longest would write the same row, so the plan warns about it, and the exported file never writes one. When that account is disconnected the next oldest takes its place, so a block for it then overlaps sreagent_github_settings and the plan warns on it: manage that account with sreagent_github_settings and remove the block. Taking repositories away from a child, or switching the context repository off for it, is applied only against a preview. terraform plan asks SRE Agent for it, writes nothing, and warns with what the child may use now and will use, the repositories it stops reaching and what is held on them: its open fix pull requests there stay open with one comment saying SRE Agent no longer manages them, auto-merge on them is turned off, and waiting requests and cards are named. Nothing is closed or deleted. The apply sends the plan’s fingerprint and fails without writing if what would move changed since the plan; plan again. Giving a child more is applied at once. The preview needs an api:admin key. A plan with a plan-only api:config_read key says it cannot take the preview, and the apply takes it and applies what it finds, so review the plan with an api:admin key first. State context_repo_shared on one block of a child only. SRE Agent holds one value for each child, so two blocks of one child that state different values change it on every apply. Import with terraform import sreagent_github_account.acme_labs acme-labs and terraform import sreagent_github_child_access.acme_labs_acme CHILD_ID?account=acme; the exported file carries these as import blocks. Name the child by its id: a block that names the same child another way, such as by its name, shows in the plan as a replacement that changes nothing on SRE Agent, because organization names are not unique. A GitHub account that is renamed on GitHub changes its login, so edit its block to the new login and import it again. Both resources need the GitHub integration in your plan, and the key’s organization must be the parent for sreagent_github_child_access. Provider 0.8.0 also reads data.sreagent_github_accounts, data.sreagent_github_child_access, data.sreagent_ticket_templates, data.sreagent_ticket_schedules, data.sreagent_board_rules and data.sreagent_lead_agent_settings, and adds account to data.sreagent_effective_repo_settings. It declares card_event_kinds and card_event_text on sreagent_outbound_config, good_events_query, total_events_query, threshold_good and unit on sreagent_sli, and board_summary_model_enabled on sreagent_organization_settings. A configuration written for version 0.7.0 plans nothing new under 0.8.0.

Export as Terraform

GET /export?format=hcl answers your organization’s configuration as one Terraform file, with an import block for every row. A stored secret appears only as a comment that points to the write-only argument that would manage it. The file requires version 0.8.0 or later of the segfaultpw/sreagent provider (terraform init names the version to install). A repository setting is written only where its entry sets it, and the settings an entry follows are named in follows_default, so applying the file pins nothing. An organization with repository defaults of its own gets a sreagent_repository_defaults block. With the infrastructure suite in your plan, the file also has a block and an import for your security SLA policy, security digest, code classes counted as security, each security notification rule and each secret allow rule. A severity with no SLA is written as info_days = 0 and a digest with no Slack channel as slack_channel = "", which is how the provider states them. An allow rule that has already ended is written as it is. Without the infrastructure suite the file has a comment for each of the five instead of a block. The code detection settings are not in the file, because Terraform reads them as a data source. The organization settings block states language, slack_thread_events_off, reaction_quick_row, board_tile_reactions (true and false alike), reaction_meanings_off ([] when both meanings are on; tell_author is left out and named in a comment) and looking_window_hours (0 for until the reaction is removed); each emoji of the quick row is written as an escape such as "\U0001F525", because the joiners and selectors inside an emoji are invisible in an editor. The GitHub settings block states auto_merge_requires_verification, and every repository entry and the repository defaults state auto_merge where they hold it. The file never writes confirm, so a file adopted with its import blocks plans nothing, and a block you add by hand that turns auto_merge on needs confirm = ["auto_merge"] for the apply that turns it on. An organization with more than one connected GitHub account gets a sreagent_github_account block for each account other than the one connected longest. A parent organization gets a sreagent_github_child_access block for each child and connected account, with the child’s context_repo_shared on its first block only. A child organization’s file holds its own accounts only and never names its parent’s. The ticket templates, ticket schedules, board rules and lead agent settings are not in the file either; read them with data.sreagent_ticket_templates, data.sreagent_ticket_schedules, data.sreagent_board_rules and data.sreagent_lead_agent_settings. The alert follow-up settings and the informative kinds are not in the file; read them with data.sreagent_alert_follow_up_settings and data.sreagent_alert_informative_kinds. The fix runner’s health is not in the file either; data.sreagent_fix_runner_health reads it (see When your runner’s AI provider keeps refusing). See Manage them with Terraform for the resources. The exported file pins >= 0.8.0, so run terraform init -upgrade when a lock file pins an older release. The file describes your organization at the moment you export it and is meant for adopting once. Do not replace a configuration you already manage with a new export: applying it in place of one that manages these resources deletes whatever the file does not list, so a rule or an allow rule missing from the new file is deleted from SRE Agent. Read every plan for 0 to destroy. The response also carries an x-sreagent-export-floor header with the provider version the file requires. Refuse a file whose header is missing or lower than the version you adopted with, because it comes from an older platform and leaves out what a newer release added.

Errors

Every failed request answers a JSON body with an error code and a message that says what to change.