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
SECURITY: Never expose your API key in client-side code or public repositories. Store credentials securely using environment variables or secure key management systems.
Setup > System > UsersAll API requests require the following headers:
Authorization: Bearer {your-api-key}
Content-Type: application/json
Accept: application/json
https://api.p4warehouse.com/{Resource}Api/{Action}
https://api.p4warehouse.com (same for all tenants)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 |
https://api.p4warehouse.com/ProductApi/CreateOrUpdate
https://api.p4warehouse.com/PickTicketApi/CreateOrUpdate
https://api.p4warehouse.com/PurchaseOrderApi/DeleteBatch
https://api.p4warehouse.com/FourWallReport/Execute
Note: The tenant identification is handled through the API key in the Authorization header, not through the URL.
POST https://api.p4warehouse.com/ProductApi/CreateOrUpdate
{
"sku": "WIDGET-001",
"description": "Blue Widget - Large",
"barcode": "123456789012",
"client_id": "CLIENT01",
"weight": 1.5,
"length": 10,
"width": 8,
"height": 5,
"unit_of_measure": "EACH",
"lot_tracking": false,
"serial_tracking": false,
"expiry_tracking": false,
"active": true,
"pack_sizes": [
{
"pack_size": 12,
"barcode": "123456789013",
"description": "Case of 12"
}
]
}
{
"success": true,
"product_id": "12345",
"message": "Product created successfully"
}
POST https://api.p4warehouse.com/PurchaseOrderApi/CreateOrUpdate
{
"po_number": "PO-2024-001",
"vendor_id": "VENDOR01",
"warehouse_code": "WH01",
"expected_date": "2024-12-31",
"reference": "Vendor Ref #12345",
"lines": [
{
"line_number": 1,
"sku": "WIDGET-001",
"quantity": 100,
"unit_cost": 5.50
},
{
"line_number": 2,
"sku": "WIDGET-002",
"quantity": 50,
"unit_cost": 7.25
}
]
}
POST https://api.p4warehouse.com/PickTicketApi/CreateOrUpdate
{
"order_number": "SO-2024-001",
"customer_id": "CUST01",
"warehouse_code": "WH01",
"order_date": "2024-01-15",
"required_date": "2024-01-20",
"ship_to": {
"name": "John Doe",
"company": "ABC Company",
"address1": "123 Main Street",
"address2": "Suite 100",
"city": "Anytown",
"state": "CA",
"postal_code": "12345",
"country": "US",
"phone": "555-123-4567"
},
"carrier": "FEDEX",
"service_level": "GROUND",
"lines": [
{
"line_number": 1,
"sku": "WIDGET-001",
"quantity": 5
},
{
"line_number": 2,
"sku": "WIDGET-002",
"quantity": 10
}
]
}
GET https://api.p4warehouse.com/FourWallReport/Execute?warehouse_code=WH01
{
"success": true,
"data": [
{
"sku": "WIDGET-001",
"description": "Blue Widget - Large",
"warehouse_code": "WH01",
"bin_location": "A-01-01",
"quantity_on_hand": 150,
"quantity_allocated": 25,
"quantity_available": 125,
"lot_number": "LOT123",
"expiry_date": "2025-12-31",
"last_updated": "2024-01-15T10:30:00Z"
}
],
"total_records": 1
}
POST https://api.p4warehouse.com/InventoryApi/Adjust
{
"warehouse_code": "WH01",
"adjustments": [
{
"sku": "WIDGET-001",
"bin_location": "A-01-01",
"quantity": 10,
"reason_code": "CYCLE_COUNT",
"notes": "Physical count adjustment"
}
]
}
POST https://api.p4warehouse.com/CustomerApi/CreateOrUpdate
{
"customer_number": "CUST01",
"company_name": "ABC Company",
"contact_person": "John Doe",
"Email": "john@abccompany.com",
"phone": "555-123-4567",
"addresses": [
{
"type": "Shipping",
"address1": "123 Main Street",
"city": "Anytown",
"state": "CA",
"postal_code": "12345",
"country": "US",
"is_default": true
}
]
}
POST https://api.p4warehouse.com/VendorApi/CreateOrUpdate
{
"vendor_number": "VENDOR01",
"company_name": "XYZ Suppliers",
"contact_person": "Jane Smith",
"Email": "jane@xyzsuppliers.com",
"phone": "555-987-6543"
}
curl -X POST https://api.p4warehouse.com/ProductApi/CreateOrUpdate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"sku": "TEST-001",
"description": "Test Product"
}'
import requests
import json
class P4WarehouseClient:
def __init__(self, api_key):
self.base_url = "https://api.p4warehouse.com"
self.headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
def create_product(self, product_data):
url = f"{self.base_url}/ProductApi/CreateOrUpdate"
response = requests.post(url,
headers=self.headers,
json=product_data)
return response.json()
def get_inventory(self, warehouse_code):
url = f"{self.base_url}/FourWallReport/Execute"
params = {"warehouse_code": warehouse_code}
response = requests.get(url,
headers=self.headers,
params=params)
return response.json()
# Usage
client = P4WarehouseClient("your-api-key")
Inventory = client.get_inventory("WH01")
const axios = require('axios');
class P4WarehouseClient {
constructor(apiKey) {
this.baseURL = 'https://api.p4warehouse.com';
this.headers = {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json'
};
}
async createOrder(orderData) {
try {
const response = await axios.post(
`${this.baseURL}/PickTicketApi/CreateOrUpdate`,
orderData,
{ headers: this.headers }
);
return response.data;
} catch (error) {
console.error('Error creating order:', error.response.data);
throw error;
}
}
}
// Usage
const client = new P4WarehouseClient('your-api-key');
const order = await client.createOrder({
order_number: 'SO-2024-001',
customer_id: 'CUST01',
// ... other order data
});
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
public class P4WarehouseClient
{
private readonly HttpClient _httpClient;
private readonly string _baseUrl = "https://api.p4warehouse.com";
public P4WarehouseClient(string apiKey)
{
_httpClient = new HttpClient();
_httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiKey}");
_httpClient.DefaultRequestHeaders.Add("Accept", "application/json");
}
public async Task<T> PostAsync<T>(string endpoint, object data)
{
var json = JsonConvert.SerializeObject(data);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await _httpClient.PostAsync($"{_baseUrl}/{endpoint}", content);
response.EnsureSuccessStatusCode();
var responseJson = await response.Content.ReadAsStringAsync();
return JsonConvert.DeserializeObject<T>(responseJson);
}
}
P4 Warehouse can send real-time notifications to your endpoints when specific events occur.
{
"event_type": "ORDER_SHIPPED",
"timestamp": "2024-01-15T14:30:00Z",
"tenant": "your-tenant-identifier",
"data": {
"order_number": "SO-2024-001",
"tracking_number": "1234567890",
"carrier": "FEDEX",
"ship_date": "2024-01-15",
"lines": [
{
"sku": "WIDGET-001",
"quantity_shipped": 5
}
]
},
"signature": "sha256=..."
}
Always validate webhook signatures to ensure authenticity:
import hmac
import hashlib
def validate_webhook(payload, signature, secret):
expected = hmac.new(
secret.encode(),
payload.encode(),
hashlib.sha256
).hexdigest()
return hmac.compare_digest(
f"sha256={expected}",
signature
)
| 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 |
{
"success": false,
"error": {
"code": "INVALID_SKU",
"message": "Product with SKU 'WIDGET-999' not found",
"details": {
"field": "sku",
"value": "WIDGET-999"
}
},
"timestamp": "2024-01-15T10:30:00Z"
}
Implement exponential backoff for transient errors:
import time
import random
def retry_request(func, max_retries=3):
for attempt in range(max_retries):
try:
return func()
except Exception as e:
if attempt == max_retries - 1:
raise
# Exponential backoff with jitter
wait_time = (2 ** attempt) + random.uniform(0, 1)
time.sleep(wait_time)
For large data sets, use pagination parameters:
GET https://api.p4warehouse.com/ProductApi/List?page=1&page_size=100
Use query parameters to filter results:
GET https://api.p4warehouse.com/InventoryApi/List?warehouse_code=WH01&sku=WIDGET*
Include idempotency keys for critical Operations:
{
"idempotency_key": "unique-key-12345",
"order_number": "SO-2024-001",
// ... rest of order data
}
Always validate data before sending:
Maintain comprehensive logs:
Test your integration using the sandbox:
https://api.p4warehouse.com (same as Production)Use these test SKUs in sandbox:
TEST-001 through TEST-100: Standard ProductsLOT-001: Lot-tracked productSERIAL-001: Serial-tracked productEXPIRY-001: Expiry-tracked producthttps://docs.p4.softwarehttps://api.p4warehouse.com/swagger/index.htmlWhen requesting Support, provide:
Sync orders from your online store:
Maintain data synchronization:
Manage multi-client Operations:
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
Was this page helpful?