# Public API overview

> Read and write your products, stock and customers, read sales and online orders, and receive webhooks when something changes.

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

The Public API lets your own software work with your Bakasir business data. Use it to sync a catalog from another system, push stock levels from a warehouse tool, pull sales into a spreadsheet or react to an online order the moment it arrives.

The API is part of the **Public API** plugin. It is free by default, and Bakasir may set a price later. Install it from **Plugins → Marketplace**, then open **Settings → Developer**.

## What you can do

| Resource | Read | Write |
| --- | --- | --- |
| Products and variants | Yes | Yes |
| Categories | Yes | Yes |
| Stock levels and outlets | Yes | Adjust stock |
| Customers | Yes | Yes |
| Sales | Yes | No |
| Online orders | Yes | No |

Webhooks tell you when a sale, online order, stock level, product or customer changes. See [Webhooks](https://docs.bakasir.com/en/docs/developers/webhooks.md).

## Quick start

1. Install the **Public API** plugin.
2. Open **Settings → Developer**, choose **Create key**, give it a name and pick the access it needs.
3. Copy the key. It is shown once.
4. Call the API.

```bash
curl https://api.bakasir.com/v1/products?limit=5 \
  -H "Authorization: Bearer bak_your_key_here"
```

```json
{
  "data": [
    {
      "id": "01K9ZT6Q2X3M8N4V7B5C1D0EFG",
      "code": "PRD-00001",
      "name": "Es Kopi Susu",
      "type": "standard",
      "price": 22000,
      "cost": 9000,
      "status": true,
      "variants": []
    }
  ],
  "has_more": true,
  "next_cursor": "MDFLOVpUNlEyWDNNOE40VjdCNUMxRDBFRkc"
}
```

Check that a key works and see its access:

```bash
curl https://api.bakasir.com/v1/me -H "Authorization: Bearer bak_your_key_here"
```

## Good to know

- The API base address is `https://api.bakasir.com`. Every path starts with `/v1`.
- Amounts are whole numbers in the smallest unit of your business currency. For rupiah that is one rupiah, for a currency with cents it is the cent.
- The Demo outlet and demo products are never returned and cannot be changed through the API.
- If your subscription is overdue the API follows the same rules as the Portal: reading may continue while writing is blocked.

Continue with [Authentication and scopes](https://docs.bakasir.com/en/docs/developers/authentication.md).
