adpapi
Minimal Python client for the ADP Workforce Now API using OAuth2 client credentials + mutual TLS (mTLS).
Install
uv add adpapi
or
pip install adpapi
Configuration
Provide credentials via environment variables (or a .env file):
CLIENT_ID=...
CLIENT_SECRET=...
CERT_PATH=certificate.pem
KEY_PATH=adp.key
Quickstart
import os
from dotenv import load_dotenv
from adpapi import AdpApiClient, AdpCredentials, FilterExpression
from adpapi.logger import configure_logging
# Optional helper: Configure logger with file handlers and stream handling
configure_logging()
load_dotenv()
# Decide which OData columnns are required from your pull
cols = [
"workers/person/legalName",
"workers/person/birthDate",
"workers/workAssignments/reportsTo",
"workers/associateOID",
"workers/businessCommunication/emails",
]
# Load API Credentials from environment
credentials = AdpCredentials.from_env()
# Define your API Client
with AdpApiClient(credentials) as api:
workers = api.call_endpoint(
endpoint="/hr/v2/workers",
select=cols,
masked=True, # set False to request unmasked fields if your tenant allows it
page_size=100, # ADP max
max_requests=1, # increase/remove for full exports
)
# Or call rest endpoints with path parameters
some_workers = api.call_rest_endpoint(
endpoint = '/hr/v1/workers/{aoid}',
aoid = ['0000000001', '0000000002', '0000000003', '0000000004'],
select = cols,
masked = False,
inject_path_params = True # Inject AOID into each response dict for downstream processing
)
Filtering with OData
Use FilterExpression to build OData $filter parameters. Pass filters to call_endpoint() using the filters parameter:
from adpapi.odata_filters import FilterExpression
# Simple equality
filter1 = FilterExpression.field("workers.status").eq("Active")
# Combine conditions with logical operators
filter2 = (
FilterExpression.field("workers.status").eq("Active")
& FilterExpression.field("workers.hireDate").ge("2020-01-01")
)
# Multiple values (IN operator)
filter3 = FilterExpression.field("workers.status").isin(["Active", "OnLeave", "Pending"])
# String search
filter4 = FilterExpression.field("workers.person.legalName.familyName").contains("Smith")
# Pass to API call
workers = api.call_endpoint(
endpoint="/hr/v2/workers",
filters=filter2,
select=cols,
masked=True,
)
Supported Operators:
- Comparison:
eq,ne,gt,ge,lt,le - String functions:
contains(),startswith(),endswith() - Logical:
&(and),|(or),~(not) - IN operator:
isin([...])
Notes:
- Field paths use dots in Python code (e.g.,
workers.status) but convert to forward slashes in OData syntax (workers/status) - Not all operators are supported by all endpoints; check ADP API documentation
- You can also pass OData filter strings directly:
filters="workers/status eq 'Active'"
Notes
- Uses OData-style pagination (
$top,$skip,$select) and stops on HTTP 204 (No Content). masked=FalserequestsAccept: application/json;masked=false(subject to tenant permissions).- Logging writes DEBUG output to
app.logand to the console.
Monofile.ipynb
For clients such as Microsoft Fabric, Azure Databricks, or other notebook-driven programming environments, running a single notebook with magic commands may be more efficient than creating a custom runtime with the pip version of the package. To allow for this, monofile.ipynb can simply be uploaded to the desired location and ran there.
Import Syntax Changes to
%run monofile.ipynb # Or whatever monofile has been renamed to in the notebook client
# Now, imports are no longer necessary and the top-level Api objects are exposed in the main namespace
configure_logging()
with AdpApiClient(...) as api:
api.call_endpoint(...)
Metadata
Release files for adpapi 1.5.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| adpapi-1.5.2.tar.gz | 37.0 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| adpapi-1.5.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 60.3 kB
Release files / adpapi-1.5.2.tar.gz
| Download URL | adpapi-1.5.2.tar.gz |
|---|---|
| Size | 37.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
741d73ae065f05e6ef6e3730b4296883d09eb07ca2bb15e54b0e17d9a80d0ae4
|
|
BLAKE2b-256 checksum How to use checksums |
788af26ed8fda473c472ab0c5902d9a44870a07230b3e8c2b5efb2da808a862f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 27, 2026.
Transparency logRelease files / adpapi-1.5.2-py3-none-any.whl
| Download URL | adpapi-1.5.2-py3-none-any.whl |
|---|---|
| Size | 23.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0ae7b1cf814d07a40dc0781216df14d0b824aeaccdc80ac5d9ad704fef6593a8
|
|
BLAKE2b-256 checksum How to use checksums |
379ec626fc6d9965193bf4e560999ff32a27bbdcd6388367f9f2ac3e54886303
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 27, 2026.
Transparency logSecurity for adpapi 1.5.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for adpapi-1.5.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 27, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.