Retrieves a canvas by its ID, version ID, or application ID. Validates input and output schemas if provided via schema builder functions.
// Get canvas by ID with schemas
const canvas = await tela.canvas.get({
id: 'canvas-id',
input: schema => schema.object({
query: schema.string()
}),
output: schema => schema.object({
response: schema.string()
})
});
// Get canvas by application ID
const canvas = await tela.canvas.get({
applicationId: 'app-id'
});
// Execute the canvas
const execution = await canvas.execute({ query: 'Hello' });
const result = await execution.result;
Creates a new TelaFile instance from the provided file input.
StaticAPIThrown when an API request fails.
StaticAuthenticationThrown when authentication fails (e.g., invalid API key).
StaticAuthorizationThrown when the authenticated user doesn't have permission for the requested operation.
StaticBadThrown when the API returns a 400 Bad Request error.
StaticConflictThrown when both an API key and a JWT are provided.
StaticConflictThrown when there's a conflict with the current state of the resource.
StaticConnectionThrown when there's a network connection error.
StaticConnectionThrown when a request times out.
StaticDEFAULT_StaticEmptyThrown when attempting to upload an empty file.
StaticExecutionThrown when a canvas execution fails on the server.
StaticFileThrown when there's an error during file upload.
StaticInternalThrown when an unexpected server error occurs.
StaticInvalidThrown when an invalid file URL is provided.
StaticMissingThrown when neither an API key nor a JWT is provided.
StaticNotThrown when the requested resource is not found.
StaticRateThrown when the API rate limit is exceeded.
StaticTaskThrown when a workstation task fails on the server.
StaticTelaStaticUnprocessableThrown when the request is well-formed but unable to be processed due to semantic errors.
StaticUserThrown when a request is aborted by the user.
ProtectedbuildProtectedbuildProtectedcreateOptionalopts: Record<string, string>ProtectedgetProtectedgetProtectedstringify
The main class for interacting with the Tela API.
Provides methods to access various Tela API resources.
Example