Skip to main content

Python client for the Personio REST API

Project description

personio-api-client

Python client for the Personio REST API.

Installation

pip install personio-api-client

Or with uv:

uv add personio-api-client

Quick Start

from datetime import date
from personio_api_client import PersonioClient

# Using environment variables (recommended)
# Set PERSONIO_CLIENT_ID and PERSONIO_CLIENT_SECRET

with PersonioClient() as client:
    # Get all active employees
    employees = client.get_employees()

    # Get time-offs for a date range
    time_offs = client.get_time_offs(
        start_date=date(2025, 1, 1),
        end_date=date(2025, 12, 31),
    )

    # Get time-off types
    types = client.get_time_off_types()

Configuration

Environment Variables

export PERSONIO_CLIENT_ID="your-client-id"
export PERSONIO_CLIENT_SECRET="your-client-secret"

Explicit Credentials

client = PersonioClient(
    client_id="your-client-id",
    client_secret="your-client-secret",
)

Options

client = PersonioClient(
    client_id="...",
    client_secret="...",
    base_url="https://api.personio.de/v1",  # default
    timeout=30.0,  # seconds, default
)

API Reference

PersonioClient

get_employees(active_only=True)

Get all employees from Personio.

employees = client.get_employees()
for emp in employees:
    print(f"{emp.name} - {emp.department}")

Returns: list[PersonioEmployee]

get_time_offs(start_date=None, end_date=None, employee_ids=None)

Get time-offs (vacation, sick leave, etc.).

from datetime import date

time_offs = client.get_time_offs(
    start_date=date(2025, 1, 1),
    end_date=date(2025, 12, 31),
)

for t in time_offs:
    print(f"{t.employee_name}: {t.time_off_type_name} ({t.start_date} - {t.end_date})")

Returns: list[PersonioTimeOff]

get_time_off_types()

Get all time-off types.

types = client.get_time_off_types()
for t in types:
    print(f"{t.name} ({t.category})")

Returns: list[PersonioTimeOffType]

Models

PersonioEmployee

Field Type Description
id int Employee ID
email str | None Email address
first_name str | None First name
last_name str | None Last name
status str | None active, inactive, onboarding
department str | None Department name
team str | None Team name
position str | None Position title
hire_date date | None Hire date
termination_date date | None Termination date
weekly_working_hours float | None Weekly hours
work_schedule PersonioWorkSchedule | None Work schedule

Property: name - Full name or fallback to email/ID

PersonioTimeOff

Field Type Description
id int Time-off ID
employee_id int Employee ID
employee_email str | None Employee email
employee_first_name str | None Employee first name
employee_last_name str | None Employee last name
time_off_type_id int Type ID
time_off_type_name str Type name
start_date date Start date
end_date date End date
days_count float Number of days
half_day_start bool Half day at start
half_day_end bool Half day at end
status str approved, pending, rejected
comment str | None Comment

Property: employee_name - Full name or fallback

PersonioWorkSchedule

Field Type Description
id int Schedule ID
name str Schedule name
valid_from date | None Valid from date
monday - sunday str Hours per day (HH:MM format)

Method: hours_for_weekday(weekday: int) - Get hours for weekday (0=Monday)

Exceptions

  • PersonioError - Base exception
  • PersonioConfigurationError - Missing credentials
  • PersonioAuthenticationError - Invalid credentials (401)
  • PersonioRateLimitError - Rate limit exceeded (429)

Development

# Clone repository
git clone https://github.com/dkd-dobberkau/personio-api-client
cd personio-api-client

# Install with dev dependencies
uv sync --all-extras

# Run tests
uv run pytest

# Lint
uv run ruff check src/
uv run ruff format src/

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

personio_api_client-0.1.0.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

personio_api_client-0.1.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file personio_api_client-0.1.0.tar.gz.

File metadata

  • Download URL: personio_api_client-0.1.0.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.5

File hashes

Hashes for personio_api_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 33c4c0606701b0fbf2d6f9af92d98d6452f37fe8de3d67dea5fddcd660315a9e
MD5 49bc8ffd585f3fbe25e1394abe52441c
BLAKE2b-256 db3f64d638fe071717285b5bd884e7c512f208511b78be2b1eadc8ad09de4157

See more details on using hashes here.

File details

Details for the file personio_api_client-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for personio_api_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6a05ab6857ffe58947c4e4ac90cb97654f4e08a0386dd1578e8139ae5a26c6e5
MD5 ee38bc119266f01cbf5f4fffbfd34f3c
BLAKE2b-256 fc5d13b6521559bb4ced4e840b3919490bfe99d7cba5fa7df170918de36c0e9c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page