/revit-bim:acc-api-setupfrom revit-bim
Sets up Python authentication and a reusable client for the Autodesk Platform Services (APS) API to access Autodesk Construction Cloud (ACC). Handles OAuth2 token acquisition (2-legged and 3-legged), environment configuration, and hub/project discovery.
Ships in revit-bim. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Set up Python access to Autodesk Construction Cloud for:
"$ARGUMENTS"
Before writing any code, the user needs:
requests installed (pip install requests)Ask the user which flow they need:
import os
import requests
import base64
import time
# ── Configuration — use environment variables, never hardcode secrets ─────────
CLIENT_ID = os.environ.get("APS_CLIENT_ID", "YOUR_CLIENT_ID")
CLIENT_SECRET = os.environ.get("APS_CLIENT_SECRET", "YOUR_CLIENT_SECRET")
# Scopes for typical ACC read/write operations
SCOPES = "data:read data:write account:read"
APS_AUTH_URL = "https://developer.api.autodesk.com/authentication/v2/token"
# ─────────────────────────────────────────────────────────────────────────────
class APSClient:
"""Reusable APS client that auto-refreshes the 2-legged token."""
def __init__(self, client_id, client_secret, scopes):
self.client_id = client_id
self.client_secret = client_secret
self.scopes = scopes
self._token = None
self._expires_at = 0
def _credentials_header(self):
"""Base64-encode client_id:client_secret for Basic auth (OAuth2 v2)."""
creds = base64.b64encode(
(self.client_id + ":" + self.client_secret).encode()
).decode()
return "Basic " + creds
def get_token(self):
"""Return a valid access token, refreshing if needed."""
if self._token and time.time() < self._expires_at - 60:
return self._token
resp = requests.post(
APS_AUTH_URL,
headers={
"Authorization": self._credentials_header(),
"Content-Type": "application/x-www-form-urlencoded",
},
data={
"grant_type": "client_credentials",
"scope": self.scopes,
}
)
resp.raise_for_status()
data = resp.json()
self._token = data["access_token"]
self._expires_at = time.time() + data["expires_in"]
return self._token
def headers(self):
"""Return headers dict ready to pass to any APS API call."""
return {
"Authorization": "Bearer " + self.get_token(),
"Content-Type": "application/json",
}
def get(self, url, params=None):
r = requests.get(url, headers=self.headers(), params=params)
r.raise_for_status()
return r.json()
def post(self, url, payload):
r = requests.post(url, headers=self.headers(), json=payload)
r.raise_for_status()
return r.json()
def patch(self, url, payload):
r = requests.patch(url, headers=self.headers(), json=payload)
r.raise_for_status()
return r.json()
# ── Usage example ─────────────────────────────────────────────────────────────
if __name__ == "__main__":
client = APSClient(CLIENT_ID, CLIENT_SECRET, SCOPES)
print("Token acquired:", client.get_token()[:20] + "...")
Run this after authentication to find the IDs you need for all other scripts.
import requests, os
# Assumes APSClient class from Script 1 is available
BASE_URL = "https://developer.api.autodesk.com"
def list_hubs(client):
"""List all accessible hubs (ACC accounts)."""
data = client.get(BASE_URL + "/project/v1/hubs")
hubs = []
for h in data.get("data", []):
hubs.append({
"Hub Name": h["attributes"]["name"],
"Hub ID": h["id"], # Use this as HUB_ID in other scripts
"Region": h["attributes"].get("region", ""),
})
return hubs
def list_projects(client, hub_id):
"""List all projects in a hub."""
data = client.get(BASE_URL + f"/project/v1/hubs/{hub_id}/projects")
projects = []
for p in data.get("data", []):
# ACC project IDs start with "b." — strip it for Model Coordination API calls
projects.append({
"Project Name": p["attributes"]["name"],
"Project ID": p["id"], # Use this (with b. prefix) for Data Management API
"ACC ID": p["id"].replace("b.", ""), # Use this for Model Coord, Issues APIs
"Status": p["attributes"].get("status", ""),
})
return projects
if __name__ == "__main__":
client = APSClient(CLIENT_ID, CLIENT_SECRET, SCOPES)
print("=== HUBS ===")
hubs = list_hubs(client)
for h in hubs:
print(f" {h['Hub Name']} → Hub ID: {h['Hub ID']}")
if hubs:
hub_id = hubs[0]["Hub ID"]
print(f"\n=== PROJECTS IN {hubs[0]['Hub Name']} ===")
projects = list_projects(client, hub_id)
for p in projects:
print(f" {p['Project Name']}")
print(f" Data Mgmt ID: {p['Project ID']}")
print(f" ACC ID: {p['ACC ID']}")
Use this when the ACC API requires a user identity (not a service account).
import os, webbrowser, urllib.parse, http.server, threading, requests, base64
CLIENT_ID = os.environ.get("APS_CLIENT_ID")
CLIENT_SECRET = os.environ.get("APS_CLIENT_SECRET")
REDIRECT_URI = "http://localhost:8080/callback"
SCOPES = "data:read data:write"
# Step 1: Build the authorization URL and open it in the browser
AUTH_URL = "https://developer.api.autodesk.com/authentication/v2/authorize"
params = {
"response_type": "code",
"client_id": CLIENT_ID,
"redirect_uri": REDIRECT_URI,
"scope": SCOPES,
}
auth_url = AUTH_URL + "?" + urllib.parse.urlencode(params)
print("Opening browser for authorization...")
webbrowser.open(auth_url)
# Step 2: Local server to catch the callback code
auth_code = {"value": None}
class CallbackHandler(http.server.BaseHTTPRequestHandler):
def do_GET(self):
qs = urllib.parse.parse_qs(urllib.parse.urlparse(self.path).query)
auth_code["value"] = qs.get("code", [None])[0]
self.send_response(200)
self.end_headers()
self.wfile.write(b"<h2>Auth complete. You can close this window.</h2>")
def log_message(self, *args): pass
server = http.server.HTTPServer(("localhost", 8080), CallbackHandler)
t = threading.Thread(target=server.handle_request)
t.start()
t.join(timeout=60)
# Step 3: Exchange code for access token
creds = base64.b64encode((CLIENT_ID + ":" + CLIENT_SECRET).encode()).decode()
resp = requests.post(
"https://developer.api.autodesk.com/authentication/v2/token",
headers={"Authorization": "Basic " + creds,
"Content-Type": "application/x-www-form-urlencoded"},
data={"grant_type": "authorization_code",
"code": auth_code["value"],
"redirect_uri": REDIRECT_URI}
)
resp.raise_for_status()
token_data = resp.json()
ACCESS_TOKEN = token_data["access_token"]
REFRESH_TOKEN = token_data["refresh_token"]
print("3-legged token acquired:", ACCESS_TOKEN[:20] + "...")
| API | Base URL | Auth |
|---|---|---|
| Authentication v2 | https://developer.api.autodesk.com/authentication/v2 | — |
| Data Management v1 | https://developer.api.autodesk.com/data/v1 | 2-legged |
| Project v1 (hubs) | https://developer.api.autodesk.com/project/v1 | 2-legged |
| ACC Issues v1 | https://developer.api.autodesk.com/construction/issues/v1 | 3-legged |
| Model Coordination v2 | https://developer.api.autodesk.com/modelcoordination/modelset/v2 | 2-legged |
| ACC Sheets v1 | https://developer.api.autodesk.com/construction/sheets/v1 | 2-legged |
b.{account_id} — used in /project/v1/hubs/{hub_id}b.{project_id} — used in /data/v1/projects/{project_id}{project_id} — without the b. prefixb.Always store credentials as environment variables — never hardcode:
# Windows (PowerShell)
$env:APS_CLIENT_ID = "your_client_id"
$env:APS_CLIENT_SECRET = "your_client_secret"
# Mac/Linux
export APS_CLIENT_ID="your_client_id"
export APS_CLIENT_SECRET="your_client_secret"
Or use a .env file with python-dotenv:
from dotenv import load_dotenv
load_dotenv() # reads .env file automatically
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub utopia5327/claude-plugin-for-revit-bim --plugin revit-bim25 skills in this plugin
/acc-coordinateWork with Autodesk Construction Cloud (ACC) Coordinate — list and inspect model sets, retrieve clash results, create clash issues, manage model activation for coordination, and export coordination reports via the APS Model Coordination API. Use this skill when a user needs to automate clash detection workflows, pull clash data from ACC for reporting, create ACC issues from clashes, check which models are active in a model set, or integrate ACC coordination data with other tools. Trigger on phrases like "ACC Coordinate", "model coordination", "model set", "clash results", "clash data", "ACC clashes", "coordination space", "activated models", "clash issues", "federated model", "coordination report", "BIM coordination", or any request to work with ACC's model coordination module via API. Also offer this when users want to export or report on clash data from ACC.
/acc-design-collaborationGuide Revit ↔ ACC Design Collaboration workflows — setting up cloud worksharing, creating and consuming design packages, shared views, Design Collaboration setup, model publishing, and Revit cloud model best practices. Also covers the API for querying shared views and design package status. Use this skill when a user needs help with Revit cloud models, BIM 360 Design / ACC Design Collaboration, creating or receiving design packages, activating models for coordination, or troubleshooting cloud worksharing issues. Trigger on phrases like "Design Collaboration", "cloud worksharing", "Revit cloud model", "design package", "shared views", "consume package", "publish model to ACC", "BIM 360 Design", "Revit cloud", "cloud model", "collaboration workflow", "ACC Revit workflow", or any request involving the Revit-to-ACC publishing and collaboration pipeline.
/acc-docsManage Autodesk Construction Cloud (ACC) Docs — list folders and files, upload documents, download files, create folder structures, manage transmittals, reviews, and packages via the APS Data Management API and ACC Docs REST API. Use this skill when a user needs to automate document control workflows in ACC: bulk uploading drawing sets, creating folder structures, listing published files, downloading specific versions, setting up transmittals, creating document packages, or writing reports of what's in their ACC Docs library. Trigger on phrases like "ACC Docs", "upload to ACC", "download from ACC", "list files in ACC", "document control", "ACC folder", "transmittal", "document package", "file versions", "publish drawings", "drawing register", "ACC file management", or any request to read, write, or organise files in Autodesk Construction Cloud Docs.
/acc-reportsExport ACC project data to CSV or Excel — issues, RFIs, document logs, clash summaries, transmittals, and project activity reports — using the APS REST API with Python. Use this skill when a user needs to report on ACC project health, export an issues register, pull RFI status into a spreadsheet, generate a document transmittal log, create a clash trend report, or produce any data export from Autodesk Construction Cloud. Trigger on phrases like "export issues", "issues report", "RFI report", "ACC report", "export from ACC", "document log", "clash report", "ACC data export", "project status report", "pull data from ACC", "ACC Excel export", "transmittal log", or any request to extract or report on data stored in Autodesk Construction Cloud.
/analyze-roomsAnalyze rooms, spaces, and areas in a Revit model — GIA calculations, space program comparison, department breakdowns, unbounded/unplaced room audits, and CSV export. Use this skill when a user wants to calculate total floor area, check room areas against a brief, export a room data table, find unplaced or unbounded rooms, or produce a GIA (Gross Internal Area) report. Trigger on phrases like "room areas", "GIA", "space program", "analyze rooms", "unbounded rooms", "area schedule", "room data", "floor area summary", "net internal area", or any request involving Revit room/space quantities. Also use when someone mentions area validation before planning submission.
/audit-modelAudit and analyze Revit model health, quality, and BIM standards compliance. Use this skill when checking model file size, warning counts, element counts by category, redundant or in-place families, unused views, workset structure, model warnings, or any model performance or quality-control question. Trigger on phrases like "audit my model", "check model health", "how many warnings", "is my model clean", "model performance", "BIM QC", "quality check", or whenever someone wants a summary of what's in their Revit model. Proactively offer an audit when users mention slow model performance or submission deadlines.
Other plugins' skills for the same job