H1Spaces API Documentation
Base URL: http://localhost:3000 (or your deployment URL)
H2Authentication
All API requests require an Authorization header:
Authorization: Bearer <JWT_TOKEN>
or
Authorization: ApiKey <API_KEY>
Get JWT by logging in via /login or use the API_KEY from your .env file.
H2Endpoints
H31. Create a Space (Landing Page)
POST /api/spaces
Create a new landing page with sections.
Request Body:
{
"title": "My Product Launch",
"slug": "my-product-launch",
"path": "/product-launch",
"status": "draft",
"visibility": "public",
"sections": [
{
"type": "hero",
"content": {
"title": "Welcome to My Product",
"subtitle": "The best product ever made",
"ctaText": "Get Started",
"ctaLink": "#pricing"
}
},
{
"type": "features",
"content": {
"title": "Why Choose Us",
"subtitle": "Amazing features",
"items": [
{ "title": "Fast", "description": "Blazing fast performance" },
{ "title": "Secure", "description": "Enterprise-grade security" }
]
}
},
{
"type": "cta",
"content": {
"subtitle": "Ready to start?",
"content": "Join thousands of happy customers",
"ctaText": "Sign Up Now",
"ctaLink": "#signup"
}
}
]
}
Response:
{
"success": true,
"space": {
"id": "cm123...",
"title": "My Product Launch",
"slug": "my-product-launch",
"status": "draft",
"path": "/product-launch",
"sections": [...]
}
}
H32. List All Spaces
GET /api/spaces
Response:
{
"spaces": [...]
}
H33. Get a Single Space
GET /api/spaces/{id}
Response:
{
"space": { ... }
}
H34. Update a Space
PATCH /api/spaces/{id}
Request Body:
{
"title": "Updated Title",
"status": "published",
"sections": [
{
"id": "section_id",
"content": { ... },
"enabled": true,
"order": 0
}
]
}
H35. Publish a Space
POST /api/spaces/{id}/publish
Publishes the space after validation.
Response:
{
"success": true,
"space": {
"id": "...",
"title": "...",
"status": "published",
"publishedAt": "2026-05-04T...",
"publicUrl": "/product-launch"
}
}
H36. Delete a Space
DELETE /api/spaces/{id}
Response:
{
"success": true
}
H2Available Section Types
hero- Large header with title, subtitle, CTArich_text- HTML content blockcards- Grid of cards with imagescta- Call to action sectionslider_native- Image sliderfeatures- Feature gridtestimonials- Customer quotespricing- Pricing plansfaq- FAQ accordionfooter- Page footerposter- Event poster layout
H2LLM Integration Example
For AI-generated landing pages, send a JSON bundle like:
curl -X POST http://localhost:3000/api/spaces \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey spaces-api-key-2026-secret" \
-d '{
"title": "AI Generated Landing Page",
"slug": "ai-landing",
"path": "/ai-landing",
"status": "draft",
"sections": [
{
"type": "hero",
"content": {
"title": "Revolutionary Product",
"subtitle": "AI-powered solution for modern teams"
}
}
]
}'
Then publish:
curl -X POST http://localhost:3000/api/spaces/{id}/publish \
-H "Authorization: ApiKey spaces-api-key-2026-secret"
H2Public Access
Once published, the landing page is accessible at:
http://localhost:3000/{path}(e.g.,/product-launch)
Edit mode (for owners):
http://localhost:3000/{path}/edit