Store Management API
The Store Management API allows you to manage store information in the Nilo platform. These endpoints help you create, update, and retrieve store data, including store details, users, credit information, and settings.
Understanding Stores
Stores in Nilo represent the retail locations that can place orders:
-
Store Structure
- Unique internal code (matches ERP)
- Owner and legal information
- Address and location data
- User associations (via phone or email)
- Credit and payment status
- Settings and configurations
- Group associations (price lists, stock, promotions)
-
Store Hierarchy
- Independent entities with unique identifiers
- Can have multiple associated users
- Maintain their own credit status
- Can belong to different groupers
- Support batch operations for updates
Important Considerations
- Unique Codes: Each store requires a unique internal code that matches your ERP system
- User Management: Users are associated via phone number (with country code) or email
- Credit System: Stores have credit limits and payment status tracking
- Location Data: Stores require accurate address and geolocation information
- Multiple Groupers: Stores can belong to multiple promotion groupers if configured
- Batch Operations: Support for efficiently updating multiple stores
Single Store Operations
Create Store
/storeCreate a new store in the Nilo platform. This endpoint is used to register all store details including:
- Store information (owner name, legal details)
- Address and location data
- Contact information
- Group associations
Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| ownerName | string | Yes | Name of the store owner |
| ownerIdentifier | string | No | Owner identifier |
| internalCode | string | Yes | Store code (matches ERP) |
| addresses | array | Yes | List of store addresses |
| legalName | string | Yes | Legal business name |
| legalId | string | Yes | Legal business identifier |
| latitude | string | No | Store latitude |
| longitude | string | No | Store longitude |
| addressFormat | string | No | Google Maps formatted address |
| supportContactEmail | string | No | Email for support contact |
| supportContactPhone | string | No | Phone for support contact |
| promotionGrouperCode | string | No | Code for promotion group association |
| promotionGrouperCodes | array | No | Array of promotion grouper codes (only if multiple grouper configuration is enabled by Nilo) |
| stockGrouperCode | string | No | Code for stock group association |
| priceListCode | string | No | Code for price list association |
| routeCode | string | No | Route code for delivery |
| settings | object | No | Store settings (dropSize, etc.) |
addresses array items:
| Parameter | Type | Required | Description |
|---|---|---|---|
| internalCode | string | No | Address code (same as in ERP) |
| addressLine | string | Yes | Full address |
| apartmentNumber | string | No | Apartment/unit number |
| zipCode | string | No | ZIP/postal code |
settings object:
| Parameter | Type | Required | Description |
|---|---|---|---|
| dropSize | object | No | Minimum order amount (amount, currency) |
Request Body Example
{
"ownerName": "Owner name",
"ownerIdentifier": "Owner identifier",
"internalCode": "1234",
"addresses": [
{
"internalCode": "1234",
"addressLine": "25 de mayo 1200, Buenos Aires, Argentina",
"apartmentNumber": "2",
"zipCode": "2400"
}
],
"legalName": "Legal Name S.A.",
"legalId": "30-12345678-9",
"latitude": "-34.545278",
"longitude": "-58.449722",
"addressFormat": "Av. Pres. Figueroa Alcorta 7597, C1428 Buenos Aires",
"supportContactEmail": "support@store.com",
"supportContactPhone": "+5491123456789",
"promotionGrouperCode": "1234",
"stockGrouperCode": "6789",
"priceListCode": "1222",
"routeCode": "ROUTE1",
"settings": {
"dropSize": {
"amount": 1000,
"currency": "USD"
}
}
}
Response Codes
| Code | Description |
|---|---|
| 200 | Successful operation |
| 404 | Store not found |
Get All Stores
/storeRetrieve a paginated list of all stores. This endpoint is useful for:
- Browsing through the store catalog
- Implementing cursor-based pagination
- Filtering stores by enabled status
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| take | number | No | Number of items per page (default: 50, max: 50) |
| page | string | No | Page number (default: 1) |
| cursor | string | No | Cursor for pagination. First call should pass 0, subsequent calls should use the cursor from the last item of the previous response |
| enabled | boolean | No | Filter by enabled status |
Example Usage
- Javascript
- Python
const headers = {
Authorization: "YOUR_AUTH_TOKEN",
"x-api-key": "YOUR_API_KEY",
};
fetch(
"https://tm0cs5kjs6.execute-api.us-east-1.amazonaws.com/dev/store?take=50&cursor=0&enabled=true",
{
method: "GET",
headers: headers,
}
)
.then((response) => response.json())
.then((result) => console.log(result))
.catch((error) => console.log("error", error));
import requests
url = "https://tm0cs5kjs6.execute-api.us-east-1.amazonaws.com/dev/store"
params = {
"take": 50,
"cursor": 0,
"enabled": True
}
headers = {
'Authorization': 'YOUR_AUTH_TOKEN',
'x-api-key': 'YOUR_API_KEY'
}
response = requests.get(url, headers=headers, params=params)
print(response.text)
Upsert Store
/storeCreate a new store or update an existing one based on the internal code. This is useful for:
- Syncing store data from your ERP
- Creating stores if they don't exist, updating if they do
- Simplifying store management logic
Request Body Parameters
Same as Create Store, with enabled being required:
| Parameter | Type | Required | Description |
|---|---|---|---|
| internalCode | string | Yes | Store code (matches ERP) - used to find existing store |
| ownerName | string | Yes | Name of the store owner |
| addresses | array | Yes | List of store addresses |
| legalName | string | Yes | Legal business name |
| legalId | string | Yes | Legal business identifier |
| enabled | boolean | Yes | Whether the store is enabled |
| ownerIdentifier | string | No | Owner identifier |
| latitude | string | No | Store latitude |
| longitude | string | No | Store longitude |
| addressFormat | string | No | Google Maps formatted address |
| supportContactEmail | string | No | Email for support contact |
| supportContactPhone | string | No | Phone for support contact |
| promotionGrouperCode | string | No | Code for promotion group association |
| promotionGrouperCodes | array | No | Array of promotion grouper codes (only if multiple grouper configuration is enabled) |
| stockGrouperCode | string | No | Code for stock group association |
| priceListCode | string | No | Code for price list association |
| routeCode | string | No | Route code for delivery |
| latePayer | boolean | No | Whether the store is a late payer |
| settings | object | No | Store settings (dropSize, etc.) |
Request Body Example
{
"internalCode": "1234",
"ownerName": "Owner name",
"addresses": [
{
"addressLine": "25 de mayo 1200, Buenos Aires, Argentina",
"zipCode": "2400"
}
],
"legalName": "Legal Name S.A.",
"legalId": "30-12345678-9",
"enabled": true,
"stockGrouperCode": "6789",
"priceListCode": "1222"
}
Response Codes
| Code | Description |
|---|---|
| 200 | Successful operation |
| 404 | Store not found |
Get Store Details
/store/{code}Retrieve detailed information about a specific store. This endpoint returns:
- Store metadata
- Address information
- User associations
- Credit status
- Group associations
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| code | string | Yes | Store internal code (matches ERP) |
Response Codes
| Code | Description |
|---|---|
| 200 | Successful operation |
| 404 | Store not found |
Example Usage
- Javascript
- Python
const headers = {
Authorization: "YOUR_AUTH_TOKEN",
"x-api-key": "YOUR_API_KEY",
};
fetch("https://tm0cs5kjs6.execute-api.us-east-1.amazonaws.com/dev/store/1234", {
method: "GET",
headers: headers,
})
.then((response) => response.json())
.then((result) => console.log(result))
.catch((error) => console.log("error", error));
import requests
url = "https://tm0cs5kjs6.execute-api.us-east-1.amazonaws.com/dev/store/1234"
headers = {
'Authorization': 'YOUR_AUTH_TOKEN',
'x-api-key': 'YOUR_API_KEY'
}
response = requests.get(url, headers=headers)
print(response.text)
Update Store
/store/{code}Update an existing store's information. This endpoint allows you to:
- Modify store details
- Update address information
- Change group associations
- Adjust settings
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| code | string | Yes | Store internal code (matches ERP) |
Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| ownerName | string | Yes | Name of the store owner |
| addresses | array | Yes | List of store addresses |
| legalName | string | Yes | Legal business name |
| legalId | string | Yes | Legal business identifier |
| enabled | boolean | Yes | Whether the store is enabled |
| ownerIdentifier | string | No | Owner identifier |
| latitude | string | No | Store latitude |
| longitude | string | No | Store longitude |
| addressFormat | string | No | Google Maps formatted address |
| supportContactEmail | string | No | Email for support contact |
| supportContactPhone | string | No | Phone for support contact |
| promotionGrouperCode | string | No | Code for promotion group association |
| promotionGrouperCodes | array | No | Array of promotion grouper codes (only if multiple grouper configuration is enabled) |
| stockGrouperCode | string | No | Code for stock group association |
| priceListCode | string | No | Code for price list association |
| routeCode | string | No | Route code for delivery |
| latePayer | boolean | No | Whether the store is a late payer |
| settings | object | No | Store settings (dropSize, etc.) |
Request Body Example
{
"ownerName": "Owner name",
"ownerIdentifier": "Owner identifier",
"addresses": [
{
"internalCode": "1234",
"addressLine": "25 de mayo 1200, Buenos Aires, Argentina",
"apartmentNumber": "2",
"zipCode": "2400"
}
],
"latitude": "-34.545278",
"longitude": "-58.449722",
"addressFormat": "Av. Pres. Figueroa Alcorta 7597, C1428 Buenos Aires",
"legalName": "Legal Name S.A.",
"legalId": "30-12345678-9",
"enabled": true,
"supportContactEmail": "support@store.com",
"supportContactPhone": "+5491123456789",
"promotionGrouperCode": "1234",
"stockGrouperCode": "6789",
"priceListCode": "1222",
"routeCode": "1234",
"latePayer": false,
"settings": {
"dropSize": {
"amount": 1000,
"currency": "USD"
}
}
}
Response Codes
| Code | Description |
|---|---|
| 200 | Successful operation |
| 404 | Store not found |
Example Usage
- Javascript
- Python
const headers = {
Authorization: "YOUR_AUTH_TOKEN",
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
};
const data = {
ownerName: "Updated Owner Name",
addresses: [
{
addressLine: "New Address Line",
apartmentNumber: "3",
zipCode: "2401",
},
],
legalName: "Updated Legal Name",
promotionGrouperCode: "5678",
};
fetch("https://tm0cs5kjs6.execute-api.us-east-1.amazonaws.com/dev/store/1234", {
method: "PUT",
headers: headers,
body: JSON.stringify(data),
})
.then((response) => response.json())
.then((result) => console.log(result))
.catch((error) => console.log("error", error));
import requests
url = "https://tm0cs5kjs6.execute-api.us-east-1.amazonaws.com/dev/store/1234"
headers = {
'Authorization': 'YOUR_AUTH_TOKEN',
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
}
data = {
"ownerName": "Updated Owner Name",
"addresses": [
{
"addressLine": "New Address Line",
"apartmentNumber": "3",
"zipCode": "2401"
}
],
"legalName": "Updated Legal Name",
"promotionGrouperCode": "5678"
}
response = requests.put(url, headers=headers, json=data)
print(response.text)
Change Store Status
/store/{code}/statusEnable or disable a store. This endpoint allows you to:
- Control store visibility
- Manage store access
- Update operational status
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| code | string | Yes | Store internal code (matches ERP) |
Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| enabled | boolean | Yes | Whether the store should be enabled |
Request Body Example
{
"enabled": true
}
Example Usage
- Javascript
- Python
const headers = {
Authorization: "YOUR_AUTH_TOKEN",
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
};
const data = {
enabled: true,
};
fetch(
"https://tm0cs5kjs6.execute-api.us-east-1.amazonaws.com/dev/store/1234/status",
{
method: "PUT",
headers: headers,
body: JSON.stringify(data),
}
)
.then((response) => response.json())
.then((result) => console.log(result))
.catch((error) => console.log("error", error));
import requests
url = "https://tm0cs5kjs6.execute-api.us-east-1.amazonaws.com/dev/store/1234/status"
headers = {
'Authorization': 'YOUR_AUTH_TOKEN',
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
}
data = {
"enabled": True
}
response = requests.put(url, headers=headers, json=data)
print(response.text)
Manage Store Users
Add User by Phone
/store/{code}/add/userAdd a user to a store using their phone number. This endpoint allows:
- Associating new users with the store via phone
- Setting up user access
- Managing store personnel
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| code | string | Yes | Store internal code (matches ERP) |
Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| countryCode | string | Yes | Country code with + prefix (e.g., "+54") |
| phone | string | Yes | Phone number without country code |
| name | string | No | User's name |
Request Body Example
{
"countryCode": "+54",
"phone": "1123456789",
"name": "John Doe"
}
Response Codes
| Code | Description |
|---|---|
| 200 | Successful operation |
| 404 | Store not found |
Example Usage
- Javascript
- Python
const headers = {
Authorization: "YOUR_AUTH_TOKEN",
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
};
const data = {
countryCode: "+54",
phone: "1123456789",
name: "John Doe",
};
fetch(
"https://tm0cs5kjs6.execute-api.us-east-1.amazonaws.com/dev/store/1234/add/user",
{
method: "PUT",
headers: headers,
body: JSON.stringify(data),
}
)
.then((response) => response.json())
.then((result) => console.log(result))
.catch((error) => console.log("error", error));
import requests
url = "https://tm0cs5kjs6.execute-api.us-east-1.amazonaws.com/dev/store/1234/add/user"
headers = {
'Authorization': 'YOUR_AUTH_TOKEN',
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
}
data = {
"countryCode": "+54",
"phone": "1123456789",
"name": "John Doe"
}
response = requests.put(url, headers=headers, json=data)
print(response.text)
Add User by Email
/store/{code}/add/user-emailAdd a user to a store using their email address. This endpoint allows:
- Associating new users with the store via email
- Setting up user access for email-based authentication
- Managing store personnel
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| code | string | Yes | Store internal code (matches ERP) |
Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| string | Yes | User's email | |
| name | string | No | User's name |
Request Body Example
{
"email": "user@example.com",
"name": "John Doe"
}
Response Codes
| Code | Description |
|---|---|
| 200 | Successful operation |
| 404 | Store not found |
Example Usage
- Javascript
- Python
const headers = {
Authorization: "YOUR_AUTH_TOKEN",
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
};
const data = {
email: "user@example.com",
name: "John Doe",
};
fetch(
"https://tm0cs5kjs6.execute-api.us-east-1.amazonaws.com/dev/store/1234/add/user-email",
{
method: "PUT",
headers: headers,
body: JSON.stringify(data),
}
)
.then((response) => response.json())
.then((result) => console.log(result))
.catch((error) => console.log("error", error));
import requests
url = "https://tm0cs5kjs6.execute-api.us-east-1.amazonaws.com/dev/store/1234/add/user-email"
headers = {
'Authorization': 'YOUR_AUTH_TOKEN',
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
}
data = {
"email": "user@example.com",
"name": "John Doe"
}
response = requests.put(url, headers=headers, json=data)
print(response.text)
Remove Users
/store/{code}/remove/userRemove users from a store. This endpoint enables:
- Removing user associations
- Managing access control
- Updating store personnel
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| code | string | Yes | Store internal code (matches ERP) |
Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| users | array | Yes | Array of users to remove |
users array items:
| Parameter | Type | Required | Description |
|---|---|---|---|
| countryCode | string | Yes | Country code with + prefix (e.g., "+54") |
| phone | string | Yes | Phone number without country code |
Request Body Example
{
"users": [
{
"countryCode": "+54",
"phone": "1123456789"
},
{
"countryCode": "+54",
"phone": "1198765432"
}
]
}
Response Codes
| Code | Description |
|---|---|
| 200 | Successful operation |
| 404 | Store not found |
Example Usage
- Javascript
- Python
const headers = {
Authorization: "YOUR_AUTH_TOKEN",
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
};
const data = {
users: [
{ countryCode: "+54", phone: "1123456789" },
{ countryCode: "+54", phone: "1198765432" },
],
};
fetch(
"https://tm0cs5kjs6.execute-api.us-east-1.amazonaws.com/dev/store/1234/remove/user",
{
method: "PUT",
headers: headers,
body: JSON.stringify(data),
}
)
.then((response) => response.json())
.then((result) => console.log(result))
.catch((error) => console.log("error", error));
import requests
url = "https://tm0cs5kjs6.execute-api.us-east-1.amazonaws.com/dev/store/1234/remove/user"
headers = {
'Authorization': 'YOUR_AUTH_TOKEN',
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
}
data = {
"users": [
{"countryCode": "+54", "phone": "1123456789"},
{"countryCode": "+54", "phone": "1198765432"}
]
}
response = requests.put(url, headers=headers, json=data)
print(response.text)
Manage Store Credit
/store/{code}/creditUpdate store credit information. This endpoint allows:
- Setting credit limits
- Managing credit availability
- Updating payment terms
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| code | string | Yes | Store internal code (matches ERP) |
Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| creditLimit | number | Yes | New credit limit for the store |
Request Body Example
{
"creditLimit": 5000
}
Example Usage
- Javascript
- Python
const headers = {
Authorization: "YOUR_AUTH_TOKEN",
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
};
const data = {
creditLimit: 5000,
};
fetch(
"https://tm0cs5kjs6.execute-api.us-east-1.amazonaws.com/dev/store/1234/credit",
{
method: "POST",
headers: headers,
body: JSON.stringify(data),
}
)
.then((response) => response.json())
.then((result) => console.log(result))
.catch((error) => console.log("error", error));
import requests
url = "https://tm0cs5kjs6.execute-api.us-east-1.amazonaws.com/dev/store/1234/credit"
headers = {
'Authorization': 'YOUR_AUTH_TOKEN',
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
}
data = {
"creditLimit": 5000
}
response = requests.post(url, headers=headers, json=data)
print(response.text)
Payment Status Management
Set as Defaulter
/store/{code}/debtorMark a store as a defaulter. When a store is marked as a defaulter:
- New orders are blocked
- Credit access is restricted
- Payment status is updated
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| code | string | Yes | Store internal code (matches ERP) |
Example Usage
- Javascript
- Python
const headers = {
Authorization: "YOUR_AUTH_TOKEN",
"x-api-key": "YOUR_API_KEY",
};
fetch(
"https://tm0cs5kjs6.execute-api.us-east-1.amazonaws.com/dev/store/1234/debtor",
{
method: "POST",
headers: headers,
}
)
.then((response) => response.json())
.then((result) => console.log(result))
.catch((error) => console.log("error", error));
import requests
url = "https://tm0cs5kjs6.execute-api.us-east-1.amazonaws.com/dev/store/1234/debtor"
headers = {
'Authorization': 'YOUR_AUTH_TOKEN',
'x-api-key': 'YOUR_API_KEY'
}
response = requests.post(url, headers=headers)
print(response.text)
Set as Late Payer
/store/{code}/latepayerMark a store as a late payer. This status means:
- Store can place new orders
- Credit access is restricted
- Payment status is monitored
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| code | string | Yes | Store internal code (matches ERP) |
Example Usage
- Javascript
- Python
const headers = {
Authorization: "YOUR_AUTH_TOKEN",
"x-api-key": "YOUR_API_KEY",
};
fetch(
"https://tm0cs5kjs6.execute-api.us-east-1.amazonaws.com/dev/store/1234/latepayer",
{
method: "POST",
headers: headers,
}
)
.then((response) => response.json())
.then((result) => console.log(result))
.catch((error) => console.log("error", error));
import requests
url = "https://tm0cs5kjs6.execute-api.us-east-1.amazonaws.com/dev/store/1234/latepayer"
headers = {
'Authorization': 'YOUR_AUTH_TOKEN',
'x-api-key': 'YOUR_API_KEY'
}
response = requests.post(url, headers=headers)
print(response.text)
Batch Operations
Update Store Settings
/batch/store/settingUpdate settings for multiple stores simultaneously. This endpoint is useful for:
- Bulk configuration updates
- Standardizing store settings
- Efficient store management
Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| stores | array | Yes | Array of store settings to update |
Request Body Example for Batch Store Settings
{
"stores": [
{
"storeCode": "1234",
"settings": {
"credit": 5000,
"debtor": false,
"latePayer": false,
"allowPartialDelivery": true,
"minimumOrderAmount": 1000
}
},
{
"storeCode": "5678",
"settings": {
"credit": 10000,
"debtor": true,
"latePayer": true,
"allowPartialDelivery": false,
"minimumOrderAmount": 2000
}
}
]
}
Example Usage
- Javascript
- Python
const headers = {
Authorization: "YOUR_AUTH_TOKEN",
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
};
const data = {
stores: [
{
storeCode: "1234",
settings: {
credit: 5000,
debtor: false,
latePayer: false,
allowPartialDelivery: true,
minimumOrderAmount: 1000,
},
},
{
storeCode: "5678",
settings: {
credit: 10000,
debtor: true,
latePayer: true,
allowPartialDelivery: false,
minimumOrderAmount: 2000,
},
},
],
};
fetch(
"https://tm0cs5kjs6.execute-api.us-east-1.amazonaws.com/dev/batch/store/setting",
{
method: "POST",
headers: headers,
body: JSON.stringify(data),
}
)
.then((response) => response.json())
.then((result) => console.log(result))
.catch((error) => console.log("error", error));
import requests
url = "https://tm0cs5kjs6.execute-api.us-east-1.amazonaws.com/dev/batch/store/setting"
headers = {
'Authorization': 'YOUR_AUTH_TOKEN',
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
}
data = {
"stores": [
{
"storeCode": "1234",
"settings": {
"credit": 5000,
"debtor": False,
"latePayer": False,
"allowPartialDelivery": True,
"minimumOrderAmount": 1000
}
},
{
"storeCode": "5678",
"settings": {
"credit": 10000,
"debtor": True,
"latePayer": True,
"allowPartialDelivery": False,
"minimumOrderAmount": 2000
}
}
]
}
response = requests.post(url, headers=headers, json=data)
print(response.text)
Batch Store Updates
/batch/storePerform updates on multiple stores simultaneously. This endpoint supports:
- Creating multiple stores
- Updating existing stores
- Upserting store data
Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| create | array | No | Array of stores to create |
| update | array | No | Array of stores to update |
| upsert | array | No | Array of stores to upsert |
| remove | array | No | Array of store codes to remove |
Request Body Example for Batch Store
{
"create": [
{
"ownerName": "Owner name",
"ownerIdentifier": "Owner identifier",
"internalCode": "1234",
"addresses": [
{
"internalCode": "1234",
"addressLine": "25 de mayo 1200, Buenos aires, Argentina",
"apartmentNumber": "2",
"zipCode": "2400"
}
],
"latitude": "-34.545278°",
"longitude": "-58.449722",
"addressFormat": "Av. Pres. Figueroa Alcorta 7597, C1428 Buenos Aires",
"legalName": "legal name",
"legalId": "legal id",
"supportContactEmail": "string",
"supportContactPhone": "string",
"promotionGrouperCode": "1234",
"stockGrouperCode": "6789",
"pricelistCode": "1222",
"routeCode": "1234",
"settings": {
"dropSize": {
"amount": 1000,
"currency": "USD"
}
}
}
],
"update": [
{
"ownerName": "Owner name updated",
"ownerIdentifier": "Owner identifier updated",
"internalCode": "5678",
"addresses": [
{
"internalCode": "5678",
"addressLine": "New address",
"apartmentNumber": "3",
"zipCode": "2401"
}
],
"latitude": "-34.545278°",
"longitude": "-58.449722",
"addressFormat": "New complete address",
"legalName": "new legal name",
"legalId": "new legal id",
"enabled": true,
"supportContactEmail": "new@email.com",
"supportContactPhone": "1234567890",
"promotionGrouperCode": "PROMO2",
"stockGrouperCode": "STOCK2",
"pricelistCode": "PRICE2",
"routeCode": "ROUTE2",
"latePayer": true,
"settings": {
"dropSize": {
"amount": 2000,
"currency": "USD"
}
}
}
],
"upsert": [
{
"internalCode": "9012",
"ownerName": "Owner name upsert",
"ownerIdentifier": "Owner identifier upsert",
"addresses": [
{
"internalCode": "9012",
"addressLine": "Upsert address",
"apartmentNumber": "4",
"zipCode": "2402"
}
],
"latitude": "-34.545278°",
"longitude": "-58.449722",
"addressFormat": "Upsert complete address",
"legalName": "upsert legal name",
"legalId": "upsert legal id",
"enabled": true,
"supportContactEmail": "upsert@email.com",
"supportContactPhone": "0987654321",
"promotionGrouperCode": "PROMO3",
"stockGrouperCode": "STOCK3",
"pricelistCode": "PRICE3",
"routeCode": "ROUTE3",
"latePayer": false,
"settings": {
"dropSize": {
"amount": 3000,
"currency": "USD"
}
}
}
],
"remove": ["9012"]
}
Example Usage
- Javascript
- Python
const headers = {
Authorization: "YOUR_AUTH_TOKEN",
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
};
const data = {
create: [
{
ownerName: "Owner 1",
internalCode: "1234",
addresses: [
{
addressLine: "Address 1",
zipCode: "2400",
},
],
legalName: "Legal Name 1",
},
{
ownerName: "Owner 2",
internalCode: "5678",
addresses: [
{
addressLine: "Address 2",
zipCode: "2401",
},
],
legalName: "Legal Name 2",
},
],
update: [
{
ownerName: "Updated Owner Name",
ownerIdentifier: "Updated Owner Identifier",
internalCode: "5678",
addresses: [
{
internalCode: "5678",
addressLine: "New Address",
apartmentNumber: "3",
zipCode: "2401",
},
],
latitude: "-34.545278°",
longitude: "-58.449722",
addressFormat: "New Complete Address",
legalName: "Updated Legal Name",
enabled: true,
supportContactEmail: "updated@email.com",
supportContactPhone: "1234567890",
promotionGrouperCode: "PROMO2",
stockGrouperCode: "STOCK2",
pricelistCode: "PRICE2",
routeCode: "ROUTE2",
latePayer: true,
settings: {
dropSize: {
amount: 2000,
currency: "USD",
},
},
},
],
upsert: [
{
internalCode: "9012",
ownerName: "Upsert Owner Name",
ownerIdentifier: "Upsert Owner Identifier",
addresses: [
{
internalCode: "9012",
addressLine: "Upsert Address",
apartmentNumber: "4",
zipCode: "2402",
},
],
latitude: "-34.545278°",
longitude: "-58.449722",
addressFormat: "Upsert Complete Address",
legalName: "Upsert Legal Name",
legalId: "Upsert Legal ID",
enabled: true,
supportContactEmail: "upsert@email.com",
supportContactPhone: "0987654321",
promotionGrouperCode: "PROMO3",
stockGrouperCode: "STOCK3",
pricelistCode: "PRICE3",
routeCode: "ROUTE3",
latePayer: false,
settings: {
dropSize: {
amount: 3000,
currency: "USD",
},
},
},
],
remove: ["9012"],
};
fetch(
"https://tm0cs5kjs6.execute-api.us-east-1.amazonaws.com/dev/batch/store",
{
method: "POST",
headers: headers,
body: JSON.stringify(data),
}
)
.then((response) => response.json())
.then((result) => console.log(result))
.catch((error) => console.log("error", error));
import requests
url = "https://tm0cs5kjs6.execute-api.us-east-1.amazonaws.com/dev/batch/store"
headers = {
'Authorization': 'YOUR_AUTH_TOKEN',
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
}
data = {
"create": [
{
"ownerName": "Owner 1",
"internalCode": "1234",
"addresses": [
{
"addressLine": "Address 1",
"zipCode": "2400"
}
],
"legalName": "Legal Name 1"
},
{
"ownerName": "Owner 2",
"internalCode": "5678",
"addresses": [
{
"addressLine": "Address 2",
"zipCode": "2401"
}
],
"legalName": "Legal Name 2"
}
],
"update": [
{
"ownerName": "Updated Owner Name",
"ownerIdentifier": "Updated Owner Identifier",
"internalCode": "5678",
"addresses": [
{
"internalCode": "5678",
"addressLine": "New Address",
"apartmentNumber": "3",
"zipCode": "2401"
}
],
"latitude": "-34.545278°",
"longitude": "-58.449722",
"addressFormat": "New Complete Address",
"legalName": "Updated Legal Name",
"enabled": True,
"supportContactEmail": "updated@email.com",
"supportContactPhone": "1234567890",
"promotionGrouperCode": "PROMO2",
"stockGrouperCode": "STOCK2",
"pricelistCode": "PRICE2",
"routeCode": "ROUTE2",
"latePayer": True,
"settings": {
"dropSize": {
"amount": 2000,
"currency": "USD"
}
}
}
],
"upsert": [
{
"internalCode": "9012",
"ownerName": "Upsert Owner Name",
"ownerIdentifier": "Upsert Owner Identifier",
"addresses": [
{
"internalCode": "9012",
"addressLine": "Upsert Address",
"apartmentNumber": "4",
"zipCode": "2402"
}
],
"latitude": "-34.545278°",
"longitude": "-58.449722",
"addressFormat": "Upsert Complete Address",
"legalName": "Upsert Legal Name",
"legalId": "Upsert Legal ID",
"enabled": True,
"supportContactEmail": "upsert@email.com",
"supportContactPhone": "0987654321",
"promotionGrouperCode": "PROMO3",
"stockGrouperCode": "STOCK3",
"pricelistCode": "PRICE3",
"routeCode": "ROUTE3",
"latePayer": False,
"settings": {
"dropSize": {
"amount": 3000,
"currency": "USD"
}
}
}
],
"remove": ["9012"]
}
response = requests.post(url, headers=headers, json=data)
print(response.text)
Response Types
Success Response
{
"code": 200,
"message": "Operation successful",
"data": {
"ownerName": "Owner name",
"internalCode": "1234",
"addresses": [
{
"addressLine": "25 de mayo 1200, Buenos aires, Argentina",
"apartmentNumber": "2",
"zipCode": "2400"
}
],
"enabled": true
}
}
Error Response Examples
Store Not Found
{
"code": 404,
"message": "Store not found"
}
Validation Error
{
"code": 400,
"message": "Invalid store data",
"errors": [
{
"field": "internalCode",
"message": "Internal code is required"
}
]
}
Best Practices
-
Store Management
- Use consistent naming conventions
- Maintain accurate address information
- Implement proper status management
- Keep store information up to date
-
User Management
- Validate user information
- Maintain user access records
- Document user changes
- Implement user removal procedures
-
Credit Management
- Monitor credit limits
- Track payment history
- Document status changes
- Implement credit checks
-
Performance Optimization
- Use batch operations for multiple updates
- Implement caching strategies
- Monitor API usage
- Optimize data synchronization
Common Use Cases
-
Initial Store Setup
- Create store profile
- Configure user access
- Set up credit limits
- Configure group associations
-
Store Maintenance
- Update store information
- Manage user access
- Monitor credit status
- Adjust store settings
-
Bulk Operations
- Import multiple stores
- Update store settings
- Modify group associations
- Sync store data
-
Credit Management
- Monitor payment status
- Update credit limits
- Handle defaulters
- Process credit changes
Implementation Guidelines
-
Store Creation
- Validate required fields
- Check for duplicate codes
- Process address data
- Set up initial configurations
-
User Management
- Validate user credentials
- Handle user permissions
- Manage user associations
- Track user activities
-
Credit Handling
- Implement credit checks
- Process payment status
- Handle credit updates
- Monitor credit usage
-
Batch Processing
- Validate batch data
- Handle partial failures
- Implement rollback
- Report batch results
Security
All API endpoints require two types of authentication:
- API Key in header:
x-api-key - Authorization token in header:
Authorization
Required Permissions
For store management endpoints, the following permissions are required:
- For read operations:
supplier/store.read - For write operations:
supplier/store.write - For batch operations:
supplier/store.bulkwrite - For credit operations:
supplier/credit.write
Error Handling
-
Input Validation
- Validate store codes
- Verify address data
- Check user information
- Validate credit data
-
Error Responses
- Use appropriate HTTP codes
- Provide clear messages
- Include field-level errors
- Add error tracking
-
Recovery Procedures
- Handle network failures
- Implement retries
- Maintain data consistency
- Log error details
-
Monitoring
- Track error rates
- Monitor API performance
- Alert on critical errors
- Analyze error patterns