Not able to recognize why the RevitCloud APS automation Api failing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to do a POC , where basically I wanted to extract construction details from architechtural revit drawings using the Revit automation apis, was currently using the free tier before moving to the standard plan.
I had completed all the process from creating app, getting client id and screct, uploading the file to OSS, wrote a script in C# to fetch details from the revit drawing converted it to dll and used the official apis , when polling for response I get inprocess, but after thatIget a failed response.
Problem is I am notable to get why the code failed, as the api response is not why the code failed.
Please provide whats wrong in the approach .
The python code I used
def run_full_pipeline(input_url: str, output_url: str):
token = get_token()
headers = {"Authorization": f"Bearer {token}"}
r = requests.post(f"{APS_BASE}/da/us-east/v3/appbundles",
headers=headers,
json={"id": BUNDLE_NAME, "engine": "Autodesk.Revit+2026"})
print("BUNDLE CREATE:", r.status_code, r.text)
data = r.json()
upload_params = data["uploadParameters"]
with open(ZIP_PATH, "rb") as f:
r = requests.post(upload_params["endpointURL"], data=upload_params["formData"], files={"file": f})
print("ZIP UPLOAD:", r.status_code)
r = requests.post(f"{APS_BASE}/da/us-east/v3/appbundles/{BUNDLE_NAME}/aliases",
headers=headers,
json={"id": "prod", "version": 1})
print("BUNDLE ALIAS:", r.status_code, r.text)
r = requests.post(f"{APS_BASE}/da/us-east/v3/activities",
headers=headers,
json={
"id": ACTIVITY_NAME,
"engine": "Autodesk.Revit+2026",
"appbundles": [f"{NICKNAME}.{BUNDLE_NAME}+prod"],
"commandLine": [f"$(engine.path)\\revitcoreconsole.exe /i \"$(args[inputFile].path)\" /al \"$(appbundles[{BUNDLE_NAME}].path)\""],
"parameters": {
"inputFile": {"verb": "get", "localName": "building.rvt", "required": True},
"result": {"verb": "put", "required": True, "localName": "output.json"},
"appLog": {"verb": "put", "localName": "app_log.txt"},
"failureLog": {"verb": "put", "localName": "failure_log.txt"}
}
})
print("ACTIVITY:", r.status_code, r.text)
r = requests.post(f"{APS_BASE}/da/us-east/v3/activities/{ACTIVITY_NAME}/aliases",
headers=headers,
json={"id": "prod", "version": 1})
print("ACTIVITY ALIAS:", r.status_code, r.text)
app_log_upload_url, app_log_upload_key = generate_signed_url(object_key="app_log.txt")
failure_log_upload_url, failure_log_upload_key = generate_signed_url(object_key="failure_log.txt")
r = requests.post(f"{APS_BASE}/da/us-east/v3/workitems",
headers=headers,
json={
"activityId": f"{NICKNAME}.{ACTIVITY_NAME}+prod",
"arguments": {
"inputFile": {"url": input_url, "verb": "get"},
"result": {"url": output_url, "verb": "put"},
"appLog": {"url": app_log_upload_url, "verb": "put"},
"failureLog": {"url": failure_log_upload_url, "verb": "put"}
}
})
data = r.json()
print("WORKITEM:", data)
if "id" not in data:
raise Exception(f"WorkItem failed to start: {data}")
workitem_id = data["id"]
while True:
r = requests.get(f"{APS_BASE}/da/us-east/v3/workitems/{workitem_id}", headers=headers)
status = r.json()
print(f"Status: {status['status']}")
if status["status"] == "success":
break
elif status["status"] in ("failed", "cancelled", "failedDownload", "failedInstructions"):
if status.get("reportUrl"):
report = requests.get(status["reportUrl"])
print("REPORT:\n", report.text[-5000:])
raise Exception(f"APS job {status['status']}")
time.sleep(5)
try:
finalize_upload(app_log_upload_key, object_key="app_log.txt", token=token)
except Exception as e:
print(f"Warning: could not finalize app_log: {e}")
try:
finalize_upload(failure_log_upload_key, object_key="failure_log.txt", token=token)
except Exception as e:
print(f"Warning: could not finalize failure_log: {e}")
try:
app_log_download_url = generate_signed_download_url(object_key="app_log.txt", token=token)
app_log_content = requests.get(app_log_download_url).text
except Exception as e:
app_log_content = f"(not available: {e})"
try:
failure_log_download_url = generate_signed_download_url(object_key="failure_log.txt", token=token)
failure_log_content = requests.get(failure_log_download_url).text
except Exception as e:
failure_log_content = f"(not available: {e})"
print("APP LOG:\n", app_log_content)
print("FAILURE LOG:\n", failure_log_content)
result = requests.get(output_url).json()
return {"status": status, "result": result, "app_log": app_log_content, "failure_log": failure_log_content}
print(run_full_pipeline(input_url="",
output_url=""))
The C# code whose dll I am using and uploading its Zip
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using Autodesk.Revit.DB;
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.UI;
using DesignAutomationFramework;
using Autodesk.Revit.DB.Events;
public class AppBundle : IExternalDBApplication
{
public ExternalDBApplicationResult OnStartup(ControlledApplication app)
{
DesignAutomationBridge.DesignAutomationReadyEvent += OnReady;
return ExternalDBApplicationResult.Succeeded;
}
public ExternalDBApplicationResult OnShutdown(ControlledApplication app)
{
return ExternalDBApplicationResult.Succeeded;
}
private void OnReady(object sender, DesignAutomationReadyEventArgs e)
{
try
{
var app = e.DesignAutomationData.RevitApp;
app.FailuresProcessing += OnFailuresProcessing;
Log("Started execution");
// (Optional) Access document
var doc = e.DesignAutomationData.RevitDoc;
Log($"Document title: {doc.Title}");
Log("Running custom logic...");
// Example: count walls
var walls = new FilteredElementCollector(doc)
.OfClass(typeof(Wall))
.ToElements();
Log($"Walls count: {walls.Count}");
// Write result file (IMPORTANT)
File.WriteAllText("output.json", $"{{\"walls\": {walls.Count}}}");
e.Succeeded = true;
}
catch (Exception ex)
{
Log("EXCEPTION:");
Log(ex.ToString());
File.WriteAllText("failure_log.txt", ex.ToString());
e.Succeeded = false;
}
}
private void OnFailuresProcessing(object sender, FailuresProcessingEventArgs e)
{
var fa = e.GetFailuresAccessor();
var failures = fa.GetFailureMessages();
if (failures == null || failures.Count == 0)
return;
List<string> logs = new List<string>();
foreach (var f in failures)
{
logs.Add("---- FAILURE ----");
logs.Add($"Severity: {f.GetSeverity()}");
logs.Add($"Description: {f.GetDescriptionText()}");
var ids = f.GetFailingElementIds();
logs.Add($"Elements: {string.Join(",", ids.Select(x => x.Value))}");
}
File.WriteAllLines("failure_log.txt", logs);
e.SetProcessingResult(FailureProcessingResult.ProceedWithRollBack);
}
private void Log(string message)
{
File.AppendAllText("app_log.txt", message + Environment.NewLine);
}
}
Error message
[03/23/2026 13:28:54] End preparing script and command line parameters. [03/23/2026 13:28:54] Start script phase. [03/23/2026 13:28:54] Start Revit Core Engine standard output dump. [03/23/2026 13:28:55] ====== Revit is running: revitcoreconsole ====== [03/23/2026 13:28:55] Current Exe path: T:\Aces\AcesRoot\26.0\coreEngine\Exe\revitcoreconsole.dll [03/23/2026 13:28:55] Echoing command line args: [03/23/2026 13:28:55] 0:/i [03/23/2026 13:28:55] 1:T:\Aces\Jobs\b38552275b2e49e38e34aca90ea2f816\building.rvt [03/23/2026 13:28:55] 2:/al [03/23/2026 13:28:55] 3:T:\Aces\Applications\f08ddaad4f90b305e0e68ef3609f3c96.LleMMVrcgXRCAB0natQ1wS6Lu2KAVirBfypcH9TmRxC6FCmO.revitapsbundle_v1[1].package [03/23/2026 13:28:55] 4:/isolate [03/23/2026 13:28:55] 5:HKEY_CURRENT_USER\SOFTWARE\AppDataLow\Software\Autodesk\CoreUser\WorkItem_b38552275b2e49e38e34aca90ea2f816 [03/23/2026 13:28:55] 6:T:\Aces\Jobs\b38552275b2e49e38e34aca90ea2f816\userdata [03/23/2026 13:28:55] Selected Revit\RCE install Path: (from app.config) [03/23/2026 13:28:55] Resolving location of Revit/RevitCoreEngine installation... [03/23/2026 13:28:55] Loading RCE .... [03/23/2026 13:29:10] Running user application.... [03/23/2026 13:29:10] Found an addIn for registration: RevitAPS.addin [03/23/2026 13:29:10] Language not specified, using English-United States(ENU) as default. [03/23/2026 13:29:42] Get RCE: (VersionBuild) 26.3.0.37 (VersionNumber) 2026 (SubVersionNumber) 2026.3 [03/23/2026 13:33:50] RESULT: Failure - Result of running user app is failure [03/23/2026 13:33:51] Finished running. Process will return: TestError [03/23/2026 13:33:51] ====== Revit finished running: revitcoreconsole ====== [03/23/2026 13:33:51] End Revit Core Engine standard output dump. [03/23/2026 13:33:51] Error: Application revitcoreconsole.exe exits with code 4 which indicates an error. [03/23/2026 13:33:51] End script phase. [03/23/2026 13:33:51] Error: An unexpected error happened during phase CoreEngineExecution of job. [03/23/2026 13:33:52] Job finished with result FailedExecution [03/23/2026 13:33:52] Job Status: { "status": "failedInstructions",