applebusiness
Async Python client for the Apple Business API.
Install
pip install applebusiness
Requires Python 3.14+.
Authentication
You need an API key generated in Apple Business Manager. The client uses the OAuth 2.0 client-credentials flow with a JWT client assertion signed by your private key. See Implementing OAuth for the Apple School Manager and Apple Business API.
You'll need:
key_id— the key identifier from Apple Business Managerclient_id— your API account's client IDprivate_key_pem— the PEM-encoded EC private key
Usage
import asyncio
from applebusiness import Client
async def main():
async with Client(key_id, client_id, private_key_pem) as client:
devices = await client.get_org_devices()
for device in devices.data:
print(device.id, device.attributes.serialNumber)
asyncio.run(main())
Token caching
By default, OAuth tokens are cached in memory on the Client instance.
To share tokens across processes (e.g. via Redis),
subclass Client and override _get_cached_token / _set_cached_token:
class RedisClient(Client):
async def _get_cached_token(self):
raw = await redis.get("ab-token")
return json.loads(raw) if raw else None
async def _set_cached_token(self, token):
await redis.set("ab-token", json.dumps(token), ex=token["expires_in"])
Coverage
The client implements every Apple Business API endpoint documented as of this release:
- Devices —
get_org_devices,get_org_device,get_org_device_apple_care_coverage,get_mdm_devices,get_mdm_device_details - Device Management Services —
get_mdm_servers,get_mdm_server_device_ids,get_org_device_assigned_server_id,get_org_device_assigned_server,assign_devices_to_server,unassign_devices_from_server,get_org_device_activity - Users —
get_users,get_user - User Groups —
get_user_groups,get_user_group,get_user_group_user_ids - Apps & Packages —
get_apps,get_app,get_packages,get_package - Blueprints —
get_blueprints,create_blueprint,get_blueprint,update_blueprint,delete_blueprint, andget_blueprint_<rel>_idsadd_<rel>_to_blueprint/remove_<rel>_from_blueprintforapps,configurations,packages,org_devices,users,user_groups - Configurations —
get_configurations,create_configuration,get_configuration,update_configuration,delete_configuration - Audit —
get_audit_events
All responses are returned as typed Pydantic models
(importable from the top-level applebusiness package).
Pagination
List endpoints accept limit and cursor for manual paging. Each response
exposes meta.paging.nextCursor — pass it back as cursor to fetch the next
page:
page = await client.get_org_devices(limit=100)
while page.meta.paging.nextCursor:
page = await client.get_org_devices(
limit=100, cursor=page.meta.paging.nextCursor
)
To iterate every item across all pages, pass the bound list method to
Client.paginate. Extra keyword arguments (e.g. limit, filters) are
forwarded on every request:
async for device in client.paginate(client.get_org_devices, limit=200):
print(device.id)
async for event in client.paginate(
client.get_audit_events,
start_timestamp="2026-01-01T00:00:00Z",
end_timestamp="2026-02-01T00:00:00Z",
):
...
Activity polling
assign_devices_to_server and unassign_devices_from_server poll
the resulting orgDeviceActivity until it leaves IN_PROGRESS.
The polling timeout defaults to 300 seconds and raises TimeoutError when exceeded.
To skip polling, pass wait=False; to wait indefinitely, pass timeout=None.
Errors
Non-2xx responses raise applebusiness.ClientError,
which exposes the HTTP status and parsed ErrorResponse body.
License
MIT
Metadata
Release files for applebusiness 0.2.1
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 | Actions |
|---|---|---|---|---|
| applebusiness-0.2.1.tar.gz | 11.8 kB | With provenance | Details for applebusiness-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| applebusiness-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for applebusiness-0.2.1-py3-none-any.whl |
Total release size: 26.1 kB
Release files / applebusiness-0.2.1.tar.gz
| Download URL | applebusiness-0.2.1.tar.gz |
|---|---|
| Size | 11.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ef544781864e6afdf90d394572194577cd1719fc2f560e54d769cfdfdbf70628
|
|
BLAKE2b-256 checksum How to use checksums |
c00a39c2388c253d701d94333ef1f0c882de2b533f2dd7cc33fccde1b2333b87
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 May 22, 2026.
Transparency logRelease files / applebusiness-0.2.1-py3-none-any.whl
| Download URL | applebusiness-0.2.1-py3-none-any.whl |
|---|---|
| Size | 14.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f852383b85f07367e4ccb81a0447aa0d43a59fad7bf4deca17fb75267ff0bbe4
|
|
BLAKE2b-256 checksum How to use checksums |
cb8ed22717dc9fc68ce71227936bb2f0e10c403a9ffce5955759206cda9fabff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 May 22, 2026.
Transparency logSecurity for applebusiness 0.2.1
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
Both files in this release have been uploaded with provenance metadata.
Attestation for applebusiness-0.2.1.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 May 22, 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.