{"openapi":"3.1.0","info":{"title":"Heta Compiler API","version":"0.3.0","description":"API for interacting with the Heta Compiler via HTTP."},"servers":[{"url":"https://heta-api.insysbio.com","description":"Main server for Heta API"}],"paths":{"/build":{"post":{"operationId":"buildPlatform","summary":"Build or validate a Heta platform","description":"Validate or compile a Heta modeling platform from supplied files. By default, index.heta is the entry point. Set declaration.export to request files in specific formats. The response includes compilation logs, generated files, and temporary download information, including diagnostics when compilation fails.","parameters":[{"name":"utm_source","in":"query","required":false,"description":"Optional traffic source for request logging; does not affect compilation.","schema":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[a-zA-Z0-9._-]+$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"Files and optional compiler settings for one remote build. Supply every source file referenced by the entry point. The JSON request body is limited to 25 MiB; at most 32 input files, 5 MiB per file, and 10 MiB total input file content are accepted.","required":["inputFiles"],"properties":{"lifetime":{"type":"number","minimum":0,"default":3600,"description":"Seconds to retain the build files and ZIP download. Defaults to 3600 (one hour). Set to 0 to delete them immediately after the response."},"inputFiles":{"type":"array","description":"Source files for this platform. Include index.heta unless declaration.importModule.source names another entry point, and include any files it imports. Supported text extensions: .heta, .json, .yaml, .yml, .xml, .sbml, .csv, .tsv, .txt. XLSX files use binary encoding. At most 32 files are accepted.","minItems":1,"items":{"$ref":"#/components/schemas/File"},"example":[{"filepath":"index.heta","format":"utf8","filebody":"include model.heta;\n\n"}]},"declaration":{"type":"object","description":"Compiler configuration in the same form as platform.yml. Omit it to use compiler defaults, including index.heta as the entry point.","properties":{"importModule":{"type":"object","description":"Entry point for the model. Omit to read index.heta as Heta source.","required":["source"],"properties":{"source":{"type":"string","description":"Path of the entry point file, relative to the platform root. Include this path in inputFiles. Defaults to index.heta.","default":"index.heta","example":"src/index.heta"},"type":{"type":"string","enum":["heta","table","xlsx","json","yaml","sbml"],"description":"Source format of the entry point file. Defaults to heta.","default":"heta","example":"json"}}},"options":{"type":"object","description":"Optional compiler settings. This service applies unitsCheck and distDir; other option keys are accepted for declaration compatibility but ignored during compilation.","properties":{"unitsCheck":{"type":"boolean","default":false,"description":"Check unit consistency in the platform when true. Defaults to false."},"distDir":{"type":"string","description":"Directory for generated export files inside the build directory. Use a relative path without .. segments; absolute paths are rejected. Defaults to dist.","default":"dist"}},"additionalProperties":true},"export":{"$ref":"#/components/schemas/Export"}}}},"example":{"lifetime":1800,"inputFiles":[{"filepath":"index.heta","format":"utf8","filebody":"x1 @Record := 1.2;\n\nc1 @Compartment .= 5;"}],"declaration":{"importModule":{"source":"index.heta","type":"heta"},"options":{"unitsCheck":true,"distDir":"dist"},"export":[{"format":"JSON"},{"format":"YAML"},{"format":"DBSolve","version":"25"},{"format":"SBML","version":"L3V2"},{"format":"Simbio"},{"format":"Mrgsolve"},{"format":"Table","splitByClass":true,"omitRows":3,"bookType":"xlsx"},{"format":"Matlab"},{"format":"Dot"},{"format":"Summary"}]}}}}}},"responses":{"200":{"description":"Compilation finished.","content":{"application/json":{"schema":{"type":"object","description":"Result of one build. Inspect logs for diagnostics; outputFiles contains generated file contents, downloadLink provides a ZIP archive, and filesLink provides access to individual files.","required":["outputFiles","logs","taskId","lifeend","downloadLink","filesLink"],"properties":{"outputFiles":{"type":"array","description":"Generated export files. Each item includes its path and content. The platform declaration remains in the downloadable ZIP but is not included in this array.","items":{"$ref":"#/components/schemas/File"}},"logs":{"type":"array","description":"Compiler log messages and diagnostics. Inspect these even when the request succeeds.","items":{"type":"string"}},"taskId":{"type":"string","description":"Identifier of this build, used in the download URL.","example":"5f7b1b7b-0b7b-4b7b-8b7b-0b7b7b7b7b7b"},"lifeend":{"type":"number","description":"Unix timestamp in seconds when retained files are scheduled for deletion.","example":1634025600},"downloadLink":{"type":"string","description":"Temporary ZIP download URL for the build files. Resolve relative URLs against the API base URL. Unavailable after lifeend or when lifetime is 0.","example":"/download/5f7b1b7b-0b7b-4b7b-8b7b-0b7b7b7b7b7b"},"filesLink":{"type":"string","description":"Temporary URL for accessing generated files individually. Resolve relative URLs against the API base URL. Unavailable after lifeend or when lifetime is 0.","example":"/files/5f7b1b7b-0b7b-4b7b-8b7b-0b7b7b7b7b7b"}},"additionalProperties":false,"example":{"outputFiles":[{"filepath":"dist/output.heta.json","format":"binary","filebody":"..."}],"logs":["Compilation OK!"],"taskId":"5f7b1b7b-0b7b-4b7b-8b7b-0b7b7b7b7b7b","lifeend":1634025600,"downloadLink":"/download/5f7b1b7b-0b7b-4b7b-8b7b-0b7b7b7b7b7b","filesLink":"/files/5f7b1b7b-0b7b-4b7b-8b7b-0b7b7b7b7b7b"}}}}},"400":{"description":"Invalid request parameters. Request structure do not match the schema. Issues with user's API request.","content":{"application/json":{"schema":{"type":"object","required":["name","message"],"properties":{"name":{"type":"string","example":"ValidationError"},"message":{"type":"string","example":"Wrong format of export option."}},"additionalProperties":false}}}},"413":{"description":"Request body, file count, or input file content exceeds a configured limit.","content":{"application/json":{"schema":{"type":"object","required":["name","message"],"properties":{"name":{"type":"string","example":"Payload Too Large"},"message":{"type":"string","example":"inputFiles[0].filebody exceeds the 5 MiB file limit."}},"additionalProperties":false}}}},"422":{"description":"Unprocessable entity. The request is well-formed but unable to process. Compilation finished but with errors. This is usually because of platform files misconfiguration not related to the compiler or API.","content":{"application/json":{"schema":{"type":"object","properties":{"outputFiles":{"type":"array","description":"Array of the generated files.","items":{"$ref":"#/components/schemas/File"}},"logs":{"type":"array","description":"Array of log messages.","items":{"type":"string"}},"taskId":{"type":"string","description":"Task ID for getting files in UIDs format.","example":"5f7b1b7b-0b7b-4b7b-8b7b-0b7b7b7b7b7b"},"lifeend":{"type":"number","description":"Time when files will be deleted in Unix timestamp seconds format.","example":1634025600},"downloadLink":{"type":"string","description":"Link for downloading a ZIP file with all generated files.","example":"/download/5f7b1b7b-0b7b-4b7b-8b7b-0b7b7b7b7b7b"},"filesLink":{"type":"string","description":"Temporary URL for accessing generated files individually.","example":"/files/5f7b1b7b-0b7b-4b7b-8b7b-0b7b7b7b7b7b"}}}}}},"500":{"description":"Internal server error. Some critical error occurred during compilation. Problem with heta-compiler or api application development.","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string","example":"Internal server error."}},"additionalProperties":false}}}}}}},"/download/{taskId}":{"get":{"operationId":"downloadFile","x-eov-allow-unknown-query-parameters":true,"summary":"Download file","description":"Download a ZIP file associated with a whole content of the build platform.","parameters":[{"name":"taskId","in":"path","required":true,"description":"UUID version 4 task ID from the POST /build response.","schema":{"type":"string","format":"uuid","example":"9cc63441-a35c-4e41-b62c-505532fd79a6"}}],"responses":{"200":{"description":"File is ready for download.","content":{"application/zip":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Invalid task ID."},"404":{"description":"File is not found.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"File is not found."}}}}}},"500":{"description":"Internal server error. Problem in api application developed.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Unknown error."}}}}}}}}},"/info":{"get":{"operationId":"getInfo","x-eov-allow-unknown-query-parameters":true,"summary":"Get Heta API environment info","description":"Check that Heta API is reachable and return the Heta compiler and Node.js versions used by the server, along with the OpenAPI schema path. No arguments are required.","responses":{"200":{"description":"Information about the Heta Compiler.","content":{"application/json":{"schema":{"type":"object","required":["description","version","node","schema"],"properties":{"description":{"type":"string","description":"Short description of the API service.","example":"API connector for Heta compiler"},"version":{"type":"string","description":"Version of Heta compiler installed on the server.","example":"0.12.2"},"node":{"type":"string","description":"Version of the Node.js runtime used by the server.","example":"v20.0.0"},"schema":{"type":"string","description":"Path to the OpenAPI schema for Heta API.","example":"/schema"}},"additionalProperties":false}}}}}}},"/schema":{"get":{"operationId":"getSchema","x-eov-allow-unknown-query-parameters":true,"description":"Get the OpenAPI schema for the Heta Compiler API.","responses":{"200":{"description":"OpenAPI schema for the Heta Compiler API.","content":{"application/json":{"schema":{"type":"object","properties":{"openapi":{"type":"string","example":"3.1.0"}}}}}}}}}},"components":{"schemas":{"Export":{"type":"array","default":[],"description":"Export formats requested by the caller after validation. Omit or leave empty when no specific format is requested.","items":{"type":"object","required":["format"],"properties":{"format":{"type":"string","enum":["JSON","YAML","DBSolve","SBML","Simbio","Mrgsolve","Table","XLSX","Julia","Matlab","Dot","Summary","Canonical","HetaCode","Dynms"],"description":"Output format to generate. Use one of the listed names with the shown capitalization."},"filepath":{"type":"string","description":"Relative base output path within declaration.options.distDir (default: dist). Absolute paths and .. segments are rejected. The exporter appends format-specific filenames; for example, subdir/sbml_models produces dist/subdir/sbml_models/<namespace>.xml. Omit to use the format's default path.","example":"subdir/sbml_models"},"spaceFilter":{"type":"string","description":"Regular expression selecting namespaces to export. Omit to export all applicable namespaces.","example":"^one|two$"},"omit":{"type":"array","description":"Property paths to omit from JSON, YAML, or Table output.","items":{"type":"string"},"example":["notes","tags"]},"noUnitsExpr":{"type":"boolean","description":"For JSON and YAML exports, write units as Unit arrays when true; otherwise use UnitsExpr."},"powTransform":{"type":"string","enum":["keep","operator","function"],"description":"How to represent exponentiation in DBSolve output."},"version":{"type":"string","enum":["25","26","L2V3","L2V4","L2V5","L3V1","L3V2"],"description":"Target format version for DBSolve or SBML output. Choose a version supported by the selected format."},"eventsOff":{"type":"boolean","description":"Exclude switchers from exported DBSolve events when true."},"groupConstBy":{"type":"string","description":"JSON path used to group constants in the Initial Values section of DBSolve output.","example":"tags[0]"},"auxAsNotes":{"type":"boolean","description":"Append auxiliary content as a JSON object in Simbio Notes when true."},"omitRows":{"type":"number","description":"Number of empty rows to add to Table or XLSX output sheets.","example":3},"bookType":{"type":"string","enum":["xlsx","xlsm","xlsb","biff8","wk3","csv","txt","sylk","biff5","biff4","biff3","biff2","html","dif","dbf","wk1","xlml","ods","fods","rtf","prn","eth"],"description":"Workbook or text file type for Table output."},"splitByClass":{"type":"boolean","description":"Write each component class to a separate sheet or file in Table and XLSX exports when true."}}}},"File":{"type":"object","required":["filepath","filebody"],"additionalProperties":false,"properties":{"filepath":{"type":"string","description":"File path relative to the platform root. For input files, include the entry point and all imported files. Absolute paths and .. segments are rejected."},"format":{"type":"string","enum":["binary","utf8"],"default":"utf8","description":"Encoding of filebody: utf8 for text or binary for an XLSX binary string. Defaults to utf8 for input files."},"filebody":{"type":"string","description":"File contents as a string in the encoding named by format. Each input file is limited to 5 MiB; all input file contents together are limited to 10 MiB."}}}}}}