Skip to content

API Overview

The BitMarks API is a RESTful JSON API built on Cloudflare Workers with Hono framework. All endpoints are prefixed with /api/v1/.

EnvironmentBase URL
Productionhttps://app.bitmarks.sh/api/v1
Developmenthttp://localhost:8787/api/v1

All requests and responses use JSON format:

Content-Type: application/json

Most endpoints require authentication via session cookie. See Authentication for details.

Cookie: bitmarks_session=YOUR_SESSION_TOKEN
MethodEndpointDescriptionAuth
GET/healthAPI health checkNo
MethodEndpointDescriptionAuth
POST/auth/loginInitiate OAuth loginNo
GET/auth/callbackOAuth callback handlerNo
POST/auth/logoutEnd sessionNo
GET/auth/sessionGet current sessionCookie
POST/auth/refreshRefresh access tokenCookie
MethodEndpointDescriptionAuth
GET/bookmarksList all bookmarksCookie
POST/bookmarksCreate bookmarkCookie
GET/bookmarks/:idGet single bookmarkCookie
PUT/bookmarks/:idUpdate bookmarkCookie
DELETE/bookmarks/:idDelete bookmarkCookie
MethodEndpointDescriptionAuth
GET/sync/statusGet sync statusCookie
POST/sync/pullPull changesCookie
POST/sync/pushPush changesCookie
POST/sync/importBulk importCookie
GET/sync/realtimeWebSocket upgradeCookie
MethodEndpointDescriptionAuth
GET/exportsList exportsCookie
POST/exportsCreate exportCookie
GET/exports/:idDownload exportCookie
DELETE/exports/:idDelete exportCookie
HeaderRequiredDescription
Content-TypeYes (POST/PUT)Must be application/json
CookieYes (authenticated)Session cookie
X-Device-IDNoDevice identifier for sync

POST and PUT requests accept JSON body:

{
"encrypted_data": "base64-encoded-encrypted-json",
"data_hash": "sha256-hash-of-plaintext"
}
{
"data": { ... },
"meta": {
"total": 100,
"page": 1,
"limit": 50
}
}
{
"error": "Human-readable error message"
}

In development mode, errors may include additional details:

{
"error": "Something went wrong",
"stack": "Error: Something went wrong\n at ..."
}
CodeMeaning
200Success
201Created
302Redirect (OAuth callback)
400Bad Request - Invalid input
401Unauthorized - Authentication required
404Not Found
426Upgrade Required - WebSocket expected
500Internal Server Error
501Not Implemented

List endpoints support pagination:

{
"data": [...],
"meta": {
"total": 1000,
"page": 1,
"limit": 100
}
}

Query parameters:

  • page - Page number (default: 1)
  • limit - Items per page (default: 100, max: 1000)
Endpoint TypeLimit
Read Operations100 requests/minute
Write Operations30 requests/minute
Bulk Import5 requests/minute

When rate limited, you’ll receive a 429 Too Many Requests response.

The API supports CORS for browser-based clients:

  • Allowed Origins: Configured per environment
  • Allowed Methods: GET, POST, PUT, DELETE, OPTIONS
  • Allowed Headers: Content-Type, Authorization, X-Device-ID
  • Credentials: Allowed (for cookies)

The API expects and returns encrypted data envelopes:

interface EncryptedData {
encrypted_data: string; // Base64-encoded ciphertext
data_hash: string; // SHA-256 of plaintext (for integrity)
}

The full OpenAPI 3.1 specification is available at:

/openapi.yaml

You can use this with tools like Swagger UI, Postman, or code generators.