Observed since 20 Oct, 18:01 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
An Unofficial Python Implementation of the Autodesk Construction Cloud API SDK
The Autodesk Construction Cloud SDK, AccSdk, is a Python SDK that helps developers create applications that leverage the Autodesk Construction Cloud API.
The Autodesk Construction Cloud SDK, AccSdk, is a software development kit for Python that helps developers create applications that leverage the Autodesk Construction Cloud API. This SDK grew out of my company's need to automate certain aspects of ACC that are not currently supported by the ACC web application.
Autodesk publishes and maintains an extensive collection of APIs that allow you to automate and integrate across all of their platform products, ACC being one of their newer offerings. The official documentation for the ACC API can be found at Autodesk Construction Cloud API. This package also supports a subset of the Data Management API, which provides access to the data stored in the ACC Files module. Please refer to the original documentation for extensive details on the API endpoints and their usage.
This package is not an official Autodesk product, but rather a community-driven effort to provide an alternative interface to the ACC API. Specifically, I've used this package to automate setting up hundreds of jobs and users in ACC when the company I work for first adopted the platform. We also use this package on an ongoing basis to automate adding new hires and managing bulk user updates to large numbers of projects. For instance, when someone gets promoted, we upgrade their project level permissions and possibly add them to a larger subset of the overall projects. I've also used this package in an automation script that creates new projects in ACC as new projects get created in an adjacent ERP application. There are many more uses. Feel free to contribute to the project by adding more services or features, and/or sending me a message if you have any questions or suggestions for future enhancements.
AccSdk currently implements the following Autodesk Construction Cloud APIs:
This project is a work in progress and will be updated with more services as the features are implemented. I am
working on adding more services to the ACC class, but you can also contribute to the project by helping me add
more services.
To contribute to the project, please follow the steps below:
The following services are planned for future implementation:
pip install acc_sdk
poetry install
The first step in using the AccSdk, you need to create an instance of the ACC class. The ACC class provides access to the various
services provided by the ACC API. However, first you need to authenticate with the ACC API.
The AccSdk Authentication module implements methods to use the the OAuth2 2-legged and 3-legged authentication processes, and it manages the tokens and their liftimes. The Authentication module class provides the necessary methods to
The initialization of the Authentication class requires the following parameters:
session: A Flask session or a Python dictionary that is used to store the tokens and other session-related data.client_id: The Client ID of your application. This is provided by Autodesk when you register your application.client_secret: The client secret of your application. This is also provided by Autodesk when you register your application. Optional if you are using PKCE.admin_email: The email address of the token holder user. Optional for 2-legged. Used for user_impersonation.callback_url: The callback URL that Autodesk will redirect to after the user has authenticated. Required for the 3-legged flow.login_url: The login URL for the 3-legged flow. This is the URL that Autodesk will redirect to after the user has authenticated. Optional.The following code snippet shows how to authenticate with the ACC API using the 2 legged client credential flow.
import os
from accapi import Authentication # Authentication Module for managing the authentication process and tokens
from accapi import Acc
from dotenv import load_dotenv # for optionally loading environment variables from .env file
load_dotenv()
# Load your environment variables
ACCOUNT_ID = os.environ.get('AUTODESK_ACCOUNT_ID')
CLIENT_ID = os.environ.get('AUTODESK_CLIENT_ID_WEB_APP'),
CLIENT_SECRET = os.environ.get('AUTODESK_CLIENT_SECRET_WEB_APP')
ADMIN_EMAIL = os.environ.get("ADMIN_EMAIL")
auth_client = Authentication( session={}, client_id=CLIENT_ID, client_secret=CLIENT_SECRET, admin_email="youremail@adomain.com")
# Define the scopes you want your token holder to have,
scopes = [
"user-profile:read",
"viewables:read",
"data:read",
"data:write",
"account:read",
"account:write"
]
# Optionaly query the OpenID Connect Discovery Document to get the API's supported scopes
scopes = auth_client.get_oidc_spec()
scopes = [scope for scope in scopes if scope.startswith("data") or scope.startswith("account") or scope.startswith("user-profile")]
# Request the 2 legged token
auth_client.request_2legged_token(scopes=scopes)
assert auth_client._session["accapi_2legged"]
The following code snippet shows a simplified example on how to authenticate using the 3 legged authorization code flow.
import os
from flask import Flask, request, render_template, redirect, url_for, session, jsonify
from accapi import Authentication, Acc
from dotenv import load_dotenv
load_dotenv()
app = Flask(__name__)
app.secret_key = os.environ.get("FLASK_SESSION_KEY")
CLIENT_ID = os.environ.get("AUTODESK_CLIENT_ID_WEB_APP")
CLIENT_SECRET = os.environ.get("AUTODESK_CLIENT_SECRET_WEB_APP")
ADMIN_EMAIL = os.environ.get("ADMIN_EMAIL")
CALLBACK_URL = "http://127.0.0.1:5000/callback"
ACCOUNT_ID = os.environ.get("AUTODESK_ACCOUNT_ID")
SCOPES = [ "user-profile:read","user:read","user:write","viewables:read","data:read","data:write","data:create","account:read","account:write"]
@app.route("/", methods=["GET"])
def index():
return render_template("index.html")
@app.route("/login", methods=["POST"])
def login():
"""
Called from form submission on index.html. Initiates OAuth2 flow.
Redirects to callback URL if successful, or an error message if not.
"""
email = request.form.get("email")
session["user_email"] = email
auth = Authentication(client_id=CLIENT_ID,client_secret=CLIENT_SECRET, session["user_email"], CALLBACK_URL)
authorization_url = auth.get_authorization_url(scopes=SCOPES)
return redirect(authorization_url)
@app.route("/callback", methods=["GET"])
def callback():
"""
Second step in the OAuth2 flow. Exchanges auth code for access token.
Redirects to dashboard if successful, or an error message if not.
"""
code = request.args.get("code")
if not code:
return "No authorization code received.", 400
# Rebuild the Authentication object from the session to retain the same user context
auth = Authentication(session,CLIENT_ID,CLIENT_SECRET, session["user_email"], CALLBACK_URL)
# Exchange the code for an access token
token_data = auth.request_authcode_access_token(code=code, scopes=SCOPES)
if not token_data:
return "Failed to exchange code for token", 400
return redirect(url_for("dashboard"))
@app.route("/dashboard", methods=["GET"])
def dashboard():
""" Final destination of 3 legged Authenticatin flow. """
# Rebuild the Authentication object from the session to retain the same user context
auth = Authentication(session,CLIENT_ID,CLIENT_SECRET, session["user_email"], CALLBACK_URL)
# Build an ACC instance (accapi) with the user's authentication context
acc = Acc(auth_client=auth, account_id=ACCOUNT_ID)
return render_template("dashboard.html")
def run():
app.run(debug=True)
if __name__ == "__main__":
run()
Once you have authenticated with the ACC API, you can create an instance of the ACC class. The ACC class provides access to the various services provided by the ACC API. The account id is an optional argument. If you do not provide the account id, the class will attempt to get the Account Id from the 2-legged token. Not providing the account id will not limit the services you can access if you have both the 2-legged and 3-legged tokens and the appropriate scopes.
from accapi import Acc
acc = Acc(auth_client=auth_client, account_id=ACCOUNT_ID)
The account id is an optional argument. If you do not provide the account id, the class will attempt to get the Account Id from the 2-legged token. Not providing the account id will not limit the APIs you can access. Best is to provide both 2-legged and 3-legged tokens in the Authentication class with and the appropriate scopes so that you can access all the APIs.
Making API requests is simple. You can access the various services provided by the ACC API by calling the appropriate method on the ACC class. Detailed documentation for each API is available in separate files.
For detailed usage instructions and examples, please refer to the following documentation files:
Each API requires specific scopes and token types. Below is a summary of the requirements:
| API | Required Scopes | Token Type |
|---|---|---|
| AccProjectUsersApi | data:read for GET, data:write for POST/PATCH | 2-legged or 3-legged |
| AccProjectsApi | account:read for GET, account:write for POST/PATCH | 2-legged or 3-legged |
| AccSheetsApi | data:read, data:write | 3-legged only |
| AccDataManagementApi | data:read, data:write | 2-legged or 3-legged |
| AccBusinessUnitsApi | account:read, account:write | 2-legged only |
| AccCompaniesApi | account:read, account:write | 2-legged for POST/PATCH, 2 or 3-legged for GET |
| AccFormsApi | data:read, data:write | 3-legged only |
| AccAccountUsersApi | account:read, account:write | 2-legged or 3-legged |
| AccUserProfileApi | user-profile:read | 3-legged only |
| AccPhotosApi | data:read | 3-legged only |
| AccDataConnectorApi | data:read, data:write | 3-legged only |
For more details on each API's requirements, refer to the individual documentation files.
If you have cloned this repository from GitHub, you can run the unit tests to ensure everything is working as expected. Note that the PyPI package does not include the tests directory, so this step is only applicable for the cloned repository.
poetry install
To run the unit tests, use the following command:
poetry run pytest tests/
This will execute all the test cases in the tests directory and provide a summary of the results.
If you want to run a specific test file, you can specify the path to the test file. For example:
poetry run pytest tests/test_account_users.py
To view detailed output during test execution, use the -v flag:
poetry run pytest -v tests/
To check the test coverage, you can use the pytest-cov plugin. Install it if not already installed:
poetry add --dev pytest-cov
Then run the tests with coverage:
poetry run pytest --cov=acc_sdk tests/
This will display a coverage report in the terminal.
This project is licensed under the MIT License - see below for details:
MIT License
Copyright (c) 2024 Daniel Byrne
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.5.14 | 9 Feb 2026 | 4 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 18:01 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:0d785c19b7cfaef312eac2e97f44c3dd17d679f060d2c5b65643681334e50fac