Skip to main content

Python SDK

Installation

pip install nexspace
Requires Python 3.9+.

Quick Start

from nexspace import NexSpace

client = NexSpace(api_key="nex_live_YOUR_KEY")

# List facilities
facilities = client.facilities.list()

# Search staff
staff = client.staff.search(query="Jane", specialty="RN", facility_id=12)

# Get a staff member
member = client.staff.get(789)

Configuration

client = NexSpace(
    api_key="nex_live_...",
    base_url="https://api.nexspace365.com",  # default
    version="2026-05-10",                 # pin API version
    max_retries=3,                        # default
    timeout=30.0,                         # 30s default
)

Resources

Facilities

facilities = client.facilities.list()
facility = client.facilities.get(12)

Staff

results = client.staff.search(query="Smith", limit=10)
member = client.staff.get(789)

Shifts

shifts = client.shifts.list(facility_id=12, status="open")
assigned = client.shifts.assign(456, staff_ids=[789])

API Keys

keys = client.api_keys.list()
new_key = client.api_keys.create(
    name="CI Pipeline",
    scopes=["shifts:read", "staff:read"],
)

Pydantic Models

All responses are Pydantic v2 models with full type information:
from nexspace.types import Facility, Staff, Shift

facilities: list[Facility] = client.facilities.list()
print(facilities[0].name)  # IDE autocomplete works

Error Handling

from nexspace import NexSpaceError

try:
    client.shifts.assign(456, staff_ids=[789])
except NexSpaceError as e:
    print(e.code)        # "FORBIDDEN"
    print(e.suggestion)  # "Rotate your API key to include..."
    print(e.retryable)   # False

Async Support

from nexspace import AsyncNexSpace

async_client = AsyncNexSpace(api_key="nex_live_YOUR_KEY")
facilities = await async_client.facilities.list()