This document provides detailed information about the next-external-pricen-data-api
, which allows users to upload various types of data in jsonl
format. The API is secured using an API key passed in the Authorization
header.
Base URL
The base URL for all API endpoints is:
Copy
https://next-api.pricen.io/v2/pricen/
Authentication
The API uses an API key for authentication. The key must be included in the Authorization
header of every request.
Security Scheme:
Type:
apiKey
Name:
Authorization
In:
header
Example:
Copy
Authorization: <API_KEY>
Bulk Transfer to Pricen
Pricen enables users to perform bulk uploads directly to their bulk uploads S3 bucket, provided the user has an account with an API key set up properly. With the API key, the user can request a signed URL to S3, which they can use to upload a gzipped json
or jsonl
file. Pricen will then process the file further. Using bulk upload is much more cost and time-efficient compared to pushing the same payloads in smaller batches through the REST API.
Bulk Transfer Steps
Obtain API Key: Ensure you have your API key, which enables you to call the Pricen endpoint for the pre-signed upload URL.
Request Pre-Signed URL: Make a
GET
request to the appropriate endpoint (e.g.,/bulk-uploads/orders-upload-link
).Save the URL: Save the pre-signed URL returned in the response.
Prepare Payload: Package your payload in the correct format (
json
orjsonl
) and compress it into a gzip buffer.Set Headers: Set the headers for the upload request:
Content-Encoding
:gzip
Content-Type
:application/json
ortext/plain
(if usingjsonl
).
Upload File: Upload the compressed file to the pre-signed URL.
Completion: Once the upload is complete, Pricen will process the file automatically.
Example Code for Bulk Transfer
Here’s an example of how to perform a bulk transfer using Node.js:
typescript
Copy
import axios from 'axios'; import fs from 'fs'; import zlib from 'zlib'; // Replace with your API key const token = 'YOUR_API_KEY'; // Replace with the appropriate endpoint const endpoint = 'https://next-api.pricen.io/v2/pricen/bulk-uploads/orders-upload-link'; // Step 1: Request pre-signed URL axios.get(endpoint, { headers: { Authorization: token, }, }) .then((response) => { const { uploadUrl, uploadFields } = response.data.data; // Step 2: Prepare payload const payload = JSON.stringify([ { soldFrom: 'www.acme-inc.com', orderNumber: 'ORD9876-11', orderLineNumber: 'ORD9876-11-1', createdAt: '2021-03-20T09:12:28Z', price: 99.95, currency: 'EUR', quantity: 1, sku: 'SKU-123456-Y4', }, ]); // Step 3: Compress payload const gzipBuffer = zlib.gzipSync(payload); // Step 4: Upload file return axios.put(uploadUrl, gzipBuffer, { headers: { 'Content-Encoding': 'gzip', 'Content-Type': 'application/json', ...uploadFields, }, }); }) .then(() => { console.log('Bulk upload completed successfully!'); }) .catch((error) => { console.error('Error during bulk upload:', error.response?.data || error.message); });
Architecture
The bulk transfer architecture involves the following steps:
Request Pre-Signed URL: The user requests a pre-signed URL from Pricen's API.
Upload File: The user uploads the gzipped file to the provided S3 URL.
Processing: Pricen processes the uploaded file and updates the relevant data in the system.
Open image-20250227-151922.png
Endpoints
1. Get Bulk Upload Link for Orders
Retrieve a pre-signed URL to upload OrderLine
objects in jsonl
format.
Endpoint:
/bulk-uploads/orders-upload-link
Method:
GET
Response:
Content-Type:
application/json
Schema:
BulkUploadResponse
Security:
NextExternalLambdaTokenAuthorizer
Example Response:
json
Copy
{ "requestId": "EhpTQixbAi0EMvg=", "data": { "uploadUrl": "https://name-of-bucket.s3.eu-north-1.amazonaws.com/", "uploadFields": { "Content-Type": "application/json", "Content-Encoding": "gzip", "bucket": "name-of-bucket", "X-Amz-Algorithm": "AWS4-HMAC-SHA256", "X-Amz-Credential": "ASIAXXX/20250117/some-aws-region-1/s3/aws4_request", "X-Amz-Date": "20250117T092725Z", "X-Amz-Security-Token": "ssijdhfksdjhfkljlsh", "key": "youraccountid/bulk-uploads/supplemental-data/products/COGS-2025-01-17T09:27:25.044Z.jsonl.gz", "Policy": "sfndklaskjldhf", "X-Amz-Signature": "3d93c156f943a2685faf5d87dca11b128f8217173a2826affa0905ccfacb887d" } } }
2. Get Bulk Upload Link for Competitor Products
Retrieve a pre-signed URL to upload CompetitorProductVariant
objects in jsonl
format.
Endpoint:
/bulk-uploads/competitor-upload-link
Method:
GET
Response:
Content-Type:
application/json
Schema:
BulkUploadResponse
Security:
NextExternalLambdaTokenAuthorizer
3. Get Bulk Upload Link for Store Products
Retrieve a pre-signed URL to upload StoreProduct
objects in jsonl
format.
Endpoint:
/bulk-uploads/store-products-upload-link
Method:
GET
Response:
Content-Type:
application/json
Schema:
BulkUploadResponse
Security:
NextExternalLambdaTokenAuthorizer
4. Get Bulk Upload Link for Stores
Retrieve a pre-signed URL to upload Store
objects in jsonl
format.
Endpoint:
/bulk-uploads/stores-upload-link
Method:
GET
Response:
Content-Type:
application/json
Schema:
BulkUploadResponse
Security:
NextExternalLambdaTokenAuthorizer
5. Get Bulk Upload Link for Products
Retrieve a pre-signed URL to upload ProductVariant
objects in jsonl
format.
Endpoint:
/bulk-uploads/products-upload-link
Method:
GET
Response:
Content-Type:
application/json
Schema:
BulkUploadResponse
Security:
NextExternalLambdaTokenAuthorizer
6. Get Bulk Upload Link for Supplemental Data
Retrieve a pre-signed URL to upload SupplementalData
objects in jsonl
format.
Endpoint:
/bulk-uploads/supplemental-data-upload-link
Method:
GET
Response:
Content-Type:
application/json
Schema:
BulkUploadResponse
Security:
NextExternalLambdaTokenAuthorizer
Data Models
1. OrderLineItem
Represents an order line item.
Required Fields:
soldFrom
orderNumber
orderLineNumber
createdAt
price
currency
quantity
sku
Properties:
1. OrderLineItem
Description:
The OrderLineItem
represents historical sales and transactional data. It captures detailed information about each line item in an order, such as the product sold, the price paid, the quantity, and the currency. This data is critical for training and using AI models to analyze sales trends, predict demand, and optimize pricing strategies. By providing a comprehensive view of past transactions, the OrderLineItem
enables the platform to generate actionable insights and improve decision-making.
Key Use Cases:
Training AI models for demand forecasting and pricing optimization.
Analyzing sales performance by product, channel, or region.
Calculating key metrics such as revenue, margins, and customer behavior.
Field | Type | Required | Description | Pricen Module |
|
| Yes | Name of the shop, channel, website, or POS. | Price optimization, Price Simulator, Promotions, Markdowns, Base Price |
|
| Yes | Order number of the whole order. | Price optimization, Price Simulator, Promotions, Markdowns, Base Price |
|
| Yes | Order line number of the product line item. | Price optimization, Price Simulator, Promotions, Markdowns, Base Price |
|
| Yes | Datetime of the creation date for the order in UTC. | Price optimization, Price Simulator, Promotions, Markdowns, Base Price |
|
| Yes | Price paid by the customer (all discounts, taxes, and charges included). | Price optimization, Price Simulator, Promotions, Markdowns, Base Price |
|
| Yes | Three-letter currency code (ISO-4217). | Price optimization, Price Simulator, Promotions, Markdowns, Base Price |
|
| Yes | Number of items sold. | Price optimization, Price Simulator, Promotions, Markdowns, Base Price |
|
| Yes | Unique identifier for the item. | Price optimization, Price Simulator, Promotions, Markdowns, Base Price |
|
| No | Grouping ID for bundled items. | Price optimization, Price Simulator, Promotions, Markdowns, Base Price |
|
| No | Amount of tax applied to the line item. | Price optimization, Price Simulator, Promotions, Markdowns, Base Price |
|
| No | Amount of discount applied to the line item. | Price optimization, Price Simulator, Promotions, Markdowns, Base Price |
|
| No | Original price of the line item (RRP). | Price optimization, Price Simulator, Promotions, Markdowns, Base Price |
|
| No | Additional properties related to the order. | Price optimization, Price Simulator, Promotions, Markdowns, Base Price |
2. ProductVariant
Description:
The ProductVariant
represents product information data, forming the core of the product catalog. It includes all basic attributes of a product variant, such as SKU, price, categories, and stock count. This data is essential for managing the product catalog, enabling dynamic pricing, and ensuring accurate inventory management. The ProductVariant
serves as the foundation for all product-related operations within the platform.
Key Use Cases:
Managing the product catalog and ensuring accurate product information.
Enabling dynamic pricing based on product attributes.
Supporting inventory management and stock tracking.
Required Fields:
gid
groupId
groupName
price
categories
currency
cogs
sku
stockCount
variantName
vatRate
Properties:
Field | Type | Required | Description | Pricen Module |
|
| Yes | Unique global identifier for the variant. | All Modules |
|
| Yes | Grouping ID for the variant. | All Modules |
|
| Yes | Name of the group this variant belongs to. | All Modules |
|
| Yes | Name of the variant. | All Modules |
|
| Yes | Price paid by the customer (with VAT). | All Modules |
|
| No | REGULAR retail price. | All Modules |
|
| Yes | Categories the item belongs to. | All Modules |
|
| Yes | Three-letter currency code (ISO-4217). | All Modules |
|
| Yes | SKU of the product. | All Modules |
|
| Yes | Cost of goods sold. | All Modules |
|
| No | Currency for COGS (if different from default). | All Modules |
|
| Yes | Number of items available in stock. | All Modules |
|
| No | Indicates if COGS is not available. | All Modules |
|
| No | Parent product ID (if applicable). | All Modules |
|
| No | Status of the product ( | All Modules |
|
| No | Indicates if stock count is not available. | All Modules |
|
| No | European Article Number. | All Modules |
|
| No | Manufacturer of the product. | All Modules |
|
| No | Brand of the product. | All Modules |
|
| No | URL to the product image. | All Modules |
|
| No | URL to the product page. | All Modules |
|
| No | Type of product. | All Modules |
|
| No | Indicates if the product is on sale. | All Modules |
|
| No | ISO date for the price (if in the past). | All Modules |
|
| No | Tags for grouping, searching, and sorting. | All Modules |
|
| No | Target margin percentage for the product. | All Modules |
|
| No | Recommended retail price. | All Modules |
|
| Yes | Default VAT rate in percentage. | All Modules |
|
| No | Inventory policy ( | All Modules |
|
| No | Other currencies and prices for the product. | All Modules |
|
| No | Additional properties related to the product. | All Modules |
3. CompetitorProductVariant
Description:
The CompetitorProductVariant
represents competitor pricing data, which is crucial for implementing competitive match rules in dynamic pricing. By capturing competitor prices, the platform can adjust pricing strategies to remain competitive in the market. This data is used to analyze competitor behavior, identify pricing trends, and optimize pricing decisions to maximize revenue and market share.
Key Use Cases:
Implementing competitive pricing strategies.
Monitoring competitor pricing trends.
Adjusting prices dynamically to stay competitive.
Example:
j
Copy
{ "gid": "BLUE-SHIRT-1-M", "competitorName": "Acme Inc.", "price": 99.95, "currency": "EUR", "sku": "SKU-123456-Y4", "dateForPrice": "2025-01-17" }
Required Fields:
gid
price
competitorName
currency
sku
dateForPrice
Properties:
3. CompetitorProductVariant
Represents a competitor's product variant.
Required fields:
gid
competitorName
price
dateForPrice
currency
sku
Optional fields:
compareAtPrice
productUrl
Field | Type | Required | Description | Pricen Module |
|
| Yes | Unique global identifier for the variant. | Dynamic Pricing Automation |
|
| Yes | Name of the competitor. | Dynamic Pricing Automation |
|
| Yes | Price paid by the customer (with VAT). | Dynamic Pricing Automation |
|
| Yes | ISO date for the price. | Dynamic Pricing Automation |
|
| Yes | Three-letter currency code (ISO-4217). | Dynamic Pricing Automation |
|
| Yes | SKU of the product. | Dynamic Pricing Automation |
|
| No | Regular retail price. | Dynamic Pricing Automation |
|
| No | url to the product. | Dynamic Pricing Automation |
4. StoreProduct
Description:
The StoreProduct
represents the mapping between products and stores. It is required for store-level and sales channel management, allowing businesses to manage product availability, pricing, and promotions at the store level. This data ensures that products are correctly associated with the appropriate stores and sales channels, enabling localized pricing and inventory management.
Key Use Cases:
Managing product availability and pricing at the store level.
Supporting localized pricing and promotions.
Enabling sales channel-specific product management.
Example:
json
Copy
{ "storeId": "store-123", "gid": "BLUE-SHIRT-1-M", "price": 99.95, "currency": "EUR", "sku": "SKU-123456-Y4"
Required Fields:
storeId
gid
Properties:
Field | Type | Required | Description | Pricen Module |
|
| Yes | Identifier for the store. | All Modules |
|
| Yes | Unique global identifier for the product. | All Modules |
5. Store
Description:
The Store
represents store information, including details such as store name, region, and pricing status. This data is essential for managing store operations, enabling businesses to track and manage stores effectively. The Store
object supports store-level analytics, pricing strategies, and inventory management.
Key Use Cases:
Managing store operations and configurations.
Enabling store-level analytics and reporting.
Supporting localized pricing and inventory management.
Example:
json
Copy
{ "storeName": "Acme Store #1", "pricingEnabled": true, "region": "North America", "zone": "West Coast" }
Required Fields:
storeName
pricingEnabled
Properties:
Field | Type | Required | Description | Pricen Module |
|
| Yes | Name of the store. | All Modules |
|
| Yes | Indicates if pricing is enabled for the store. | All Modules |
|
| No | Region where the store is located. | All Modules |
|
| No | Zone within the region where the store is located. | All Modules |
|
| No | Additional attributes related to the store. | All Modules |
6. SupplementalData
Description:
The SupplementalData
represents any additional product attributes that need to be loaded through the API. This data is used to enrich the product catalog with custom or extended attributes that are not part of the standard product schema. It allows businesses to include additional information, such as product specifications, custom tags, or metadata, to support advanced analytics and decision-making.
Key Use Cases:
Enriching the product catalog with custom attributes.
Supporting advanced analytics and reporting.
Enabling custom workflows and integrations.
Example:
json
Copy
{ "gid": "BLUE-SHIRT-1-M", "additionalProperties": { "color": "blue", "size": "M", "restockDate": "2025-02-01", "material": "cotton", "weight": "200g" } }
Required Fields:
gid
Properties:
Represents supplemental data for products.
Field | Type | Required | Description | Pricen Module |
|
| Yes | Unique global identifier for the product variant. | All Modules |
|
| No | Additional properties related to the supplemental data. | All Modules |
7. BulkUploadResponse
Represents the response for bulk upload requests.
Properties:
Field | Type | Description |
|
| Unique identifier for the request. |
|
| Contains the upload URL and required fields for the upload. |
|
| Pre-signed URL for uploading the file. |
|
| Fields required for the upload (e.g., |
Error Handling
All errors are returned in the following format:
json
Copy
{ "error": { "code": "ERROR_CODE", "message": "Description of the error." } }
Examples
Uploading Order Data
Call the
/bulk-uploads/orders-upload-link
endpoint to get the pre-signed URL.Upload the
jsonl
file containingOrderLineItem
objects to the provided URL.
Uploading Product Data
Call the
/bulk-uploads/products-upload-link
endpoint to get the pre-signed URL.Upload the
jsonl
file containingProductVariant
objects to the provided URL.
This concludes the API documentation for the next-external-pricen-data-api
. For further assistance, please contact support.
Frequently Asked Questions (FAQ)
1. How is the mapping between ProductVariant
and CompetitorProductVariant
done?
The mapping is done based on the gid
field, which can be any identifier you choose. It should be the same for both ProductVariant
and CompetitorProductVariant
. While EAN codes can be used, they are not mandatory. Our algorithms also rely on other parameters, and we have internal mappings even when products don’t have EAN codes.
2. How should I provide price history, and how long should it be for the demo?
For price history, we usually deduce the price from historical sales data. There is no need to provide explicit price history for products. For order history, we recommend providing 18 months of data to cover seasonality effectively.
3. Can I filter products by EAN code?
Yes, you can filter by all attributes, including EAN codes. You can place the EAN code in the gid
field or provide it as a separate field (ean
). Even the additionalProperties
can be used for filtering if configured.
4. Should I include promotional prices in the otherPrices
field?
No, promotional prices should not be included in the otherPrices
field. Instead, place the normal price in the compareAtPrice
field and the discounted price (what the customer pays) in the price
field.
5. Can I upload test data before submitting the final data for the client’s demo?
Yes, you can upload test data to the buckets returned by the API signed URL as many times as needed. We can clear out the data and repeat the process until everything is correct.
6. How should I reflect product availability?
Product availability is different from the variantStatus
field. Availability can be provided in the additionalProperties
field (e.g., availableForSale
). The variantStatus
field indicates whether the product is included in the product catalog and analytics. A disabled
status means the product is effectively "deleted" from the system.
7. What is the best timeframe for historical price and availability changes?
For our analytics, the most important data is order history (sales data). We recommend providing 12-18 months of order history to cover seasonality. While we can accept historical price and availability changes, they are less critical without corresponding sales data.