Pages
Pages are static HTML documents stored on your site. They can be queried and read via the API.
List pages
curl "https://api.wapka.org/v1/pages?type=0&page=1&limit=20&sort=position" \
-H "Authorization: Bearer eyJ..."
Query parameters
| Parameter | Type | Description |
|---|---|---|
type |
int | Filter by page type (0=HTML, 1=Text, 2=CSS, 3=JS, 4=JSON, 5=XML) |
search |
string | Search by page name |
sort |
string | Sort field (prefix - for descending) |
page |
int | Page number |
limit |
int | Items per page |
Response
{
"data": [
{
"id": 10,
"name": "about",
"type": 0,
"type_label": "HTML",
"content": "<h1>About Us</h1><p>We build websites.</p>",
"position": 1,
"header": false,
"footer": false,
"tags": "company,about",
"owner": {
"id": 36012,
"username": "admin",
"avatar": "https://img.wapka.org/u/36012.jpg"
},
"created_at": "2025-01-01T00:00:00Z",
"updated_at": "2026-05-23T10:00:00Z"
}
],
"pagination": { "page": 1, "limit": 20, "totalItems": 5, "totalPages": 1, "hasNext": false, "hasPrev": false },
"meta": { "requestId": "req_...", "timestamp": "..." }
}
Page fields
| Field | Type | Description |
|---|---|---|
id |
int | Unique page ID |
name |
string | Page name (URL slug) |
type |
int | Page type (see below) |
type_label |
string | Human-readable type |
content |
string | Page content (HTML) |
position |
int | Display order |
header |
bool | Whether shown in site header |
footer |
bool | Whether shown in site footer |
tags |
string | Comma-separated tags |
owner |
object | Creator reference |
created_at |
string | Creation timestamp |
updated_at |
string | Last update timestamp |
Page types
| Type | Label | Description |
|---|---|---|
| 0 | HTML | HTML page |
| 1 | Text | Plain text page |
| 2 | CSS | Stylesheet |
| 3 | JS | JavaScript |
| 4 | JSON | JSON data |
| 5 | XML | XML data |
Get a page
curl https://api.wapka.org/v1/pages/10 \
-H "Authorization: Bearer eyJ..."
Returns the page with embedded owner reference and full content.
Codes
Codes are script blocks attached to pages (TAG engine). They are accessed as a sub-resource of pages.
List codes on a page
curl https://api.wapka.org/v1/pages/10/codes \
-H "Authorization: Bearer eyJ..."
Response
{
"data": [
{
"id": 25,
"content": "{{VAR(site_title)}}",
"type": 2,
"type_label": "TAG",
"position": 1,
"page": { "id": 10, "name": "about" },
"created_at": "2025-06-01T00:00:00Z"
}
],
"meta": { "requestId": "req_...", "timestamp": "..." }
}
Code fields
| Field | Type | Description |
|---|---|---|
id |
int | Unique code ID |
content |
string | Code block content |
type |
int | Code type (0=Literal, 1=HTML, 2=TAG, 3=YouTube API...) |
type_label |
string | Human-readable type |
position |
int | Execution order |
page |
object | Parent page reference |
created_at |
string | Creation timestamp |
Create a code block
Requires a logged-in token.
curl -X POST https://api.wapka.org/v1/pages/10/codes \
-H "Authorization: Bearer eyJ..." \
-H "Content-Type: application/json" \
-d '{
"content": "{{VAR(site_title)}}",
"type": 2
}'
| Field | Required | Type | Description |
|---|---|---|---|
content |
Yes | string | Code content |
type |
No | int | Code type (0=Literal, default: 2=TAG) |
Get a code
curl https://api.wapka.org/v1/codes/25 \
-H "Authorization: Bearer eyJ..."
Update a code
Requires a logged-in token.
curl -X PATCH https://api.wapka.org/v1/codes/25 \
-H "Authorization: Bearer eyJ..." \
-H "Content-Type: application/json" \
-d '{ "content": "{{VAR(site_title)@UPPER}}" }'
Delete a code
Requires a logged-in token.
curl -X DELETE https://api.wapka.org/v1/codes/25 \
-H "Authorization: Bearer eyJ..."
Lua API wrapper
-- Pages
local pages = api.pages:list({ type = 0, page = 1, limit = 20 })
local page = api.pages:get(10)
-- Codes
local codes = api.codes:listByPage(10)
local code = api.codes:get(25)
api.codes:create(10, { content = "{{VAR(title)}}", type = 2 })
api.codes:update(25, { content = "Updated" })
api.codes:delete(25)
Next: Dataset — NoSQL database for dynamic content.