

# iglooworks Documentation

The iglooworks API manages iglooworks smart locks from your backend, online or offline. AlgoPIN generates valid PIN codes without WiFi or cellular data on the lock.

The API includes:

- AlgoPIN codes
- eKeys (Bluetooth keys)
- Access records
- Users and departments
- Remote control via a Bridge
- Notifications via Webhooks

## HTTP Request Header Format

| Key | Value |
| --- | --- |
| Authorization | `Bearer {access_token}` |
| Content-Type | `application/json` |

See [Individual Account](/works/individual-account) or [Partner Account](/works/partner-account) on how to get an access token.

The iglooworks API supports JSON only. Set `Accept` and `Content-Type` to `application/json`.

```
<METHOD> <URL> HTTP/1.1
Accept: application/json
Content-Type: application/json
```

Example cURL:

```bash
curl -X POST -H "Authorization: Bearer {access_token}" -H "Accept: application/json" -H "Content-Type: application/json"
```

## Architecture

iglooworks supports two integration paths depending on who is authenticating:

<!-- table:build-compare -->
| | Individual account | Partner account |
| --- | --- | --- |
| Flow | OAuth 2.0 Client Credentials | OAuth 2.0 Authorization Code |
| Who authenticates | Your own account | Each end user, per organization |
| Guide | [Client credentials](/works/individual-account) | [Code flow](/works/partner-account) |

### Your server to our server

Server-to-server integrations (no end user login) use the OAuth 2.0 Client Credentials flow via **iglooworks API**. Your backend authenticates directly with its own Client ID and Secret. See [Individual Account](/works/individual-account).

```mermaid
sequenceDiagram
    participant Y as Your Server
    participant O as Our Server
    Note over O: iglooworks API
    Y->>O: HTTP Request
    O-->>Y: HTTP Response
```

### Bridge-connected devices

Devices behind a Bridge are controlled through asynchronous bridge-proxied jobs: your server queues a job (lock, unlock, create PIN) against the Bridge, and the Bridge executes it against the device and reports status back via webhook.

```mermaid
sequenceDiagram
    participant Y as Your Server
    participant O as Our Server
    participant B as Bridge
    participant D as Device
    Note over O: iglooworks API
    Y->>O: Request
    O->>B: Request (WiFi)
    B->>D: Request (Bluetooth)
    D-->>B: Response
    B-->>O: Response
    O-->>Y: Response
```
