Skip to content

Ask AI SRE

POST
/ai-sre/ask
curl --request POST \
--url https://app.tunnelhq.com/api/v1/ai-sre/ask \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <X-API-Key>' \
--header 'X-Project-Id: prj_12' \
--data '{ "question": "Why did it go down?", "incident_id": "inc_418" }'

Starts a new AI SRE conversation with your question, and answers at once with its id. AI SRE runs its own checks, which takes from a few seconds to a few minutes. Read the answer with Get an AI SRE conversation, and read it again while running is true.

  • Each answer counts toward the project’s monthly limit. A project has up to 3 answers being written at once.
  • AI SRE changes nothing through the API. A change it suggests comes back with a link, and a person signed in to the dashboard approves it there. No route approves a change.
  • Needs a role that can mute and pause monitors (Owner, Admin, and Manager by default). The key’s own person is the one who asked.

Need an API key? See Getting an API key.

X-Project-Id
required
string

The project, as prj_12 or 12. A workspace key can only reach its own workspace’s projects.

Example
prj_12
Media typeapplication/json
object
question
required

The question, in plain words. A pasted list of servers fits whole.

string
>= 1 characters <= 20000 characters
monitor_id

The tunnel or check the question is about, as srv_81 or 81.

string
attachments

Files for this question, from Add a file to an AI SRE question, as att_91. Your own files, not yet sent. Up to 5, and 40 PDF pages across them.

Array<string>
<= 5 items
incident_id

The incident the question is about, as inc_418 or 418. The answer is kept with the incident, so asking about it again opens the same conversation, as Investigate does in the dashboard.

string
Example
{
"question": "Why did it go down?",
"incident_id": "inc_418"
}

The conversation is started, and its answer is being written.

Media typeapplication/json
object
id
required

The conversation.

integer
running
required
boolean
url
required

The conversation’s page in the dashboard.

string
Example
{
"id": 54,
"running": true,
"url": "https://app.tunnelhq.com/ai-sre/c/54"
}
X-RateLimit-Limit
integer

Requests the workspace’s plan allows per minute.

X-RateLimit-Remaining
integer

Requests left in the current minute.

X-RateLimit-Reset
integer

Unix time, in seconds, when the current minute ends.

The question is empty or too long, the monitor isn’t in the project, or the X-Project-Id header is missing or malformed.

Media typeapplication/json
object
error
required
boolean
code
required

The HTTP status, repeated.

integer
message
required

What went wrong.

string
details

More detail, on some errors.

retry_after

Seconds to wait, on the 429 for wrong keys.

integer
Examples
{
"error": true,
"code": 400,
"message": "Write a question first."
}

The API key is missing, wrong, expired, switched off, or no longer valid.

Media typeapplication/json
object
error
required
boolean
code
required

The HTTP status, repeated.

integer
message
required

What went wrong.

string
details

More detail, on some errors.

retry_after

Seconds to wait, on the 429 for wrong keys.

integer
Examples
{
"error": true,
"code": 401,
"message": "API key is required. Provide X-API-Key header or Authorization: Bearer <key>"
}

The role can’t mute and pause monitors, which asking AI SRE needs, or the key can’t reach this project.

Media typeapplication/json
object
error
required
boolean
code
required

The HTTP status, repeated.

integer
message
required

What went wrong.

string
details

More detail, on some errors.

retry_after

Seconds to wait, on the 429 for wrong keys.

integer
Examples
{
"error": true,
"code": 403,
"message": "Asking AI SRE needs a role that can mute and pause monitors."
}

The project has used its answers for the month, already has 3 answers being written, or a usage limit was reached (see the other operations’ 429).

Media typeapplication/json
object
error
required
boolean
code
required

The HTTP status, repeated.

integer
message
required

What went wrong.

string
details

More detail, on some errors.

retry_after

Seconds to wait, on the 429 for wrong keys.

integer
Examples
{
"error": true,
"code": 429,
"message": "This project has used all its AI SRE answers for this month. An owner can raise the limit in AI SRE settings."
}

Something failed on TunnelHQ’s side.

Media typeapplication/json
object
error
required
boolean
code
required

The HTTP status, repeated.

integer
message
required

What went wrong.

string
details

More detail, on some errors.

retry_after

Seconds to wait, on the 429 for wrong keys.

integer
Example
{
"error": true,
"code": 500,
"message": "Internal server error"
}

This TunnelHQ server can’t run AI SRE now.

Media typeapplication/json
object
error
required
boolean
code
required

The HTTP status, repeated.

integer
message
required

What went wrong.

string
details

More detail, on some errors.

retry_after

Seconds to wait, on the 429 for wrong keys.

integer
Examples
{
"error": true,
"code": 503,
"message": "AI SRE is switched off on this server."
}