API Reference

Orders API

Bulk upsert order records with line items for a tenant

Overview

The Orders endpoint supports bulk creation and updates of order records for a tenant. Each request processes an array of order objects and applies upsert semantics based on OrderId.

Orders are associated with customers using the tenant's configured customer identifier and with products using identifiers provided in order line items.

This endpoint is used to synchronize transactional purchase data from upstream commerce, billing, or order-management systems into Replenit.

Quick Reference

Endpoints

POST/orders/{tenantId}
DELETE/orders/{tenantId}/{orderId}

Authentication

x-replenit-auth-keyheader required

Usage

  • • Record completed purchases
  • • Import historical orders
  • • Update order state (cancellation/refund)
  • • Synchronize transactions from external systems

Required Fields

  • OrderId
  • Currency

Base URL

https://api.replen.it

Response

Returns the number of processed orders

Endpoints

POST/orders/{tenantId}
DELETE/orders/{tenantId}/{orderId}

Parameters

ParameterTypeRequiredDescription
tenantIdGUIDYesTenant identifier

Request

  • Body: JSON array of UpsertOrderDto
  • Content-Type: application/json

Success Response

  • Status: 200 OK
  • Body: Response envelope containing data.count

Error Responses

StatusDescription
400Invalid request payload
404Tenant not found
500Internal server error

Identifier Behavior

Order Identification

  • Orders are uniquely identified by OrderId
  • If OrderId exists, the record is updated
  • If OrderId does not exist, a new order record is created

Customer Identification

Customer association depends on the tenant's identifier priority configuration.

Priority SettingIdentifier Used
Customer IdCustomerId
EmailEmail

Only the configured primary identifier is used for matching. Secondary identifiers may be stored but are not used for identity resolution.

Certain behaviors described in Replenit Ingestion APIs are controlled by tenant-level configuration in the Replenit platform, including customer identifier selection, supported languages, supported currencies, and tenant timezone. These settings determine how incoming order payloads are validated, matched, and processed.

Tenant configuration is managed in the Replenit platform under Settings → Tenant Settings. Access is limited to platform administrators.

If you are unsure about the current configuration, do not have access to tenant settings, or have questions about the correct setup for your integration, please contact your Replenit Customer Success Manager (CSM) or your internal platform administrator.

Changes to tenant settings apply to all subsequent API requests.

Identifier Alignment and PII Considerations

If CustomerId is used as the primary identifier, the same identifier must be configured and used consistently across downstream systems consuming Replenit data, including marketing automation, CRM, analytics, and activation platforms.

If Email is used as the primary identifier, the same email address must be configured consistently in downstream systems.

When a stable, non-PII CustomerId is available and already used across downstream systems, email address should not be relied on for identity resolution. In this case, email may be omitted unless required for downstream communication.

Replenit does not require email address when a stable CustomerId is available.

Inconsistent identifier usage may result in fragmented customer-order relationships and increased data governance risk.

Product Identification

Order line items reference products using:

  • ProductId
  • Sku

These identifiers must correspond to products ingested via the Products API.

Request Schema

UpsertOrderDto

FieldTypeMax LengthRequiredDefaultDescription
OrderIdstring100YesUnique order identifier
CustomerIdstringYesCustomer identifier
EmailstringYes, If no CustomerIdCustomer email
TotalQuantityintNo1Total item quantity
UniqueQuantityintNo1Number of unique items
TotalRevenuedoubleNo0Total order value
Currencystring3YesUSDISO 4217 currency code
OrderDatestringNoServer UTCISO-8601 datetime
IsOrderCancelledboolNofalseCancellation flag
OrderItemsarrayNo[]Order line items

CreateOrderItemDto

FieldTypeMax LengthRequiredDescription
ProductIdstring100YesProduct identifier
Skustring50YesProduct SKU
QuantityintYesItem quantity
PricedoubleYesItem price
OriginalPricedoubleNoPre-discount price
Sizestring50NoSize variant
Colorstring50NoColor variant
BrandstringNoBrand
IsGiftboolNoGift flag

Data Completeness & Decision Quality

Replenit's decisioning accuracy improves with broader and richer data across all entities, including users, products, orders, and events.

You are encouraged to send as many fields as possible for every object, as long as the data is:

  • Stable – consistently defined over time
  • Complete – high coverage across records
  • Reliable – not sparsely populated or frequently changing in meaning

While only a subset of fields is required for ingestion, additional attributes directly enhance:

  • Profiling accuracy (user, product, and behavioral)
  • Contextual understanding for decisioning
  • Reasoning quality for all downstream decisions (replenishment, substitution, cross-sell, churn prevention, etc.)

Rule of thumb:

If a field exists, is well-populated, and carries business meaning, it should be sent.

Optional fields never block ingestion, but richer payloads consistently produce better decisions.

Examples

Minimal Order

[
  {
    "OrderId": "O-791",
    "Currency": "USD"
  }
]

Standard Order (All Supported Fields)

[
  {
    "OrderId": "O-789",
    "CustomerId": "C-123",
    "Email": "customer@example.com",
    "TotalQuantity": 3,
    "UniqueQuantity": 2,
    "TotalRevenue": 89.97,
    "Currency": "USD",
    "OrderDate": "2025-08-23T10:30:00Z",
    "IsOrderCancelled": false,
    "OrderItems": [
      {
        "ProductId": "P-42",
        "Sku": "SKU-42-RED-L",
        "Quantity": 2,
        "Price": 29.99,
        "OriginalPrice": 39.99,
        "Size": "1l",
        "Color": "red",
        "Brand": "Acme",
        "IsGift": false
      },
      {
        "ProductId": "P-43",
        "Sku": "SKU-43-BLUE-M",
        "Quantity": 1,
        "Price": 29.99,
        "OriginalPrice": 29.99,
        "Size": "500ml",
        "Color": "blue",
        "Brand": "Acme",
        "IsGift": true
      }
    ]
  }
]

Request Examples

curl -X POST "https://api.replen.it/orders/{tenantId}" \
  -H "Content-Type: application/json" \
  -H "x-replenit-auth-key: YOUR_BASE64_ACCESS_KEY" \
  -d @orders.json

Response Examples

Success

{
  "success": true,
  "message": "Orders saved.",
  "data": {
    "count": 2,
    "processedAt": "2024-12-22T14:05:51Z"
  }
}

Validation Error

{
  "status": 400,
  "errors": {
    "[0].OrderId": [
      "The OrderId field is required."
    ]
  }
}

Related Documentation

Need help or have questions?

Our team is ready to assist you. Reach out to us at support@replen.it

Email Support