Developer Docs

Open API Documentation

Interact with a Frame device over HTTPS using a simple, token-based JSON API.

Overview

Base URL

https://api.galaxyguide.cn/openapi

Format

HTTPS + Bearer Token + JSON

Use this API to query device information, upload and manage images, and switch the displayed image on a KoKonna Frame remotely.

Common Use Cases

This API is designed for lightweight integrations where a server, app, or internal tool needs to interact directly with a Frame device. Typical scenarios include:

Remote Content Publishing

Upload a newly generated or curated image and immediately switch the device display, making the API suitable for remote artwork delivery, seasonal campaigns, or scheduled visual updates.

Device Status Dashboard

Query device heartbeat, battery, charging status, screen geometry, and sync state to build an operations dashboard for customer support, installation teams, or device fleet monitoring.

Gallery And Media Management

List existing images, remove outdated assets, and programmatically select the active image by ID or name to keep each device library organized and easy to control.

App Or Backend Automation

Connect the API to your mobile app, CMS, AI image workflow, or internal backend so user actions or automated jobs can publish content to the Frame without manual intervention.

AI Agent Integrations

Use the API with AI agents such as OpenClaw to turn autonomous workflows into visible output on the Frame, including generated artwork, task results, daily briefings, ambient status boards, or context-aware visual updates triggered by the agent.

Authentication

  • Use a Bearer token in the Authorization header.
  • The token is the device API key shown on the Frame settings page.
  • Send JSON requests with the Content-Type: application/json header.
Authorization: Bearer <API_KEY>
Content-Type: application/json

Rate Limiting

  • Limit: 20 requests per minute per device key.
  • Exceeding the limit returns HTTP 429.
{ "message": "Too many requests, please try again later." }

Endpoints

1) Get Device Information

POST /device Body: {} or omitted

Response 200 Example

{
  "firmware": "B100V050610",
  "nickname": "KoKonna",
  "lastHeartbeat": "2025-06-16T06:56:25.782Z",
  "isCharging": false,
  "batteryLevel": 100,
  "sdUsedSize": 0,
  "switchType": "queue",
  "switchMinute": 60,
  "imageId": 423,
  "coverId": null,
  "timezone": "America/Adak",
  "point": 30,
  "screenWidth": 800,
  "screenHeight": 480,
  "screenRotate": 270,
  "synced": false,
  "online": false
}

Field Notes

  • firmware: Current firmware version.
  • nickname: Device nickname.
  • lastHeartbeat: ISO8601 timestamp of last heartbeat.
  • isCharging, batteryLevel: Current power state.
  • sdUsedSize: Used SD card size in bytes.
  • switchType: Image change strategy (queue or random).
  • switchMinute: Minutes between automatic switches when enabled.
  • imageId, coverId: Current image or cover IDs.
  • screenWidth, screenHeight, screenRotate: Display geometry.
  • synced: True when the device has applied the latest image.
  • online: Online status.

Example (curl)

curl -X POST https://api.galaxyguide.cn/openapi/device \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{}'

2) Upload Image

POST /upload

Request Body

{
  "base64": "/9j/4AAQSkZJRgABAQEAAAAAAAD...",
  "name": "photo.jpg"
}

Rules and Behavior

  • base64 is required and must be raw base64 image data. Do not include a data URL prefix such as data:image/jpeg;base64,.
  • The device frame image counter is incremented and the new image becomes active.
  • The name field is optional and defaults to the original filename.
  • Uploaded images are automatically cropped to the device display area, so match the image ratio to the screen ratio when possible.

Success Response 200

{ "id": 789, "counter": 10 }
  • id: Created image ID.
  • counter: Updated frame image counter.

Example (curl)

curl -X POST https://api.galaxyguide.cn/openapi/upload \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{"base64":"<BASE64_DATA>","name":"photo.jpg"}'

3) List Images

POST /listImages Body: {} or omitted

Success Response 200 Example

{
  "total": 2,
  "list": [
    {
      "id": 789,
      "name": "photo.jpg",
      "fileId": "abc123.jpg",
      "size": 182736,
      "type": "image/jpeg",
      "width": 800,
      "height": 480,
      "createdAt": "2026-05-14T08:00:00.000Z",
      "updatedAt": "2026-05-14T08:00:00.000Z",
      "current": true
    },
    {
      "id": 788,
      "name": "landscape.jpg",
      "fileId": "def456.jpg",
      "size": 164233,
      "type": "image/jpeg",
      "width": 800,
      "height": 480,
      "createdAt": "2026-05-13T08:00:00.000Z",
      "updatedAt": "2026-05-13T08:00:00.000Z",
      "current": false
    }
  ]
}

Field Notes

  • total: Number of images belonging to the device.
  • list: Images ordered by ID descending.
  • current: True when the image is currently active on the device.

Example (curl)

curl -X POST https://api.galaxyguide.cn/openapi/listImages \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{}'

4) Delete Image

POST /deleteImage

Request Body

{ "imageId": 123 }

Rules and Behavior

  • imageId is required and must belong to the device.
  • The image file and database record are deleted together.
  • The device frame image counter is incremented after deletion.
  • If the deleted image is currently active, the server automatically switches to the next available image.
  • If no images remain after deletion, the current image becomes null.

Success Response 200 Example

{
  "success": true,
  "id": 123,
  "imageId": 122,
  "counter": 11
}

Field Notes

  • id: Deleted image ID.
  • imageId: Current active image ID after deletion, or null if none remain.
  • counter: Updated frame image counter.

Errors

  • 500 with { "message": "imageId is empty" } if imageId is missing or invalid.
  • 500 with { "message": "image not found" } if the image does not exist for the device.

Example (curl)

curl -X POST https://api.galaxyguide.cn/openapi/deleteImage \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{"imageId":123}'

5) Get Image by API Key and Image ID

GET /image/:apikey/:imageId

Path Parameters

  • apikey: Device API key shown on the Frame settings page.
  • imageId: Image ID returned by upload or list APIs.

Authentication

This endpoint passes the API key in the URL path, so the Authorization header is not required.

Behavior

  • Returns the original stored image file for the specified device image.
  • The image must belong to the device identified by apikey.
  • Response content type is derived from the stored file extension, typically image/jpeg.

Success Response 200

Binary image stream.

Errors

  • 404 with { "message": "image not found" } if the image ID is invalid, missing, or does not belong to the device.
  • 500 with { "message": "can not find robot <apikey>" } if the API key does not match any device.

Example (curl)

curl -L "https://api.galaxyguide.cn/openapi/image/<API_KEY>/123" \
  -o image.jpg

6) Display Image by ID

POST /displayImageById

Request Body

{ "imageId": 123 }

Success Response 200

{ "success": true }

Errors

  • 500 with { "message": "image not found" } if the image does not exist for the device.

Example (curl)

curl -X POST https://api.galaxyguide.cn/openapi/displayImageById \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{"imageId":123}'

7) Display Image by Name

POST /displayImageByName

Request Body

{ "imageName": "photo.jpg" }

Success Response 200

{ "success": true }

Errors

  • 500 with { "message": "image not found" } if the image name is not found for the device.

Example (curl)

curl -X POST https://api.galaxyguide.cn/openapi/displayImageByName \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{"imageName":"photo.jpg"}'

Error Handling

404 Not Found

Unknown method in URL.

{ "message": "can not find method <method_name>" }

429 Too Many Requests

Rate limit exceeded.

{ "message": "Too many requests, please try again later." }

500 Internal Server Error

Returned when the device cannot be found by the provided key or when another server-side failure occurs.

{ "message": "can not find robot <apikey>" }

or

{ "message": "<error_message>" }

Payload Size

  • Maximum request payload is 50 MB (server default).
  • Ensure base64 uploads fit within this limit.