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.

Full Documentation: For complete P4 Warehouse documentation including user guides, configuration, and additional resources, visit https://docs.p4.software

Table of Contents


API Authentication

Obtaining Your API Key

  1. Navigate to Setup > System > Users

  2. Click on the 'system' user from the list

  3. Click the dropdown icon to reveal your tenant's API key

  4. 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:

Action
HTTP Method
Description

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

Note: The tenant identification is handled through the API key in the Authorization header, not through the URL.


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

Status Code
Meaning
Action Required

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-001 through TEST-100: Standard products

  • LOT-001: Lot-tracked product

  • SERIAL-001: Serial-tracked product

  • EXPIRY-001: Expiry-tracked product


Support

Documentation Resources

  • Complete Documentation: https://docs.p4.software

  • Swagger/OpenAPI: https://api.p4warehouse.com/swagger/index.html

  • Support Portal: Contact your P4 Warehouse partner

Getting Help

When requesting support, provide:

  1. Your tenant identifier

  2. API endpoint being called

  3. Complete request (minus API key)

  4. Response received

  5. Timestamp of the request

  6. Any error messages


Appendix: Common Integration Scenarios

E-Commerce Integration

Sync orders from your online store:

  1. Receive order webhook from e-commerce platform

  2. Create/update customer in P4 Warehouse

  3. Create pick ticket with order details

  4. Monitor order status via webhooks

  5. Update tracking in e-commerce platform when shipped

ERP Integration

Maintain data synchronization:

  1. Product master sync (hourly/daily)

  2. Real-time order creation

  3. Inventory level updates

  4. Purchase order synchronization

  5. Financial data export for invoicing

3PL Operations

Manage multi-client operations:

  1. Client-specific product catalogs

  2. Segregated inventory tracking

  3. Automated billing generation

  4. Client portal access via API

  5. Custom reporting per client


Note: This documentation covers the standard P4 Warehouse API. Additional endpoints and features may be available based on your subscription level and enabled modules. For complete documentation, visit https://docs.p4.software

Last updated