Getting Started

The SnowBee Public API allows you to integrate your e-commerce platform with SnowBee's inventory and order management system. This guide will help you get started with authentication and making your first API calls.

Prerequisites

Before you begin, you'll need:

Authentication

The SnowBee API uses OAuth 2.0 with the client credentials flow. To authenticate, make a POST request to the token endpoint:

POST https://api.snowbee.no/v1/tenants/TENANT_ID/oauth2/v2.0/token
Content-Type: application/json

{
  "client_id": "your-client-id",
  "client_secret": "your-client-secret",
  "grant_type": "client_credentials",
  "scope": "ecom",
  "resource": "your-ecom-store-id"
}

Request Parameters

ParameterDescription
client_idYour API client identifier
client_secretYour API client secret
grant_typeMust be client_credentials
scopeEither ecom or loyalty_programs
resourceThe ID of the eCom Store or Loyalty Program you want to access

Response

{
  "expires_in": 3600,
  "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
}

The access_token is a JWT that expires in 1 hour (3600 seconds). Include it in the Authorization header for all subsequent API calls:

Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...

Base URL

All API requests should be made to:

https://api.snowbee.no/v1/tenants/TENANT_ID/ecom_stores/ECOM_STORE_ID/

Replace TENANT_ID and ECOM_STORE_ID with your actual values.

Rate Limiting

The API enforces rate limiting to ensure fair usage:

If you exceed the rate limit, you'll receive a 429 Too Many Requests response. Implement exponential backoff in your client.

API Endpoints Overview

Product Catalog

EndpointDescription
GET /products/:productIdGet product details with SKUs, images, and prices
GET /skus/:skuId/inventoryGet inventory availability by location
GET /campaignsList active and planned campaigns with SKU pricing
POST /products/trigger_eventsTrigger ProductSaved events for initial sync
POST /inventory/trigger_eventsTrigger InventoryOnHandChanged events for initial sync

Product Schema (Reference Data)

EndpointDescription
GET /product_schema/brandsList all brands
GET /product_schema/product_categoriesList product categories
GET /product_schema/main_product_groupsList main product groups
GET /product_schema/sub_product_groupsList sub product groups
GET /product_schema/product_conceptsList product concepts
GET /product_schema/exclusivity_levelsList exclusivity levels
GET /product_schema/main_activitiesList main activities
GET /product_schema/product_colorsList colors with color codes
GET /product_schema/sizesList sizes with sort order
GET /product_schema/dynamic_attributesList custom attributes
GET /product_schema/dynamic_attributes_optionsList options for dynamic attributes
GET /product_schema/unit_of_measuresList units of measure

Orders

EndpointDescription
POST /ordersCreate a new sales order
GET /orders/:orderIdGet order details including invoices

Customers

EndpointDescription
PUT /customers/:customerIdCreate or update customer (idempotent)
GET /customers/:customerIdGet customer details
PUT /customers/:customerId/addressesUpdate customer delivery and invoice addresses
GET /customers/:customerId/ordersGet customer order history
PUT /push-customerCreate/update customer by phone number

Click & Collect

EndpointDescription
POST /click_and_collectCreate a click & collect reservation
GET /retail_storesList retail stores for click & collect

Example: Create an Order

curl -X POST "https://api.snowbee.no/v1/tenants/TENANT_ID/ecom_stores/ECOM_STORE_ID/orders" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "customerId": "019c1234-5678-7abc-8def-123456789012",
    "deliveryAddress": {
      "name": "John Doe",
      "street": "Main Street 1",
      "postCode": "0123",
      "city": "Oslo",
      "countryIsoCode": "NO",
      "email": "john@example.com",
      "phone": "+4712345678"
    },
    "invoiceAddress": {
      "street": "Main Street 1",
      "postCode": "0123",
      "city": "Oslo",
      "countryIsoCode": "NO",
      "email": "john@example.com"
    },
    "lineItems": [
      {
        "skuId": "019c1234-5678-7abc-8def-123456789013",
        "quantity": 2,
        "netUnitPrice": 199.00,
        "vatRate": 25.00
      }
    ]
  }'

Line Item SKU Identification

You can identify SKUs in line items using either skuId or skuNumber:

// Using SKU ID (UUID)
{ "skuId": "019c1234-5678-7abc-8def-123456789013", "quantity": 2, ... }

// Using SKU number (your product code)
{ "skuNumber": "PROD-BLK-M", "quantity": 2, ... }

At least one of skuId or skuNumber must be provided for each line item.

Order Constraints

Example: Click & Collect Reservation

curl -X POST "https://api.snowbee.no/v1/tenants/TENANT_ID/ecom_stores/ECOM_STORE_ID/click_and_collect" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "retailStoreId": "019c1234-5678-7abc-8def-123456789012",
    "reservationName": "John Doe",
    "customerId": null,
    "lineItems": [
      {
        "skuId": "019c1234-5678-7abc-8def-123456789013",
        "quantity": 1
      }
    ]
  }'

Response:

{
  "parkedCartId": "019c1234-5678-7abc-8def-123456789014",
  "cartId": "019c1234-5678-7abc-8def-123456789015",
  "reservationName": "John Doe",
  "retailStoreId": "019c1234-5678-7abc-8def-123456789012",
  "retailStoreName": "Oslo Store",
  "lineItems": [
    {
      "cartLineId": "019c1234-5678-7abc-8def-123456789016",
      "skuId": "019c1234-5678-7abc-8def-123456789013",
      "skuNumber": "SKU-001",
      "productName": "Blue T-Shirt",
      "quantity": 1,
      "reservedFromWarehouse": "Oslo Store Warehouse"
    }
  ],
  "createdAt": "2025-01-20T10:30:00.000Z"
}

Click & Collect Constraints

Example: Get Campaigns

curl -X GET "https://api.snowbee.no/v1/tenants/TENANT_ID/ecom_stores/ECOM_STORE_ID/campaigns" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Response:

{
  "campaigns": [
    {
      "id": "019c1234-5678-7abc-8def-123456789012",
      "code": "SUMMER24",
      "name": "Summer Sale 2024",
      "validFrom": "2024-06-01",
      "validTo": "2024-08-31",
      "currencyIsoCode": "NOK",
      "status": "ACTIVE",
      "skus": [
        {
          "skuId": "019c1234-5678-7abc-8def-123456789013",
          "campaignPrice": 299.00
        }
      ]
    }
  ]
}

Campaign statuses:

Error Handling

The API returns standard HTTP status codes:

Status CodeDescription
200Success
201Created successfully
400Bad request - check your request body
401Unauthorized - invalid or expired token
403Forbidden - you don't have access to this resource
404Not found - resource doesn't exist or SKU not in assortment
409Conflict - e.g., duplicate customer phone/email
429Too many requests - rate limit exceeded
500Internal server error

Error responses include a JSON body with details:

{
  "error": "INVALID_REQUEST",
  "message": "Order must contain at least one line item"
}

Common Error Codes

Error CodeDescription
INVALID_REQUESTRequest validation failed (missing fields, invalid format)
BAD_REQUESTRequest body could not be parsed (invalid JSON, wrong types)
SKU_NOT_FOUNDSKU not found in store assortment. Message includes the SKU ID or number.
CUSTOMER_NOT_FOUNDCustomer with the specified ID does not exist
UNAUTHORIZEDMissing or invalid authentication token
FORBIDDENToken valid but lacks permission for this resource

Important Notes

Next Steps