📚 Complete API Documentation: For detailed, auto-generated API reference documentation with
all methods, properties, and parameters, visit the specklepy API
Documentation.
Overview
TheSpeckleClient is your main entry point for interacting with Speckle Server. It handles authentication and provides access to resource APIs (projects, models, versions, users, etc.).
Constructor
SpeckleClient()
str
default:"\"https://app.speckle.systems\""
The Speckle server URL including protocol
bool
default:"True"
Whether to use SSL/TLS
bool
default:"True"
Whether to verify SSL certificates
- Hosted Server
- Self-Hosted Server
- Local Development
Authentication
authenticate_with_token()
str
required
Personal access token from your Speckle profile
Get your personal access token from: Avatar → Profile → Personal Access Tokens in the Speckle
web app.
authenticate_with_account()
Account
required
Account object from
get_default_account() or get_local_accounts()This method requires that you’ve previously logged in via Speckle Manager or a Speckle Connector
(Rhino, Revit, etc.).
Properties
account
Resource Properties
The client provides access to various resource APIs through these properties. Each resource has its own detailed documentation page.Listing Projects: Workspace vs Non-Workspace Servers:
The method for listing projects differs depending on your server deployment:Note: In earlier versions of specklepy, projects were accessed via the
-
Workspace-enabled servers (e.g., app.speckle.systems): Use
client.workspace.get_projects(workspace_id)to list projects within a workspace, orclient.active_user.get_projects(filter=UserProjectsFilter(personalOnly=True))for personal projects. -
Non-workspace servers (self-hosted/open-source): Use
client.active_user.get_projects()to list all projects you have access to. The workspace resource is not available.
stream resource with a list() method. This has been replaced by the resource-based approach described above.project
model
version
active_user
other_user
server
workspace
Workspace Resource Availability:
The
workspace resource is available on the hosted Speckle server at app.speckle.systems and other workspace-enabled deployments.Self-hosted/open-source server deployments do not include workspace features and this resource will not be available. Attempting to use workspace methods on non-workspace servers will raise an error.Check your server capabilities before using workspace operations, or wrap calls in try/except blocks for cross-server compatibility.Custom GraphQL Queries
When the SDK doesn’t provide a method for a specific GraphQL operation, you can execute raw GraphQL queries usingexecute_query().
execute_query()
str
required
GraphQL query string (use
gql() for proper formatting)Dict
Raw GraphQL response
When to Use Custom Queries
Useexecute_query() when you need to:
- Access GraphQL fields not exposed by SDK methods
- Perform complex queries with specific field selections
- Use new API features before SDK support is added
- Optimize queries by requesting only needed fields
GraphQL Schema Documentation:
To explore available queries, mutations, and fields, visit your Speckle server’s GraphQL playground:
- Hosted server:
https://app.speckle.systems/graphql - Self-hosted:
https://your-server.com/graphql
FAQ
How do I store credentials securely?
How do I store credentials securely?
Never hardcode tokens in your source code. Use environment variables instead:
Should I create a new client for each operation?
Should I create a new client for each operation?
No. Create one client per server and reuse it for all operations:
How do I verify authentication succeeded?
How do I verify authentication succeeded?
Access the
account property after authentication:How do I work with multiple servers?
How do I work with multiple servers?
Create separate client instances for each server:
How do I check if a server has workspace features?
How do I check if a server has workspace features?
Workspace features are only available on specific deployments. Check before using:
How do I handle different server versions?
How do I handle different server versions?
Check the server version and adapt your code accordingly:
What exceptions should I handle?
What exceptions should I handle?
Common exceptions to handle:
How do I list projects on different server types?
How do I list projects on different server types?
The method for listing projects depends on whether the server has workspace features:Note: Earlier versions of specklepy used
stream.list() - this has been replaced by the resource-based approach above.How do I get my personal access token?
How do I get my personal access token?
- Log in to your Speckle server (e.g., https://app.speckle.systems)
- Click your avatar in the top-right
- Go to Profile
- Navigate to Personal Access Tokens
- Click New Token
- Give it a name and select appropriate scopes
- Copy the token immediately (you won’t see it again!)
Next Steps
Operations
Learn about send and receive operations
Resources
Explore detailed resource documentation
Authentication Guide
Detailed authentication setup
Quickstart
Complete tutorial using the client