Add a file to an AI SRE question
const url = 'https://app.tunnelhq.com/api/v1/ai-sre/attachments';const options = { method: 'POST', headers: { 'X-Project-Id': 'prj_12', 'X-File-Name': 'example', 'X-API-Key': '<X-API-Key>', 'Content-Type': 'application/octet-stream' }, body: 'binary'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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 binaryUploads 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.envorid_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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “ Parameters ”Header Parameters
Section titled “Header Parameters”The project, as prj_12 or 12. A workspace key can only reach its own workspace’s projects.
Example
prj_12The file’s name, URI-encoded.
Request Bodyrequired
Section titled “Request Bodyrequired”Responses
Section titled “ Responses ”The file is kept for your next question.
object
In bytes.
Pictures only.
Pictures only.
PDFs only.
Only when uploaded: something in the text file was hidden.
A VPN config or share link inside stays in TunnelHQ and isn’t sent to the AI provider.
In a conversation: its contents were deleted, after 30 days or by hand.
In a conversation, to a role that can edit monitors, while the contents are kept.
Example
{ "id": "att_91", "kind": "text", "name": "xray-error.log", "size": 18204, "stays_in_tunnelhq": false, "masked": true}Headers
Section titled “Headers”Requests the workspace’s plan allows per minute.
Requests left in the current minute.
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.
object
The HTTP status, repeated.
What went wrong.
More detail, on some errors.
Seconds to wait, on the 429 for wrong keys.
Example
{ "error": true}The API key is missing, wrong, expired, switched off, or no longer valid.
object
The HTTP status, repeated.
What went wrong.
More detail, on some errors.
Seconds to wait, on the 429 for wrong keys.
Examples
{ "error": true, "code": 401, "message": "API key is required. Provide X-API-Key header or Authorization: Bearer <key>"}{ "error": true, "code": 401, "message": "Invalid or expired API key"}{ "error": true, "code": 401, "message": "API key has expired"}{ "error": true, "code": 401, "message": "API key owner account is inactive"}{ "error": true, "code": 401, "message": "This API key's workspace access has been removed"}Your role can’t ask AI SRE, its closed beta doesn’t include you, or pictures and PDFs are off in the project.
object
The HTTP status, repeated.
What went wrong.
More detail, on some errors.
Seconds to wait, on the 429 for wrong keys.
Example
{ "error": true}The project’s 200 MB, or the workspace’s 1 GB, of kept files is full.
object
The HTTP status, repeated.
What went wrong.
More detail, on some errors.
Seconds to wait, on the 429 for wrong keys.
Example
{ "error": true}The file is over 10 MB, or a picture is over 8,000 pixels a side.
object
The HTTP status, repeated.
What went wrong.
More detail, on some errors.
Seconds to wait, on the 429 for wrong keys.
Example
{ "error": true}Not a picture (PNG, JPEG, GIF or WebP), a PDF or a text file, or one TunnelHQ can’t read.
object
The HTTP status, repeated.
What went wrong.
More detail, on some errors.
Seconds to wait, on the 429 for wrong keys.
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).
object
The HTTP status, repeated.
What went wrong.
More detail, on some errors.
Seconds to wait, on the 429 for wrong keys.
Example
{ "error": true}Something failed on TunnelHQ’s side.
object
The HTTP status, repeated.
What went wrong.
More detail, on some errors.
Seconds to wait, on the 429 for wrong keys.
Example
{ "error": true, "code": 500, "message": "Internal server error"}AI SRE isn’t available on this TunnelHQ server now.
object
The HTTP status, repeated.
What went wrong.
More detail, on some errors.
Seconds to wait, on the 429 for wrong keys.
Example
{ "error": true}