Skip to content

Get script

GET https://rest.haasapi.com/v1/scripts/{script_id}

Returns one script in full: the list row’s fields plus the source text (plain, exactly as the editor shows it) and the last compile verdict.

Requires the read scope.

Terminal window
curl "https://rest.haasapi.com/v1/scripts/{script_id}" \
-H "Authorization: Bearer hk_live_YOUR_KEY"

200 OK. Returns a ScriptDetail.

{
"script_id": "31d13ffedae14ebda69871d28e8f1260",
"name": "Cypress Monaco Seed 1788034085413",
"description": "Auto-seeded by monaco-edit-save spec",
"type": "lua",
"is_valid": false,
"created_at": "2026-08-29T20:08:09Z",
"updated_at": "2026-08-29T20:08:23Z",
"source": "EnableHighSpeedUpdates(true)\n\nlocal mkt = PriceMarket()\n",
"compile": {
"is_valid": false,
"errors": [
{
"message": "Unknown reference: BalanceAmounttGARBAGE_NOT_A_REAL_FN",
"line": 9
}
]
}
}
Field Type Description
script_id string Script identifier - the id the script endpoints and POST /v1/bots accept.
name string User-chosen script name.
description string, nullable User-chosen description. null when the script has none.
type string Script kind: lua or visual.
is_valid boolean Whether the script’s last compile succeeded. Only valid scripts can run on a bot.
created_at string, nullable When the script was created, RFC 3339 UTC. null when unknown.
updated_at string, nullable When the script was last updated, RFC 3339 UTC. null when unknown.
source string The HaasScript source, as plain text.
compile ScriptCompile The verdict of the script’s last compile.
Field Type Description
is_valid boolean Whether the source compiled. Only valid scripts can run on a bot.
errors array of ScriptCompileError The compile errors; empty when the source compiled.
Field Type Description
message string What the compiler rejected - an unknown command, a syntax error, ….
line integer (int32), nullable 1-based line in the source the error points at. null when the compiler gave no position.

All errors are RFC 9457 problem documents.

Status Description
400 The request is malformed (invalid limit, unusable cursor, …). (code: invalid_request)
401 Missing, malformed, disabled, or revoked API key. (code: invalid_api_key)
404 No accessible script with that id. (code: script_not_found)
500 An unexpected error inside the API. Nothing about the request caused it; retry, and quote the instance value if it persists. (code: internal_error)
502 An internal service answered in a way the API could not serve. Retry. (code: upstream_error)
503 The request could not be served right now. Retry with the same key - do not discard it. (code: temporarily_unavailable)
504 An internal service did not answer within the deadline. Retry with backoff. (code: upstream_timeout)
{
"type": "https://docs.haasapi.com/errors/invalid_request",
"title": "Invalid request",
"status": 400,
"detail": "The request is malformed (invalid limit, unusable cursor, …).",
"code": "invalid_request"
}