P4Warehouse REST API
Overview
P4 Warehouse provides a comprehensive REST API that enables seamless integration with external systems including ERPs, e-commerce platforms, and custom applications. This guide covers authentication, API endpoints, and common integration patterns.
Table of Contents
API Authentication
Obtaining Your API Key
SECURITY: Never expose your API key in client-side code or public repositories. Store credentials securely using environment variables or secure key management systems.
Navigate to
Setup > System > UsersClick on the 'system' user from the list
Click the dropdown icon to reveal your tenant's API key
Copy and securely store the API key
Authentication Headers
All API requests require the following headers:
API Structure & Patterns
Base URL Format
Base URL: Always
https://api.p4warehouse.com(same for all tenants){Resource}: The resource type (Product, Client, Vendor, PickTicket, PurchaseOrder, etc.)
{Action}: The operation (CreateOrUpdate, DeleteBatch, Execute, etc.)
Standard Endpoints
Each resource typically supports these actions:
CreateOrUpdate
POST
Create new or update existing record
DeleteBatch
POST
Delete multiple records
Get
GET
Retrieve single record
List
GET
Retrieve multiple records with pagination
Execute
POST
Execute specific operations
Example Endpoints
Core Resources
1. Products
Create/Update Product
Response
2. Purchase Orders
Create Purchase Order
3. Sales Orders (Pick Tickets)
Create Sales Order
4. Inventory Operations
Get Current Inventory (FourWall Report)
Response
Inventory Adjustment
5. Customers
Create/Update Customer
6. Vendors
Create/Update Vendor
Integration Examples
Basic HTTP Request (cURL)
Python Example
JavaScript/Node.js Example
C# Example
Webhook Configuration
P4 Warehouse can send real-time notifications to your endpoints when specific events occur.
Available Webhook Events
Order Events: Created, Allocated, Picked, Packed, Shipped
Inventory Events: Low Stock, Stock Received, Cycle Count Complete
Purchase Order Events: Received, Completed
3PL Events: Invoice Generated, Payment Received
Webhook Payload Example
Webhook Security Validation
Always validate webhook signatures to ensure authenticity:
Error Handling
HTTP Status Codes
200
Success
None
400
Bad Request
Check request format and required fields
401
Unauthorized
Verify API key
403
Forbidden
Check permissions for resource
404
Not Found
Verify endpoint URL and resource ID
429
Rate Limited
Implement retry with backoff
500
Server Error
Contact support if persistent
Error Response Format
Retry Strategy
Implement exponential backoff for transient errors:
Best Practices
1. Rate Limiting
Default limit: 100 requests per minute
Implement request queuing for bulk operations
Use batch endpoints when available
2. Pagination
For large data sets, use pagination parameters:
3. Filtering
Use query parameters to filter results:
4. Idempotency
Include idempotency keys for critical operations:
5. Data Validation
Always validate data before sending:
Required fields are present
Data types are correct
Values are within acceptable ranges
SKUs and IDs exist in the system
6. Logging
Maintain comprehensive logs:
All API requests and responses
Error details and stack traces
Performance metrics
Webhook receipts
Testing
Sandbox Environment
Test your integration using the sandbox:
Base URL:
https://api.p4warehouse.com(same as production)Use test API keys provided separately for sandbox access
Data is reset daily
Test Data
Use these test SKUs in sandbox:
TEST-001throughTEST-100: Standard productsLOT-001: Lot-tracked productSERIAL-001: Serial-tracked productEXPIRY-001: Expiry-tracked product
Support
Documentation Resources
Complete Documentation:
https://docs.p4.softwareSwagger/OpenAPI:
https://api.p4warehouse.com/swagger/index.htmlSupport Portal: Contact your P4 Warehouse partner
Getting Help
When requesting support, provide:
Your tenant identifier
API endpoint being called
Complete request (minus API key)
Response received
Timestamp of the request
Any error messages
Appendix: Common Integration Scenarios
E-Commerce Integration
Sync orders from your online store:
Receive order webhook from e-commerce platform
Create/update customer in P4 Warehouse
Create pick ticket with order details
Monitor order status via webhooks
Update tracking in e-commerce platform when shipped
ERP Integration
Maintain data synchronization:
Product master sync (hourly/daily)
Real-time order creation
Inventory level updates
Purchase order synchronization
Financial data export for invoicing
3PL Operations
Manage multi-client operations:
Client-specific product catalogs
Segregated inventory tracking
Automated billing generation
Client portal access via API
Custom reporting per client
Last updated