Optionaloptions: AnalysisEndpointCallOptionsA Run user or analysis token needs Analysis / Call Endpoint in Access Management.
const response = await Resources.analysis.callEndpoint("analysis-id-123", {
method: "POST",
path: "/orders",
query: { dry_run: true },
body: { item: "sensor" },
});
console.log(response.status, response.body); // 200 { ok: true }
Creates a new analysis in your application.
https://help.tago.io/portal/en/kb/articles/120-creating-analysis Creating Analysis
If receive an error "Authorization Denied", check policy Analysis / Create in Access Management.
const newAnalysis = await Resources.analysis.create({
name: "My Analysis",
runtime: "node-rt2025",
tags: [{ key: "type", value: "data-processing" }]
});
console.log(newAnalysis.id, newAnalysis.token); // analysis-id-123, analysis-token-123
Deletes an analysis from your application.
Gets a download URL for the analysis script.
Optionaloptions: { version?: number }Modifies an existing analysis.
If receive an error "Authorization Denied", check policy Analysis / Create in Access Management.
const result = await Resources.analysis.edit("analysis-id-123", {
name: "Updated Analysis",
active: false
});
console.log(result); // Successfully Updated
// Turn on the HTTP Endpoint of a Luau analysis (a partial `endpoint` is merged into the stored one)
await Resources.analysis.edit("analysis-id-123", { endpoint: { active: true, access: "public" } });
Get the raw source code content of a specific snippet file. Fetches the actual code content from the TagoIO snippets repository.
The runtime environment the snippet belongs to
The filename of the snippet to retrieve
Promise resolving to the raw file content as string
// Get TypeScript code for console example
const code = await Resources.analysis.getSnippetFile("deno-rt2025", "console.ts");
console.log(code);
// Get Python code for data processing
const pythonCode = await Resources.analysis.getSnippetFile("python-rt2025", "avg-min-max.py");
console.log(pythonCode);
Retrieves detailed information about a specific analysis.
Lists all analyses from the application with pagination support. Use this to retrieve and manage analyses in your application.
OptionalqueryObj: TLists the analyses with an active Endpoint that the token may call: all of them for a profile token, and the
ones granted by Access Management (call_endpoint) for a Run user or analysis token.
Get all available snippets for a specific runtime environment. Fetches analysis code snippets from the public TagoIO snippets repository.
The runtime environment to get snippets for
Promise resolving to the snippets metadata
Executes an analysis with optional scope parameters.
OptionalscopeObj: Record<string, any>Generates a new token for the analysis.
Uploads a script file to an analysis.
Calls the Endpoint of a Luau analysis (
{API_URL}/endpoint/{id}/{path}) with the module token. Unlike the other methods, a non-2xx answer is returned, not thrown: the Endpoint's code decides its status. The request is sent once (no retries) and redirects are never followed: the 3xx answer is returned as is (browsers hide it behindstatus: 0). The body is parsed when the response is JSON, otherwise it is text.