Skip to main content

Product Management API

The Product Management API allows you to manage product information in the Nilo platform. These endpoints help you create, update, and retrieve product data, including product details, images, and display configurations.

Understanding Products​

Products in Nilo represent items available for sale across different stores:

  • Product Structure

    • Unique internal code for identification (matches ERP)
    • Name and description for display
    • Brand and category associations
    • Display configurations for different unit presentations
    • Images (main and additional)
    • Status for enabling/disabling visibility
  • Product Hierarchy

    • Products belong to brands and categories
    • Support multiple display configurations
    • Maintain their own status and visibility
    • Can be managed individually or in batches

Important Considerations​

  1. Unique Codes: Each product requires a unique internal code matching your ERP system
  2. Display Configurations: Products can have multiple unit presentations (e.g., single unit, pack of 6)
  3. Image Management: Products support a main image and additional images
  4. Brand and Category: Products must be associated with valid brands and categories
  5. Status Control: Products can be enabled or disabled without deletion

Single Product Operations​

Create Product​

POST/product

Create a new product in the Nilo platform. This endpoint is used to register all product details including:

  • Product information (name, description, codes)
  • Brand and category associations
  • Display configurations (units, default display)
  • Product images

Request Body Parameters​

ParameterTypeRequiredDescription
namestringYesProduct name
internalCodestringYesProduct code (same as in ERP)
descriptionstringYesProduct description
brandInternalCodestringYesBrand code (same as in ERP)
categoryInternalCodestringYesCategory code (same as in ERP)
displayProductsarrayYesArray of display configurations (see below)
mainImagestringNoPublic URL of main product image
imagesarrayNoArray of additional public image URLs
codeDUNstringNoDUN code (same as in ERP)
codeUPCstringNoUPC code (same as in ERP)
weightintegerNoOrder positioning in listings
Image Management

The mainImage and images fields expect public and accessible URLs. During processing, Nilo will download the images, store them on Nilo servers, and distribute them through a CDN for optimized loading. Use high-quality images - the platform will automatically generate optimized versions for different devices.

Display Product Configuration​

ParameterTypeRequiredDescription
defaultbooleanYesWhether this is the default display
unitsintegerYesNumber of units in this display configuration
internalCodestringNoDisplay-specific code
codeDUNstringNoDUN code for this display (same as in ERP)
codeUPCstringNoUPC code for this display (same as in ERP)

Request Body Example​

{
"name": "Bebida 1L",
"internalCode": "12345",
"description": "Bebida refrescante 1L",
"brandInternalCode": "brand1",
"categoryInternalCode": "category1",
"displayProducts": [
{
"default": true,
"units": 1,
"internalCode": "12345.1"
}
],
"mainImage": "https://image.jpg",
"images": ["https://image1.jpg"]
}

Response Codes​

CodeDescription
200Product created successfully
400Invalid request parameters
401Unauthorized access

Example Usage​

const headers = {
Authorization: "YOUR_AUTH_TOKEN",
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
};

const data = {
name: "Bebida 1L",
internalCode: "12345",
description: "Bebida refrescante 1L",
brandInternalCode: "brand1",
categoryInternalCode: "category1",
displayProducts: [
{
default: true,
units: 1,
internalCode: "12345.1",
},
],
mainImage: "https://image.jpg",
images: ["https://image1.jpg"],
};

fetch("https://tm0cs5kjs6.execute-api.us-east-1.amazonaws.com/dev/product", {
method: "POST",
headers: headers,
body: JSON.stringify(data),
})
.then((response) => response.json())
.then((result) => console.log(result))
.catch((error) => console.log("error", error));

Get All Products​

GET/product

Retrieve a paginated list of all products. This endpoint is useful for:

  • Browsing through the product catalog
  • Implementing pagination in your application
  • Filtering products by enabled status

Query Parameters​

ParameterTypeRequiredDescription
takenumberNoNumber of items per page (default: 50, max: 50)
pagestringNoPage number (default: 1)
enabledbooleanNoFilter products by enabled status (true for active, false for inactive)
cursorstringNoCursor for pagination. First call use 0, then use the cursor from the previous response

Response Example​

{
"data": [
{
"name": "Bebida 1L",
"internalCode": "12345",
"description": "Bebida refrescante 1L",
"mainImage": "https://image.jpg",
"images": ["https://image1.jpg"],
"brand": {
"name": "Marca 1",
"internalCode": "brand1"
},
"category": {
"name": "Bebidas",
"internalCode": "category1"
},
"displayProducts": [
{
"default": true,
"units": 1,
"internalCode": "12345.1"
}
]
}
],
"page": {
"pageBased": {
"count": 100
},
"cursorBased": {
"hasNextPage": true,
"hasPreviousPage": false,
"firstCursor": "0",
"lastCursor": "49"
}
}
}

Example Usage​

const headers = {
Authorization: "YOUR_AUTH_TOKEN",
"x-api-key": "YOUR_API_KEY",
};

fetch(
"https://tm0cs5kjs6.execute-api.us-east-1.amazonaws.com/dev/product?take=10&page=1&enabled=true",
{
method: "GET",
headers: headers,
}
)
.then((response) => response.json())
.then((result) => console.log(result))
.catch((error) => console.log("error", error));

Get Product Details​

GET/product/{code}

Retrieve detailed information about a specific product. This endpoint returns:

  • Product metadata
  • Brand and category information
  • All display configurations
  • Product images

Path Parameters​

ParameterTypeDescription
codestringProduct internal code (same as in ERP)

Response Example​

{
"name": "Bebida 1L",
"internalCode": "12345",
"description": "Bebida refrescante 1L",
"mainImage": "https://image.jpg",
"images": ["https://image1.jpg"],
"brand": {
"name": "Marca 1",
"internalCode": "brand1"
},
"category": {
"name": "Bebidas",
"internalCode": "category1"
},
"displayProducts": [
{
"default": true,
"units": 1,
"internalCode": "12345.1"
}
]
}

Example Usage​

const headers = {
Authorization: "YOUR_AUTH_TOKEN",
"x-api-key": "YOUR_API_KEY",
};

fetch(
"https://tm0cs5kjs6.execute-api.us-east-1.amazonaws.com/dev/product/12345",
{
method: "GET",
headers: headers,
}
)
.then((response) => response.json())
.then((result) => console.log(result))
.catch((error) => console.log("error", error));

Upsert Product​

PUT/product

Create or update a product in the Nilo platform. This endpoint is useful when you need to:

  • Create a new product if it doesn't exist
  • Update an existing product with new information

Request Body Parameters​

ParameterTypeRequiredDescription
internalCodestringYesProduct code (same as in ERP)
namestringYesProduct name
descriptionstringYesProduct description
brandInternalCodestringYesBrand code (same as in ERP)
categoryInternalCodestringYesCategory code (same as in ERP)
displayProductsarrayYesArray of display configurations
enabledbooleanYesWhether the product is active
mainImagestringNoPublic URL of main product image
imagesarrayNoArray of additional public image URLs
codeDUNstringNoDUN code (same as in ERP)
codeUPCstringNoUPC code (same as in ERP)
weightintegerNoOrder positioning in listings
Image Management

The mainImage and images fields expect public and accessible URLs. During processing, Nilo will download the images, store them on Nilo servers, and distribute them through a CDN for optimized loading.

Request Body Example​

{
"internalCode": "12345",
"name": "Bebida 1L",
"description": "Bebida refrescante 1L",
"brandInternalCode": "brand1",
"categoryInternalCode": "category1",
"enabled": true,
"mainImage": "https://image.jpg",
"images": ["https://image1.jpg"],
"codeDUN": "codeDUN123",
"codeUPC": "codeUPC123",
"weight": 1,
"displayProducts": [
{
"default": true,
"units": 1,
"internalCode": "12345.1"
}
]
}

Response Codes​

CodeDescription
200Product upserted successfully
404Product not found

Example Usage​

const headers = {
Authorization: "YOUR_AUTH_TOKEN",
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
};

const data = {
internalCode: "12345",
name: "Bebida 1L",
description: "Bebida refrescante 1L",
brandInternalCode: "brand1",
categoryInternalCode: "category1",
enabled: true,
mainImage: "https://image.jpg",
images: ["https://image1.jpg"],
displayProducts: [
{
default: true,
units: 1,
internalCode: "12345.1",
},
],
};

fetch("https://tm0cs5kjs6.execute-api.us-east-1.amazonaws.com/dev/product", {
method: "PUT",
headers: headers,
body: JSON.stringify(data),
})
.then((response) => response.json())
.then((result) => console.log(result))
.catch((error) => console.log("error", error));

Change Product Status​

PUT/product/{code}/status

Update the status of a product or specific display. This endpoint allows you to:

  • Enable/disable a product
  • Update the status of specific display configurations
  • Manage product visibility in catalogs

Path Parameters​

ParameterTypeRequiredDescription
codestringYesProduct internal code (same as in ERP)

Request Body Parameters​

ParameterTypeRequiredDescription
enabledbooleanYesWhether the product/display should be enabled
unitsintegerNoSpecific display units to update (if not provided, updates entire product)

Request Body Example​

{
"enabled": true,
"units": 1
}

Response Codes​

CodeDescription
200Status updated successfully
400Invalid request parameters
404Product not found

Example Usage​

const headers = {
Authorization: "YOUR_AUTH_TOKEN",
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
};

const data = {
enabled: true,
units: 1,
};

fetch(
"https://tm0cs5kjs6.execute-api.us-east-1.amazonaws.com/dev/product/12345/status",
{
method: "PUT",
headers: headers,
body: JSON.stringify(data),
}
)
.then((response) => response.json())
.then((result) => console.log(result))
.catch((error) => console.log("error", error));

Batch Operations​

Change Product Status in Batch​

POST/batch/product/status

Enables or disables multiple products asynchronously. Each item requires code and enabled; units is optional. The response returns 202 Accepted with batchIds, which can be followed through the Batch Operations API.

{
"items": [
{ "code": "PRODUCT-001", "enabled": true, "units": 100 },
{ "code": "PRODUCT-002", "enabled": false }
]
}

Required permission: supplier/product.bulkwrite.

Batch Product Operations​

POST/batch/product

Perform bulk operations on products. This endpoint allows you to:

  • Create multiple new products
  • Update existing products
  • Upsert products (update or create if not exists)

The batch operation is processed asynchronously, meaning you'll receive an immediate acknowledgment of the request, and the updates will be processed in the background.

Image Management

The mainImage and images fields expect public and accessible URLs. During processing, Nilo will download the images, store them on Nilo servers, and distribute them through a CDN for optimized loading.

Request Body Parameters​

ParameterTypeDescription
createarrayArray of products to create
updatearrayArray of products to update
upsertarrayArray of products to update or create if needed

Each product in the arrays supports the following fields: internalCode, name, description, brandInternalCode, categoryInternalCode, displayProducts, enabled, mainImage, images, codeDUN, codeUPC, weight.

Request Body Example​

{
"create": [
{
"name": "New Product",
"internalCode": "67890",
"description": "New product description",
"brandInternalCode": "brand2",
"categoryInternalCode": "category2",
"enabled": true,
"mainImage": "https://image.jpg",
"images": ["https://image1.jpg"],
"displayProducts": [
{
"default": true,
"units": 1,
"internalCode": "67890.1"
}
]
}
],
"update": [
{
"internalCode": "12345",
"name": "Updated Product Name",
"description": "Updated description",
"brandInternalCode": "brand2",
"categoryInternalCode": "category2",
"enabled": true,
"mainImage": "https://image.jpg",
"images": ["https://image1.jpg"],
"displayProducts": [
{
"default": true,
"units": 1,
"internalCode": "12345.1"
}
]
}
],
"upsert": [
{
"internalCode": "12345",
"name": "Upserted Product Name",
"description": "Upserted description",
"brandInternalCode": "brand2",
"categoryInternalCode": "category2",
"enabled": true,
"mainImage": "https://image.jpg",
"images": ["https://image1.jpg"],
"displayProducts": [
{
"default": true,
"units": 1,
"internalCode": "12345.1"
}
]
}
]
}

Response Codes​

CodeDescription
202Batch request accepted for processing
400Invalid request parameters
401Unauthorized access

Example Usage​

const headers = {
Authorization: "YOUR_AUTH_TOKEN",
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
};

const data = {
upsert: [
{
internalCode: "12345",
name: "Upserted Product Name",
description: "Upserted description",
brandInternalCode: "brand2",
categoryInternalCode: "category2",
enabled: true,
mainImage: "https://image.jpg",
images: ["https://image1.jpg"],
displayProducts: [
{
default: true,
units: 1,
internalCode: "12345.1",
},
],
},
],
};

fetch(
"https://tm0cs5kjs6.execute-api.us-east-1.amazonaws.com/dev/batch/product",
{
method: "POST",
headers: headers,
body: JSON.stringify(data),
}
)
.then((response) => response.json())
.then((result) => console.log(result))
.catch((error) => console.log("error", error));

Response Types​

Success Response​

{
"code": 200,
"message": "Operation successful"
}

Batch Operation Response​

{
"code": 202,
"batchIds": {
"create": ["550e8400-e29b-41d4-a716-446655440000"],
"update": [],
"upsert": []
},
"message": "Batch processing started"
}

Error Response​

{
"code": 400,
"message": "Invalid request parameters"
}

Best Practices​

  1. Product Management

    • Use consistent naming conventions
    • Maintain accurate product descriptions
    • Keep brand and category associations updated
    • Implement proper status management
  2. Display Configuration

    • Define clear unit presentations
    • Set appropriate default displays
    • Maintain consistent internal codes
    • Document unit configurations
  3. Image Handling

    • Use high-quality images with public URLs
    • Nilo will download and optimize images automatically
    • Images are distributed through CDN for fast loading
    • Platform generates optimized versions for different devices
  4. Performance Optimization

    • Use batch operations for multiple updates
    • Implement proper caching strategies
    • Optimize image delivery
    • Monitor API usage patterns

Common Use Cases​

  1. Initial Product Setup

    • Create basic product information
    • Configure display units
    • Upload product images
    • Set brand and category associations
  2. Product Maintenance

    • Update product information
    • Manage product visibility
    • Update display configurations
    • Refresh product images
  3. Bulk Operations

    • Import multiple products
    • Update product statuses
    • Modify display configurations
    • Sync product data
  4. Product Integration

    • Connect with inventory systems
    • Implement product search
    • Configure product displays
    • Set up product filtering

Implementation Guidelines​

  1. Product Creation

    • Validate all required fields
    • Check for duplicate codes
    • Process product images
    • Set default configurations
  2. Product Updates

    • Verify product existence
    • Handle partial updates
    • Manage image changes
    • Update related entities
  3. Display Management

    • Handle unit configurations
    • Update default displays
    • Maintain display codes
    • Validate unit values
  4. Batch Processing

    • Validate batch data
    • Handle partial failures
    • Implement rollback
    • Report batch results

Security​

All API endpoints require two types of authentication:

  1. API Key in header: x-api-key
  2. Authorization token in header: Authorization

Required Permissions​

For product management endpoints, the following permissions are required:

  • For read operations: supplier/product.read
  • For write operations: supplier/product.write
  • For bulk operations: supplier/product.bulkwrite

Error Codes​

When an operation fails, the API returns a structured error response:

{
"code": 404,
"message": "PRODUCT_NOT_FOUND",
"object": {
"statusCode": 404,
"code": "PRODUCT_NOT_FOUND",
"message": "Product not found",
"entity": "product",
"entityCode": "PROD-001",
"timestamp": "2026-05-18T15:16:47.000Z"
}
}

The object field provides additional context about the error:

FieldDescription
statusCodeHTTP status code
codeError code (same as top-level message)
messageHuman-readable error description
entityEntity type that caused the error
entityCodeThe internalCode of the entity involved
timestampWhen the error occurred (ISO 8601)

404 — Not Found​

Error CodeDescription
PRODUCT_NOT_FOUNDThe product does not exist for the given internal code

409 — Conflict​

Error CodeDescription
PRODUCT_NAME_ALREADY_EXISTA product with the same name already exists
PRODUCT_CODE_ALREADY_EXISTA product with the same internal code already exists

Error Handling​

  1. Input Validation

    • Validate all required fields
    • Check data types and formats
    • Verify image specifications
    • Validate internal codes
  2. Error Responses

    • Use appropriate HTTP status codes
    • Provide detailed error messages
    • Include field-level errors
    • Add error tracking codes
  3. Recovery Procedures

    • Handle network failures
    • Implement retry logic
    • Maintain data consistency
    • Log error details
  4. Monitoring

    • Track error rates
    • Monitor API performance
    • Alert on critical errors
    • Analyze error patterns
Tana

Tana

Ask me anything about Nilo's API — endpoints, authentication, integration guides, or code examples.

Best practice: validate against the official documentation for the most up-to-date details.