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
| Method | Endpoint | Description |
|---|---|---|
| POST | /{plateId}/bitmaps/set | Set 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/operate | BITOP wrapper |
| POST | /{plateId}/bitmaps/field | BITFIELD wrapper |
| POST | /{plateId}/bitmaps/command | Execute allowed bitmap commands |
| POST | /{plateId}/bitmaps/{key}/command | Execute 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:
| Command | Description |
|---|---|
| SETBIT | Set a bit |
| GETBIT | Get a bit |
| BITCOUNT | Count set bits |
| BITOP | Bitwise operations |
| BITPOS | Find first bit |
| BITFIELD | Bitfield 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);