Skip to content

Add a file to an AI SRE question

POST
/ai-sre/attachments
curl --request POST \
--url https://app.tunnelhq.com/api/v1/ai-sre/attachments \
--header 'Content-Type: application/octet-stream' \
--header 'X-API-Key: <X-API-Key>' \
--header 'X-File-Name: example' \
--header 'X-Project-Id: prj_12' \
--data binary

Uploads one file for your next question: the file’s bytes as the body, its name in X-File-Name. Then name its id in attachments when you ask. A file not sent within 24 hours is deleted.

  • A picture, a PDF of up to 20 pages, or a text file, told by its bytes, not its name. Up to 10 MB, and a picture up to 8,000 pixels a side. Pictures and PDFs only while the project allows them in AI SRE’s settings.
  • A text file is masked as a typed question is: keys, tokens and passwords are hidden, and only the masked copy is kept, its last 200 KB. A VPN config or share link inside stays in TunnelHQ and isn’t sent to the AI provider (stays_in_tunnelhq). A name that holds keys, such as .env or id_rsa, is refused.
  • A sent file’s contents are deleted after 30 days; its name stays in the conversation.
  • Up to 30 uploads an hour a person, 200 MB kept a project and 1 GB a workspace.

Needs a role that can mute and pause monitors, and AI SRE’s closed beta for the key’s person.

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
X-File-Name
required
string

The file’s name, URI-encoded.

Media typeapplication/octet-stream
string format: binary

The file is kept for your next question.

Media typeapplication/json
object
id
required
string
kind
required
string
Allowed values: image pdf text
name
required
string
size
required

In bytes.

integer
width

Pictures only.

integer
height

Pictures only.

integer
pages

PDFs only.

integer
masked

Only when uploaded: something in the text file was hidden.

boolean
stays_in_tunnelhq

A VPN config or share link inside stays in TunnelHQ and isn’t sent to the AI provider.

boolean
removed

In a conversation: its contents were deleted, after 30 days or by hand.

boolean
download_url

In a conversation, to a role that can edit monitors, while the contents are kept.

string
Example
{
"id": "att_91",
"kind": "text",
"name": "xray-error.log",
"size": 18204,
"stays_in_tunnelhq": false,
"masked": true
}
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 file was refused; details.reason says why, such as a name that holds keys, a PDF over 20 pages, an encrypted PDF, or a text file the masking couldn’t clear.

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
}

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>"
}

Your role can’t ask AI SRE, its closed beta doesn’t include you, or pictures and PDFs are off in the 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
Example
{
"error": true
}

The project’s 200 MB, or the workspace’s 1 GB, of kept files is full.

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
}

The file is over 10 MB, or a picture is over 8,000 pixels a 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
}

Not a picture (PNG, JPEG, GIF or WebP), a PDF or a text file, or one TunnelHQ can’t read.

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": 415,
"message": "TunnelHQ can't read .exe files. Send a picture, a PDF or a text file.",
"details": {
"reason": "wrong_type"
}
}

Too many uploads: 30 an hour, or 2 at once (details.reason: rate_limited), or no AI SRE answers left this month (limit_reached).

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
}

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"
}

AI SRE isn’t available on this TunnelHQ server 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
Example
{
"error": true
}