# Stock Management API

Manage product catalogues, inventory levels, and stock movements across locations. Designed for ERP, warehouse management, and procurement platform integrations.

---

## Getting Started

The Embed Stock API provides a way for external systems — such as ERP, warehouse management, or procurement platforms — to manage products and stock within the Embed Infinity ecosystem. It exposes a set of RESTful endpoints that let you create and maintain your product catalogue, track inventory levels, and stay informed about stock movements happening inside Infinity.

### API Groups

**Products**
Create new products and update existing ones. A product carries pricing, barcodes, supplier links, and warehouse assignments — all managed through a single create or patch call.

**Reference Data**
Before creating or updating a product you'll need valid values for fields like category, class, tax group, warehouse, unit of measure, and supplier. The reference data endpoints return the lists you can pick from, so you don't have to guess or hard-code IDs.

**Stock Operations**
Once products exist, use these endpoints to query current stock quantities, receive goods from a supplier, perform a stock take (count), or make manual adjustments up or down.

**Webhooks**
Register a URL and the API will push real-time notifications to your system whenever stock levels change inside Infinity (sales, redemptions, game issues, etc.) or when products are created or updated. This keeps your external system in sync without polling.

> For full endpoint details, request/response schemas, and field descriptions, see the API Endpoints section.

---

## Authentication

The Stock Management API uses **Bearer Token** authentication via OAuth 2. Your API credentials will be provided by your Embed representative after your integration has been approved.

### Get a Bearer Token

```
POST /auth/token
Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials&client_id=[your_client_id]&client_secret=[your_secret]

// Response
{
  "access_token": "...",
  "token_type": "Bearer",
  "expires_in": 3600
}
```

### Using the Bearer Token

Include the token in the `Authorization` header for every API call:

```
Authorization: Bearer [your access token]
```

### Authentication Summary

| Property | Details |
|----------|---------|
| Method | OAuth 2 Client Credentials |
| Credentials | Client ID and Client Secret (provided by Embed) |
| Token lifetime | 3600 seconds (1 hour) |
| Header | `Authorization: Bearer [token]` |
