SmallPlate

Bitmaps API

Efficient yes/no data storage with activity tracking and feature flags

Bitmaps are efficient for yes/no style data. Each bit position stores 0 or 1, which makes them useful for activity tracking, feature flags, and compact boolean datasets.

Endpoints

MethodEndpointDescription
POST/{plateId}/bitmaps/setSet one bit
GET/{plateId}/bitmaps/get/{key}/{bit}Get one bit
GET/{plateId}/bitmaps/count/{key}Count set bits
GET/{plateId}/bitmaps/position/{key}/{bit}Find first matching bit
POST/{plateId}/bitmaps/operateBITOP wrapper
POST/{plateId}/bitmaps/fieldBITFIELD wrapper
POST/{plateId}/bitmaps/commandExecute allowed bitmap commands
POST/{plateId}/bitmaps/{key}/commandExecute key-specific bitmap commands

Examples

Set a Bit

const plateId = "[id]";
const apiKey = "your-api-key";
const baseUrl = "[base-url]";

const response = await fetch(`${baseUrl}/${plateId}/bitmaps/set`, {
  method: "POST",
  headers: {
    "Authorization": apiKey,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    key: "login:2026-03-15",
    bit: 12345,
    value: 1
  })
});

const data = await response.json();
console.log(data);

Get a Bit

const plateId = "[id]";
const apiKey = "your-api-key";
const baseUrl = "[base-url]";

const response = await fetch(`${baseUrl}/${plateId}/bitmaps/get/login:2026-03-15/12345`, {
  headers: {
    "Authorization": apiKey,
    "Content-Type": "application/json"
  }
});

const data = await response.json();
console.log(data);

Count Bits

Count the whole bitmap:

const plateId = "[id]";
const apiKey = "your-api-key";
const baseUrl = "[base-url]";

const response = await fetch(`${baseUrl}/${plateId}/bitmaps/count/login:2026-03-15`, {
  headers: {
    "Authorization": apiKey,
    "Content-Type": "application/json"
  }
});

const data = await response.json();
console.log(data);

Count a byte range:

const plateId = "[id]";
const apiKey = "your-api-key";
const baseUrl = "[base-url]";

const response = await fetch(`${baseUrl}/${plateId}/bitmaps/count/login:2026-03-15?start=0&end=100`, {
  headers: {
    "Authorization": apiKey,
    "Content-Type": "application/json"
  }
});

const data = await response.json();
console.log(data);

Find the First 0 or 1

const plateId = "[id]";
const apiKey = "your-api-key";
const baseUrl = "[base-url]";

const response = await fetch(`${baseUrl}/${plateId}/bitmaps/position/login:2026-03-15/0?start=0&end=100`, {
  headers: {
    "Authorization": apiKey,
    "Content-Type": "application/json"
  }
});

const data = await response.json();
console.log(data);

Bitwise Operations

const plateId = "[id]";
const apiKey = "your-api-key";
const baseUrl = "[base-url]";

const response = await fetch(`${baseUrl}/${plateId}/bitmaps/operate`, {
  method: "POST",
  headers: {
    "Authorization": apiKey,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    operation: "AND",
    destination: "both-days",
    sources: ["day-1", "day-2"]
  })
});

const data = await response.json();
console.log(data);

NOT requires exactly one source key.

Advanced Bitfield Operations

const plateId = "[id]";
const apiKey = "your-api-key";
const baseUrl = "[base-url]";

const response = await fetch(`${baseUrl}/${plateId}/bitmaps/field`, {
  method: "POST",
  headers: {
    "Authorization": apiKey,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    key: "flags",
    operations: ["GET", "u8", 0, "SET", "u8", 8, 255]
  })
});

const data = await response.json();
console.log(data);

Command Compatibility

const plateId = "[id]";
const apiKey = "your-api-key";
const baseUrl = "[base-url]";

const response = await fetch(`${baseUrl}/${plateId}/bitmaps/command`, {
  method: "POST",
  headers: {
    "Authorization": apiKey,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    command: "SETBIT",
    args: ["mybitmap", 500, 1]
  })
});

const data = await response.json();
console.log(data);

Command Endpoints

POST /{plateId}/bitmaps/command

Execute allowed bitmap commands across the plate.

Allowed Commands:

CommandDescription
SETBITSet a bit
GETBITGet a bit
BITCOUNTCount set bits
BITOPBitwise operations
BITPOSFind first bit
BITFIELDBitfield operations

POST /{plateId}/bitmaps/{key}/command

Execute allowed commands on a specific bitmap key.

Allowed Commands: Same as above.

Request:

const plateId = "[id]";
const apiKey = "your-api-key";
const baseUrl = "[base-url]";

const response = await fetch(`${baseUrl}/${plateId}/bitmaps/mybitmap/command`, {
  method: "POST",
  headers: {
    "Authorization": apiKey,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    command: "BITCOUNT"
  })
});

const data = await response.json();
console.log(data);

On this page