# Endpoints

> Every Public API endpoint with its scope, filters and an example request.

Source: https://docs.bakasir.com/en/docs/developers/endpoints

All paths are relative to `https://api.bakasir.com`. Send `Authorization: Bearer bak_your_key_here` with every request. Lists accept `limit`, `cursor` and `order`, see [Pagination](https://docs.bakasir.com/en/docs/developers/conventions.md#pagination).

## Key information

| Method | Path | Scope |
| --- | --- | --- |
| GET | `/v1/me` | any key |

```bash
curl https://api.bakasir.com/v1/me -H "Authorization: Bearer bak_your_key_here"
```

Returns the key id, name, prefix, scopes and the requests per minute allowed.

## Products

| Method | Path | Scope |
| --- | --- | --- |
| GET | `/v1/products` | `products` read |
| GET | `/v1/products/{id}` | `products` read |
| POST | `/v1/products` | `products` write |
| PATCH | `/v1/products/{id}` | `products` write |
| DELETE | `/v1/products/{id}` | `products` write |

Filters for the list: `category_id`, `type` (`standard`, `variant`, `digital`, `service`, `bundle`), `status` (`active` or `inactive`) and `search` (name or code).

Create a product. `name` and `type` are required. Prices are in the smallest currency unit:

```bash
curl https://api.bakasir.com/v1/products \
  -H "Authorization: Bearer bak_your_key_here" \
  -H "Idempotency-Key: sku-1001" \
  -H "Content-Type: application/json" \
  -d '{"name": "Es Kopi Susu", "type": "standard", "code": "KOPI-001", "price": 22000, "cost": 9000}'
```

`PATCH` changes only the fields you send. The same price rules as the Portal apply. A product that has stock or sales history cannot be deleted, so set `"status": false` to hide it instead. A standard product created with `opening_stock` starts with that stock in the first outlet, or in `store_id` when you send one.

## Categories

| Method | Path | Scope |
| --- | --- | --- |
| GET | `/v1/categories` | `categories` read |
| GET | `/v1/categories/{id}` | `categories` read |
| POST | `/v1/categories` | `categories` write |
| DELETE | `/v1/categories/{id}` | `categories` write |

```bash
curl https://api.bakasir.com/v1/categories \
  -H "Authorization: Bearer bak_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"name": "Beverages"}'
```

## Outlets and stock

| Method | Path | Scope |
| --- | --- | --- |
| GET | `/v1/stores` | `stock` read |
| GET | `/v1/stock` | `stock` read |
| POST | `/v1/stock/adjustments` | `stock` write |

`/v1/stock` returns one row per outlet, product and variant with `qty` and `avg_cost`. Filter with `store_id` and `product_id`.

An adjustment adds or removes stock and is posted immediately, the same way as a submitted stock adjustment in the Portal. `type` is `addition` (default) or `subtraction` and `qty` is always positive. Leave `store_id` out to use your first outlet.

```bash
curl https://api.bakasir.com/v1/stock/adjustments \
  -H "Authorization: Bearer bak_your_key_here" \
  -H "Idempotency-Key: adj-2026-11-04-001" \
  -H "Content-Type: application/json" \
  -d '{
    "store_id": "01K9ZT6Q2X3M8N4V7B5C1D0STO",
    "reason": "correction",
    "note": "Warehouse count",
    "items": [
      {"product_id": "01K9ZT6Q2X3M8N4V7B5C1D0EFG", "qty": 12, "type": "addition"},
      {"product_id": "01K9ZT6Q2X3M8N4V7B5C1D0HIJ", "qty": 2, "type": "subtraction"}
    ]
  }'
```

Up to 200 lines per request. An unknown outlet or product returns `422`.

## Customers

| Method | Path | Scope |
| --- | --- | --- |
| GET | `/v1/customers` | `customers` read |
| GET | `/v1/customers/{id}` | `customers` read |
| POST | `/v1/customers` | `customers` write |
| PATCH | `/v1/customers/{id}` | `customers` write |
| DELETE | `/v1/customers/{id}` | `customers` write |

Filter the list with `search` (name, email or phone). `name` is required to create a customer. Loyalty points, tier and opening balance cannot be set through the API.

## Sales

| Method | Path | Scope |
| --- | --- | --- |
| GET | `/v1/sales` | `sales` read |
| GET | `/v1/sales/{id}` | `sales` read |

Each sale includes its `items` and `payments`. Filters: `status` (one or a comma list such as `completed,partially_refunded`), `customer_id`, `store_id`, and `from` and `to` on the sale time.

```bash
curl "https://api.bakasir.com/v1/sales?status=completed&from=2026-11-01&to=2026-11-05&limit=100" \
  -H "Authorization: Bearer bak_your_key_here"
```

Sales made in the Demo outlet are never returned.

## Online orders

| Method | Path | Scope |
| --- | --- | --- |
| GET | `/v1/orders` | `orders` read |
| GET | `/v1/orders/{id}` | `orders` read |

Orders placed on your online store. Filters: `status` (`ordered`, `processing`, `delivering`, `completed`, `canceled`), `payment` (the payment status), `from` and `to`. The single order also returns its `lines`. Use the `sale_id` to match an order with `/v1/sales/{id}`.
