# Tier One ERP — Integration Guide

> Automatically sync transactions, products, customers, and inventory between
> your platform and Tier One ERP. Push sales into your general ledger, keep stock
> levels in sync, and let your back office run itself.

Base URL: `https://www.tieroneerp.com`
OpenAPI Spec: `https://www.tieroneerp.com/swagger/v1/swagger.json`
Full Developer Docs: `https://www.tieroneerp.com/docs/developers`

---

## Setup — Three Steps to Go Live

### Step 1: Register for a Tier One ERP account

Go to https://www.tieroneerp.com/register and create your workspace.
The free trial includes full API access with no credit card required.

### Step 2: Generate an API key

From your dashboard, navigate to Settings → API Keys.
Click "Create Key", give it a name like "Production Integration", and copy the key.
It is only shown once.

### Step 3: Configure your platform

In your integration settings, set the destination URL to your Tier One API base URL
and paste the API key. Map your data fields and enable the sync.

---

## Authentication

Every request requires two headers:

```
X-API-Key: sk_live_YOUR_KEY
X-Tenant-ID: your-tenant-id
```

All endpoints are versioned under `/api/v1`.

---

## Data Flow — Event to Endpoint Mapping

| Your Platform Event     | Tier One Endpoint          | Method   | Description       |
|-------------------------|----------------------------|----------|-------------------|
| Platform sale           | `/api/v1/sales/pos`        | POST     | POS transaction   |
| Product catalog sync    | `/api/v1/products`         | GET/POST | Product CRUD      |
| Customer sync           | `/api/v1/customers`        | GET/POST | Customer CRUD     |
| Inventory updates       | `/api/v1/stock`            | GET      | Stock levels      |
| Stock adjustments       | `/api/v1/stock/adjust`     | POST     | Adjust quantities |
| Order creation          | `/api/v1/sales/orders`     | POST     | Sales orders      |

---

## Code Examples

### Authenticate with API Key (curl)

```bash
curl -X GET https://www.tieroneerp.com/api/v1/customers \
  -H "X-API-Key: sk_live_a1b2c3d4e5f6" \
  -H "X-Tenant-ID: your-tenant-id" \
  -H "Content-Type: application/json"

# 200 OK
{
  "data": [
    {
      "id": "c7f3a2b1-...",
      "name": "Acme Corp",
      "email": "orders@acme.com",
      "status": "active"
    }
  ],
  "pagination": {
    "page": 1,
    "pageSize": 25,
    "totalCount": 142
  }
}
```

### Send a POS Transaction (curl)

```bash
curl -X POST https://www.tieroneerp.com/api/v1/sales/pos \
  -H "X-API-Key: sk_live_a1b2c3d4e5f6" \
  -H "X-Tenant-ID: your-tenant-id" \
  -H "Content-Type: application/json" \
  -d '{
    "customerId": "c7f3a2b1-...",
    "items": [
      {
        "productId": "p1a2b3c4-...",
        "quantity": 2,
        "unitPrice": 29.99
      }
    ],
    "paymentMethod": "card",
    "reference": "ECE-TXN-00412"
  }'

# 201 Created
{
  "id": "txn_x9y8z7...",
  "total": 59.98,
  "status": "completed"
}
```

### Sync a Product (JavaScript)

```javascript
const response = await fetch(
  'https://www.tieroneerp.com/api/v1/products',
  {
    method: 'POST',
    headers: {
      'X-API-Key': 'sk_live_a1b2c3d4e5f6',
      'X-Tenant-ID': 'your-tenant-id',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      sku: 'ECE-WIDGET-001',
      name: 'Premium Widget',
      description: 'High-quality widget',
      unitPrice: 29.99,
      category: 'Widgets',
      trackInventory: true,
      reorderPoint: 25,
    }),
  }
);

const product = await response.json();
console.log('Created product:', product.id);
```

### Subscribe to Webhooks (curl)

```bash
curl -X POST https://www.tieroneerp.com/api/v1/webhooks \
  -H "X-API-Key: sk_live_a1b2c3d4e5f6" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://your-app.com/hooks/tierone",
    "events": [
      "inventory.low_stock",
      "order.created"
    ],
    "secret": "whsec_your_signing_secret"
  }'
```

---

## Webhook Events

All payloads are signed with HMAC-SHA256. Failed deliveries are retried with
exponential backoff (3 attempts over 1 hour).

| Event                      | Description                                          |
|----------------------------|------------------------------------------------------|
| `inventory.stock_updated`  | Stock level changed for a product in any warehouse   |
| `inventory.low_stock`      | Stock fell below the configured reorder point        |
| `order.created`            | A new sales order was placed                         |
| `order.updated`            | Order status or line items were modified             |
| `product.created`          | A new product was added to the catalog               |
| `product.updated`          | Product details, price, or category changed          |
| `payment.received`         | A payment was successfully processed and recorded    |

---

## AI-Assisted Setup

Point your AI coding assistant at the OpenAPI spec to scaffold your integration:

**OpenAPI Spec:** `https://www.tieroneerp.com/swagger/v1/swagger.json`

### Example AI Prompt

> I need to integrate my e-commerce platform with Tier One ERP.
> Here is the OpenAPI spec: https://www.tieroneerp.com/swagger/v1/swagger.json
>
> Build me a Node.js service that:
> 1. Listens for sale webhooks from my platform
> 2. Creates a POS transaction in Tier One via POST /api/v1/sales/pos
> 3. Syncs the product catalog nightly via GET/POST /api/v1/products
> 4. Subscribes to inventory.low_stock webhooks from Tier One and alerts our Slack channel

---

## Contact

- Website: https://www.tieroneerp.com
- Email: hello@tieroneerp.com
- Registration: https://www.tieroneerp.com/register (free trial, no credit card)

(c) 2026 Tier One ERP
