Setup
Install the Ottimate Python SDK, exchange your credentials for an access token, and create an authenticated client.
Prerequisites
- Python 3.8 or later
- An Ottimate API key, OAuth client ID, and client secret. See Authentication for how to obtain them.
Install the package
The SDK is published to PyPI as ottimate-sdk. Install it into a virtual environment:
The distribution is named ottimate-sdk, but the import name is ottimate:
Configure your credentials
Keep credentials out of source control. Create a .env file alongside your script:
Load them with any loader you prefer. The examples below use python-dotenv, which you can add with pip install python-dotenv:
These variable names are the ones used by the rest of the pages in this section.
Choose an environment
Select the target environment with the OttimateEnvironment enum rather than hardcoding a URL. Both values already include the required /v1 path segment.
PRODUCTION is the default. Start against SANDBOX while you build — see Sandbox Environment.
Authenticate and create the client
Authentication is a two-step exchange. First create a short-lived client that carries only your API key and call the OAuth endpoint. Then create the client you will actually use, passing the returned access token as a bearer token.
The token response also exposes token_type, expires_in, and scope. Tokens expire, so cache the token and repeat step 1 when expires_in elapses or a request returns 401. See Authentication for details.
Verify the client works
Fetch the companies on your account as a smoke test:
The client object created here is the one used by every other page in this section.
Optional settings
Async usage
For asyncio applications, import AsyncOttimate instead. It takes the same arguments and exposes the same methods as coroutines:

