API Reference
Manage tiles and profiles programmatically.
Authentication
All v1 API routes require a Bearer API key in the Authorization header.
Authorization: Bearer YOUR_API_KEY
Your API key is auto-generated on sign-in. Find it in your account settings (coming soon) or query user.apiKey in the database.
Endpoints
GET/api/v1/profiles/:slugAuth: Bearer
Get a full profile with all tiles.
Response: { profile: { id, slug, displayName, bio, theme, ... }, tiles: Tile[] }
curl https://boxli.me/api/v1/profiles/your-slug \
-H "Authorization: Bearer YOUR_API_KEY"
PUT/api/v1/profiles/:slug/tilesAuth: Bearer
Replace ALL tiles on a profile. Useful for bulk imports.
Body: Tile[]
curl -X PUT https://boxli.me/api/v1/profiles/your-slug/tiles \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '[{ "type": "text", "position": { "col": 1, "row": 1, "colSpan": 2, "rowSpan": 1 }, "content": { "heading": "Hi", "body": "Hello world" } }]'
POST/api/v1/profiles/:slug/tilesAuth: Bearer
Add a single tile. Returns 403 if tile limit is reached.
Body: Partial<Tile>
curl -X POST https://boxli.me/api/v1/profiles/your-slug/tiles \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "type": "link", "content": { "title": "My Site", "url": "https://example.com" } }'
PATCH/api/v1/profiles/:slug/tiles/:idAuth: Bearer
Update one tile by ID. Send only the fields you want to change.
Body: Partial<Tile>
curl -X PATCH https://boxli.me/api/v1/profiles/your-slug/tiles/tile-id \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "content": { "title": "Updated title" } }'
DELETE/api/v1/profiles/:slug/tiles/:idAuth: Bearer
Remove a tile by ID. Decrements tilesUsed counter.
curl -X DELETE https://boxli.me/api/v1/profiles/your-slug/tiles/tile-id \
-H "Authorization: Bearer YOUR_API_KEY"
GET/api/analytics/:slugAuth: Session
Get analytics for a profile you own. Free: views + click totals. Pro: per-tile breakdown.
curl https://boxli.me/api/analytics/your-slug \
-H "Cookie: YOUR_SESSION_COOKIE"
Tile schema
The full JSON Schema is at /tiles.schema.json.
{
"id": "tile-abc123",
"type": "text",
"position": { "col": 1, "row": 1, "colSpan": 2, "rowSpan": 1 },
"content": { "heading": "Hello", "body": "World" },
"theme": {},
"meta": {}
}