P21 API Documentation
Disclaimer: This is unofficial, community-created documentation for Epicor Prophet 21 APIs. It is not affiliated with, endorsed by, or supported by Epicor Software Corporation. All product names, trademarks, and registered trademarks are property of their respective owners. Use at your own risk.
Comprehensive documentation and working examples (Python and C#) for all Prophet 21 integration APIs.
Overview
This repository provides developer-focused documentation for P21's integration APIs. All content is based on official Epicor SDK documentation and verified working implementations.
APIs Covered
| API | Purpose | Best For |
|---|---|---|
| OData | Read-only data access via standard OData protocol | Reporting, lookups, data exports |
| Transaction API | Stateless bulk data manipulation | Bulk creates, external integrations |
| Interactive API | Stateful window interactions with business logic | Complex workflows, validation |
| Entity API | Simple CRUD on business objects | Basic record operations |
| Inventory REST API | Inventory item CRUD, multi-company workflows | Item reads, appending locations/suppliers |
| Production & Labor | Production orders, labor hours, time entry | Manufacturing workflows, labor tracking |
Quick Start
# Clone and setup
git clone https://github.com/mrwuss/p21-api-documentation.git
cd p21-api-documentation
# Install dependencies
pip install -r requirements.txt
# Configure environment
cp .env.example .env
# Edit .env with your P21 credentials
# Run an example
python scripts/odata/01_basic_query.py
Documentation
Getting Started
- Authentication - Token generation, credentials vs consumer key, Interactive API auth
- API Selection Guide - Which API to use when
API Reference
- OData API - Query syntax, filtering, pagination
- Transaction API - Service discovery, bulk operations
- Interactive API - Sessions, windows, workflows
- Entity API - Entity CRUD operations
- Inventory REST API - Inventory CRUD, multi-company workflows
- Production & Labor API - Production orders, labor tracking
Troubleshooting
- Error Handling - HTTP codes, error responses
- Session Pool Issues - Intermittent failures
Reference
- SalesPricePage Dropdown Codes - Valid values for price page fields
- Batch Processing Patterns - Production batch operation patterns
- Changelog - All changes and contributors
Example Scripts
OData
scripts/odata/01_basic_query.py- Simple table queryscripts/odata/02_filtering.py- Filter expressionsscripts/odata/03_pagination.py- Skip, top, countscripts/odata/04_complex_queries.py- Advanced queries
Transaction API
scripts/transaction/01_list_services.py- Discover servicesscripts/transaction/02_get_definition.py- Get service schemascripts/transaction/03_create_single.py- Create one recordscripts/transaction/04_create_bulk.py- Batch operationsscripts/transaction/test_session_pool.py- Diagnose pool issues
Interactive API
scripts/interactive/01_open_session.py- Session lifecyclescripts/interactive/02_open_window.py- Window operationsscripts/interactive/03_change_data.py- Field manipulationscripts/interactive/04_save_and_close.py- Save workflowscripts/interactive/05_response_windows.py- Dialog handling and response windowsscripts/interactive/06_complex_workflow.py- Multi-step workflows
Entity API
scripts/entity/01_list_entities.py- Discover entitiesscripts/entity/02_query_entity.py- Query recordsscripts/entity/03_create_entity.py- Create record
C# Examples
The examples/csharp/ directory contains equivalent C# console applications for every Python script, plus a shared client library.
# Build all C# examples
cd examples/csharp
dotnet build
# Run a specific example
dotnet run --project OData
dotnet run --project Transaction
dotnet run --project Interactive
dotnet run --project Entity
See examples/csharp/README.md for setup details.
All documentation pages include tabbed code blocks showing both Python and C# side-by-side. The online HTML docs support language switching with global sync across all code blocks on a page.
Environment Variables
| Variable | Required | Description |
|---|---|---|
P21_BASE_URL |
Yes | P21 server URL (e.g., https://play.p21server.com) |
P21_USERNAME |
Yes* | P21 API username |
P21_PASSWORD |
Yes* | P21 API password |
P21_CONSUMER_KEY |
No | Consumer key GUID (alternative to username/password) |
P21_CONSUMER_USERNAME |
No | P21 username for consumer key auth (required for Interactive API) |
*Not required when using consumer key authentication. See Authentication docs.
Content Sources
All documentation is derived from:
- Official SDK: Epicor P21 SDK documentation
- Working Code: Verified implementations from production projects
- Actual Testing: Tested against P21 test environments
Contributing
This documentation is a community effort! We welcome contributions:
- Found an error? Open an issue
- Need something documented? Request it
- Have P21 knowledge to share? Contribute
- Questions? Start a discussion
See CONTRIBUTING.md for guidelines.
License
MIT License - See LICENSE file