Get a build
const url = 'https://example.com/wp-json/wp2lms/static-builder/v1/builds/128?blog_id=1';const options = {method: 'GET', headers: {'X-WP-Nonce': '<X-WP-Nonce>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://example.com/wp-json/wp2lms/static-builder/v1/builds/128?blog_id=1' \ --header 'X-WP-Nonce: <X-WP-Nonce>'One CPT wp2lms_static_build by path {id}: full BuildService::serialize (config, page_ids, status, logs, view/zip when completed and files exist on disk).
This does not start or change the build. Missing id or a different post_type — 404 wp2lms_static_builder_not_found. id ≤ 0 — 400 invalid_id.
Requires manage_network or edit_pages. Cookie + X-WP-Nonce or Application Password.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”CPT wp2lms_static_build post ID (same number as StaticBuild.id). ≤ 0 — 400 invalid_id.
Example
128Query Parameters
Section titled “Query Parameters”Multisite site ID to read/write builds on. Optional: PHP uses get_current_blog_id(). ≤ 0 — 400 invalid_blog. Missing or foreign-network site — 404 blog_not_found. Usually omitted on a single site.
Example
1Responses
Section titled “Responses”Current build state (serialize).
object
CPT wp2lms_static_build post ID.
BuildStatus->value: new, pending, building, completed, error, stopped, rebuild, build, stopping. After create typically new; after async run — pending.
True for completed, error, stopped.
object
ACF courseName on the saved build.
ACF apiType; empty values become local.
ACF courseID (get_course_id); may be an empty string.
Linked wp2lms_courses CPT ID (meta ssb_course_id). 0 if unlinked.
Version number from ACF (get_version_number), default 1.
ACF courseComment.
Package or live (get_export_mode; other/empty → package).
Page IDs in package order; first item is the main page.
Main page ID (get_main_page), usually page_ids[0].
Favourite build for the course (meta ssb_is_primary). At most one per linked course; star in the course Builds metabox.
True when at least one selected page has a sections-taxonomy term. The site option cannot be set via this REST body.
Site-wide Static Builder setting disableAutoAdditionData (not a REST body field).
For package — site setting notIncludeMediaFilesBuild; for live PHP always returns false.
For package — saveExternalFiles (null → true); for live always false (off-site files are not downloaded).
Build revision number from meta (get_revision_number).
Step log (get_logs(true) — newest first). Usually [] right after create.
object
Unix timestamp of the build-step log (0 if meta has no time).
Build log level (info if meta has no level).
Package generation step text.
View URL (index.html / live). Non-null only when status=completed and a view file exists; otherwise null (including after create).
ZIP URL. Non-null only when completed and the archive exists (typically package/scorm/xapi). For live often null.
Directory URL {uploads}/wp2lms-static/{id}/. Always a string, even if files are not there yet.
Raw wp-admin link to the build card (get_edit_post_link(..., 'raw')).
Site ID that owns the build (get_current_blog_id after switch_to_blog).
Example
{ "id": 128, "status": "completed", "terminal": true, "config": { "course_name": "Information Security Basics", "api_type": "scorm", "course_id": "course-infosec-101", "version": 1, "course_comment": "Package for the LMS", "export_mode": "package" }, "page_ids": [ 42, 57 ], "main_page_id": 42, "use_sections_in_menu": true, "disable_auto_addition_data": false, "not_include_media_files_build": false, "save_external_files": true, "revision": 3, "logs": [ { "time": 1726221720, "level": "info", "message": "Build completed" } ], "view_url": "https://pulse.example.com/wp-content/uploads/wp2lms-static/128/index.html", "zip_url": "https://pulse.example.com/wp-content/uploads/wp2lms-static/128/Site_128_1.3.zip", "files_url": "https://pulse.example.com/wp-content/uploads/wp2lms-static/128/", "edit_url": "https://pulse.example.com/wp-admin/post.php?post=128&action=edit", "blog_id": 1}Wp2lms_static_builder_invalid_id — id ≤ 0; invalid_blog — blog_id ≤ 0.
object
Machine-readable WP_Error code (for example wp2lms_static_builder_busy, rest_forbidden, invalid_nonce).
Human-readable error message from PHP / WordPress REST.
Usually { status: <HTTP code> }. If status is missing, core REST often returns 500.
object
Example
{ "code": "wp2lms_static_builder_busy", "message": "Build is currently building and cannot be updated.", "data": { "status": 409 }}Not authenticated. DualRest: rest_forbidden (status 401) when there is no cookie session. Cookie + X-WP-Nonce or Application Password.
object
Machine-readable WP_Error code (for example wp2lms_static_builder_busy, rest_forbidden, invalid_nonce).
Human-readable error message from PHP / WordPress REST.
Usually { status: <HTTP code> }. If status is missing, core REST often returns 500.
object
Example
{ "code": "wp2lms_static_builder_busy", "message": "Build is currently building and cannot be updated.", "data": { "status": 409 }}Missing manage_network (multisite) or edit_pages (single site); invalid REST nonce rest_cookie_invalid_nonce.
object
Machine-readable WP_Error code (for example wp2lms_static_builder_busy, rest_forbidden, invalid_nonce).
Human-readable error message from PHP / WordPress REST.
Usually { status: <HTTP code> }. If status is missing, core REST often returns 500.
object
Example
{ "code": "wp2lms_static_builder_busy", "message": "Build is currently building and cannot be updated.", "data": { "status": 409 }}Wp2lms_static_builder_not_found — no post of this CPT; blog_not_found — site missing or on another network.
object
Machine-readable WP_Error code (for example wp2lms_static_builder_busy, rest_forbidden, invalid_nonce).
Human-readable error message from PHP / WordPress REST.
Usually { status: <HTTP code> }. If status is missing, core REST often returns 500.
object
Example
{ "code": "wp2lms_static_builder_busy", "message": "Build is currently building and cannot be updated.", "data": { "status": 409 }}