The Sjoppie API provides a comprehensive set of endpoints for managing products, variants, prices, stock, images, categories, and tags. The API follows RESTful principles and uses JSON for request and response bodies.
The API uses a two-factor authentication system:
-
API Key Authentication All API requests require an API key to be included in the request header:
X-API-Key: your-api-key -
User Authentication Most endpoints require user authentication using a Bearer token. To get a token:
- First, login using the authentication endpoint:
POST /auth/login
Request:
{ "email": "user@example.com", "password": "your-password" }Response:
{ "success": true, "status": 200, "data": { "user": { "id": 1, "name": "John Doe", "email": "user@example.com" }, "token": "your-bearer-token" }, "timestamp": "2024-04-25T12:00:00Z" }- Include the received token in subsequent requests:
Authorization: Bearer your-bearer-tokenNote: The login and logout endpoints only require the API key, not the Bearer token.
https://api.sjoppie.nl/v1
All responses follow a standardized format:
{
"success": true,
"status": 200,
"data": {
// Response data
},
"timestamp": "2024-04-25T12:00:00Z"
}Errors are returned with appropriate HTTP status codes and follow this format:
{
"success": false,
"status": 400,
"message": "Error message",
"errors": {
// Validation errors if applicable
},
"timestamp": "2024-04-25T12:00:00Z"
}Common authentication errors:
{
"success": false,
"status": 401,
"message": "Missing authentication token",
"timestamp": "2024-04-25T12:00:00Z"
}{
"success": false,
"status": 401,
"message": "Invalid or expired token",
"timestamp": "2024-04-25T12:00:00Z"
}{
"success": false,
"status": 401,
"message": "Invalid API key",
"timestamp": "2024-04-25T12:00:00Z"
}GET /products/{product}/imagesResponse:
{
"success": true,
"status": 200,
"data": [
{
"id": 1,
"product_id": 1,
"path": "https://example.com/image.jpg",
"alt_text": "Product image",
"order": 0,
"created_at": "2024-04-25T12:00:00Z",
"updated_at": "2024-04-25T12:00:00Z"
}
],
"timestamp": "2024-04-25T12:00:00Z"
}POST /products/{product}/imagesRequest:
{
"path": "https://example.com/image.jpg",
"alt_text": "Product image",
"order": 0
}PUT /products/{product}/images/{image}Request:
{
"path": "https://example.com/new-image.jpg",
"alt_text": "Updated product image",
"order": 1
}DELETE /products/{product}/images/{image}POST /products/{product}/images/reorderRequest:
{
"image_ids": [1, 2, 3]
}GET /products/{product}/pricesResponse:
{
"success": true,
"status": 200,
"data": [
{
"id": 1,
"price": 99.99,
"compare_at_price": 129.99,
"taxable": true,
"currency": "EUR",
"starts_at": "2024-04-25T00:00:00Z",
"ends_at": null,
"created_at": "2024-04-25T12:00:00Z",
"updated_at": "2024-04-25T12:00:00Z"
}
],
"timestamp": "2024-04-25T12:00:00Z"
}GET /products/{product}/prices/currentPOST /products/{product}/pricesRequest:
{
"price": 99.99,
"compare_at_price": 129.99,
"taxable": true,
"currency": "EUR",
"starts_at": "2024-04-25T00:00:00Z",
"ends_at": null
}PUT /products/{product}/prices/{price}Request:
{
"price": 89.99,
"compare_at_price": 119.99,
"taxable": true,
"currency": "EUR",
"starts_at": "2024-04-25T00:00:00Z",
"ends_at": "2024-05-25T00:00:00Z"
}DELETE /products/{product}/prices/{price}GET /products/{product}/stockResponse:
{
"success": true,
"status": 200,
"data": {
"id": 1,
"available": 100,
"on_hand": 120,
"reserved": 20,
"created_at": "2024-04-25T12:00:00Z",
"updated_at": "2024-04-25T12:00:00Z"
},
"timestamp": "2024-04-25T12:00:00Z"
}PUT /products/{product}/stockRequest:
{
"available": 100,
"on_hand": 120,
"reserved": 20
}PUT /products/{product}/stock/availableRequest:
{
"quantity": 100
}PUT /products/{product}/stock/on-handRequest:
{
"quantity": 120
}PUT /products/{product}/stock/reservedRequest:
{
"quantity": 20
}The API is rate-limited to prevent abuse. The current limits are:
- 100 requests per minute per API key
- 1000 requests per hour per API key
Rate limit headers are included in all responses:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 99
X-RateLimit-Reset: 1620000000
The API is versioned to ensure backward compatibility. The current version is v1.
For support, please contact:
- Email: support@sjoppie.nl
- Phone: +31 (0)20 123 4567