API Documentation
Complete reference for the Preblo REST API
Contents
Getting Started
Base URL
https://app.preblo.com
Authentication
All API requests require authentication using an API key. Include your API key in the request header:
# Option 1: Authorization header
Authorization: Bearer pblo_live_your_api_key
# Option 2: X-API-Key header
X-API-Key: pblo_live_your_api_key
Rate Limiting
API requests are limited to 100 requests per second per API key. Rate limit headers are included in every response:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1696185600
Error Handling
The API uses standard HTTP status codes and returns error details in JSON format:
{
"error": "Invalid API key",
"code": "AUTH_INVALID_KEY",
"status": 401
}
Authentication
Secure your API requests with API keys
POST
/api/v1/orgs/:orgSlug/api-keysCreate a new API key
Authentication: Session Token
Request Body
{
"name": "string (required)",
"environment": "\"live\" | \"test\" (default: \"live\")",
"permissions": "string[] (optional)",
"expiresAt": "ISO 8601 datetime (optional)"
}Response
{
"success": "boolean",
"apiKey": {
"id": "string",
"name": "string",
"key": "string (shown only once)",
"keyPreview": "string",
"permissions": "string[]",
"expiresAt": "string | null",
"createdAt": "string"
}
}GET
/api/v1/orgs/:orgSlug/api-keysList all API keys for organization
Authentication: Session Token
Response
{
"apiKeys": [
{
"id": "string",
"name": "string",
"keyPreview": "string",
"permissions": "string[]",
"lastUsedAt": "string | null",
"expiresAt": "string | null",
"createdAt": "string"
}
]
}Products
Manage your product catalog
GET
/api/v1/orgs/:orgSlug/productsList all products
Authentication: API Key
Query Parameters
page: number (default: 1)
limit: number (default: 20, max: 100)
status: "ACTIVE" | "DRAFT" | "ARCHIVED"
search: string
Response
{
"products": "Product[]",
"total": "number",
"page": "number",
"limit": "number"
}POST
/api/v1/orgs/:orgSlug/productsCreate a new product
Authentication: API Key (write:products)
Request Body
{
"title": "string (required)",
"description": "string",
"price": "number (required)",
"status": "\"ACTIVE\" | \"DRAFT\"",
"images": "string[]",
"inventory": "number"
}GET
/api/v1/orgs/:orgSlug/products/:productIdGet product details
Authentication: API Key
Response
{
"product": "Product"
}Orders
Process and manage orders
GET
/api/v1/orgs/:orgSlug/ordersList all orders
Authentication: API Key
Query Parameters
page: number
limit: number
status: "PENDING" | "PROCESSING" | "SHIPPED" | "DELIVERED"
POST
/api/v1/orgs/:orgSlug/ordersCreate a new order
Authentication: API Key (write:orders)
Request Body
{
"customerId": "string",
"items": "OrderItem[]",
"shippingAddress": "Address",
"paymentMethod": "string"
}Customers
Manage customer data
GET
/api/v1/orgs/:orgSlug/customersList all customers
Authentication: API Key
POST
/api/v1/orgs/:orgSlug/customersCreate a new customer
Authentication: API Key (write:customers)
Request Body
{
"email": "string (required)",
"name": "string",
"phone": "string"
}Code Examples
JavaScript / Node.js
const API_KEY = 'pblo_live_your_api_key'
const ORG_SLUG = 'your-org'
// Fetch products
const response = await fetch(
`https://app.preblo.com/api/v1/orgs/${ORG_SLUG}/products`,
{
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
}
}
)
const data = await response.json()
console.log(data.products)cURL
curl -X GET "https://app.preblo.com/api/v1/orgs/your-org/products" \ -H "Authorization: Bearer pblo_live_your_api_key" \ -H "Content-Type: application/json"
Python
import requests
API_KEY = 'pblo_live_your_api_key'
ORG_SLUG = 'your-org'
response = requests.get(
f'https://app.preblo.com/api/v1/orgs/{ORG_SLUG}/products',
headers={
'Authorization': f'Bearer {API_KEY}',
'Content-Type': 'application/json'
}
)
data = response.json()
print(data['products'])