Authentication
The pd4castr Python SDK uses OAuth 2.0 Client Credentials to authenticate with the API. This is a machine-to-machine flow designed for automated scripts, pipelines, and backend integrations. The SDK handles token management automatically — you don’t need to request or refresh tokens yourself.
Obtaining credentials
Your client_id and client_secret are issued per organisation. These are
separate from the interactive login used by the CLI and web app.
To request credentials, contact your organisation admin or contact us to get set up.
Passing credentials to the client
Provide your credentials when you create a Client instance:
from pd4castr_api_sdk import Client
client = Client(
client_id="your-client-id",
client_secret="your-client-secret",
)Security best practices
Never hardcode credentials in your source code. Instead, load them from environment variables or a secrets manager.
import os
from pd4castr_api_sdk import Client
client = Client(
client_id=os.environ["PD4CASTR_CLIENT_ID"],
client_secret=os.environ["PD4CASTR_CLIENT_SECRET"],
)Other recommendations:
- Store credentials in a
.envfile (and add it to.gitignore) or use your platform’s secrets management (for example, GitHub Actions secrets, AWS Secrets Manager, or Vault). - Limit credential access to the services and team members that need them.
Next steps
- Quick start — get up and running with your first API call
- Discover models — list model groups and models available to your organisation
- Fetch latest forecast — retrieve the most recent forecast for a model
- Reference — full
Clientconstructor details and all available methods