OPEN API developer guide
Learn how to use API keys to read data for selected organizations and sites and connect camera sender programs.
First request
- An organization administrator selects permissions, sites, and an expiry to issue an API key. Choose the dedicated permission for camera sender programs.
- Set ONMARU_API_BASE to the API address of your Onmaru server and ONMARU_TENANT_ID to the organization that issued the token.
- Store the secret shown once during issuance in your external service’s server secret store and supply it through ONMARU_API_TOKEN. Keep it out of source code, browser storage, and logs.
curl --include --get \
"$ONMARU_API_BASE/v1/tenants/$ONMARU_TENANT_ID/sites" \
--data-urlencode 'limit=100' \
--header "Authorization: Bearer $ONMARU_API_TOKEN"Configure the API address for the server you connect to. With the same public origin as the web app, use https://<ONMARU_ORIGIN>/api. Supply the secret in the Authorization: Bearer header.
Allowed APIs
Bearer keys can access only the routes below with their issued permissions and sites. Use organization and site IDs within the key scope.
| Method | Route | Required permission |
|---|---|---|
| GET | /v1/tenants/{tenant}/sites | spaces:read |
| GET | /v1/tenants/{tenant}/sites/{site}/spaces | spaces:read |
| GET | /v1/tenants/{tenant}/sites/{site}/hierarchy | spaces:read |
| GET | /v1/tenants/{tenant}/devices | control:read |
| GET | /v1/tenants/{tenant}/points | control:read |
| GET | /v1/tenants/{tenant}/points/{point} | control:read |
| GET | /v1/tenants/{tenant}/dashboard | energy:read |
| GET | /v1/tenants/{tenant}/metrics/query | energy:read |
| GET | /v1/tenants/{tenant}/sites/{site}/camera-sender/cameras | vision:sender |
| POST | /v1/tenants/{tenant}/sites/{site}/camera-sender/cameras | vision:sender |
| DELETE | /v1/tenants/{tenant}/sites/{site}/camera-sender/cameras/{camera} | vision:sender |
| POST | /v1/tenants/{tenant}/sites/{site}/camera-sender/cameras/{camera}/credentials | vision:sender |
metrics/query uses site and UTC from/to filters. hierarchy, dashboard, and metrics/query return query snapshots instead of cursor lists.
vision:sender can list, register, and remove only cameras linked to that key, and refresh their publishing credentials. Registration requires an installation space and cloud video policy evidence. Key expiry or revocation withdraws server publishing access. Removing a camera preserves its past observation history.
Replacing the program key with a new key issued by the same administrator for the same site transfers its existing cameras while keeping their names and order. The previous key can no longer manage transferred cameras.
Inventory pagination
sites, spaces, devices, and points inventories accept limit and cursor. Start with limit=100; the maximum limit is 500.
If the response contains X-Next-Cursor, supply it as cursor on the next request with the same route and filters. No header means the final page. Do not reuse cursors with a different token site scope.
Errors and token replacement
401- Check the Bearer header and secret. An organization administrator must issue a replacement for expired or revoked tokens.
403- Check the selected permissions, organization, and sites. Read permissions do not allow changes, and camera sender access is limited to its dedicated routes. Control execution and API key management are not allowed.
429- The request limit was exceeded. Follow Retry-After when provided; otherwise wait one minute before trying another read.
If an issuance response is lost, check the token list, revoke the issued token, then issue a replacement. Secrets cannot be retrieved again, and issuance is not automatically retried.
Test environment
OPEN API is verified with PostgreSQL test data isolated from production. Use test fixtures to check permitted and denied access, expiry and revocation, and pagination. No public Stub server or production-data reset API is provided.