Read, update and deploy User portal settings
Manage the library's User portal through REST. These endpoints configure its title, introduction, selected services and Collection programmes, cards and domain. They do not return respondent answers or activity.
Host, endpoints and permissions
Use https://app.govform.com, or your private Builder host. The base path is /builder/libraries/{libraryId}/api/user-portal. Authenticate with your library API key or GovformsApiHmac and send JSON for writes.
| Method and path | Permission | Result |
|---|---|---|
GET /builder/libraries/{libraryId}/api/user-portal |
apiPortalRead | Read settings, revision and environment deployment metadata. |
PATCH /builder/libraries/{libraryId}/api/user-portal |
apiPortalWrite | Save a partial settings update using the expected revision. |
POST /builder/libraries/{libraryId}/api/user-portal/deployments |
apiPortalDeploy | Prepare deployment and return its confirmation link. |
Form-write and form-deployment permissions do not grant these portal permissions. For Cloud accounts, each successful GET, PATCH or POST operation above uses 5 API units. Government Cloud accounts are exempt from these quotas. Check the API-unit response headers for usage.
Read settings and choices
GET accepts includeChoices=true, offset (0–5000) and limit (1–100, default 100). Without includeChoices it reads the saved settings and deployment state. The response includes settings, revision, previewUrl, builderUrl and environments, including deployed settings, dates, actor, URL and current status.
With choices requested, the response also includes a bounded selection of service and programme metadata, domainChoices, nextOffset and catalogueLimitReached. Continue with nextOffset when present; the selection catalogue is capped at 5,000 entries. It does not include full service definitions or credentials.
Save a partial update
PATCH /builder/libraries/demo-library/api/user-portal
Authorization: GovformsApiKey <key-id>:<key-secret>
Content-Type: application/json
{
"expectedRevision": "revision-from-get",
"settings": {
"title": "Your applications",
"introduction": "Start an application or check its progress.",
"serviceIds": ["apply"],
"collectionProgrammeIds": [],
"cards": {
"service:apply": {"title": "Apply for a grant", "description": "Start your application."}
}
}
}
expectedRevision is required, including the empty string for a library without a revision. A stale revision returns 409: reread before making another patch. The saved result includes the new revision.
Omitted settings are preserved. Supplied arrays and the cards map replace those properties, so include entries you want to keep. Empty text clears overrides, and empty arrays clear selections. Card keys use service:{serviceId} or collection:{collectionProgrammeId}; cards for removed selections are discarded. cardOrder controls the selected card order.
Settings accept title (100 characters), introduction (5,000), serviceIds, collectionProgrammeIds, cardOrder, cards, domain and redirectRoot. Cards accept title (100), description (500), imageRef, imageFilename, originalImageRef, originalImageFilename, imageDisplay (crop or natural), imageDecorative and imageAltText (300). Use existing library-owned images; upload and crop new images in Builder. Informative images require alternative text.
Select authenticated ordinary services rather than patterns or managed Collection forms. Select a Collection programme to include its current and future Collections. Existing unavailable selections can be retained or removed and are hidden from respondents. Domain choices use active shared service domains in the library; this API does not provision or transfer a domain. redirectRoot with a selected domain redirects its homepage after Production deployment.
Categories and homepage layouts
Portal categories organise included services and programmes. They are separate from Builder service labels and do not expose respondent answers or activity.
| Setting | Contract |
|---|---|
displayMode | flat (Service cards, the default), categories (Category cards), or grouped (Grouped services). |
categories | Up to 100 objects with a unique stable id, required title and ordered memberKeys. Members use service:{id} or collection:{programmeId} and must be included in the final selections. Limits are 5,000 members per category and 25,000 memberships overall. |
| Category presentation | Optional description and image fields belong on the category object, with the same library-image and alternative-text validation as cards. |
cards | An individual card can set showOnHomepage: true to appear directly in Category cards layout as well as within categories. Uncategorised services remain directly available. |
cardOrder | Also accepts category:{id}, with up to 5,100 entries. Category member order comes from memberKeys. |
A service or programme can be in several categories; its applications and overall activity totals stay unique. Changing layouts preserves the configured categories and cards.
A layout-only patch preserves categories, card overrides and selections:
{"expectedRevision": "revision-from-latest-read", "settings": {"displayMode": "grouped"}}
Supplying categories replaces the entire array. Read and merge wanted entries first, retain category IDs when renaming, then save with the latest revision. An omitted array is preserved; deselecting a service in a selection-only patch prunes its old memberships. Removing a category keeps its services. Empty categories stay in configuration but are hidden from the homepage until a member is available.
Category pages use /prototypes/{libraryId}/_portal/categories/{categoryId} or /services/{libraryId}/_portal/categories/{categoryId} under the existing portal authentication. Category filters also apply to Things to do and My activity and persist through pagination. These are respondent pages, not additional configuration API endpoints.
Use matching Builder, runtime and client schema support before configuring categories. Deploy the saved portal and verify the environment status. For the UI workflow, see Set up a User portal and service categories.
Deploy portal settings
{"expectedRevision": "revision-from-save", "environment": "qa"}
POST that body to /builder/libraries/{libraryId}/api/user-portal/deployments. The environment must be configured: qa, production or staging where enabled. The result contains deploymentId, confirmationUrl and status: "requires-browser". An authorised person must open the confirmation URL and complete the deployment in Builder. Reread environments to verify completion.
Saving affects User view. Portal deployment is separate from deploying service definitions, authentication or branding.
Errors
400 indicates invalid input; 403 invalid credentials or missing permission; 409 a stale revision or conflicting configuration. Capacity limits return 429. Builder errors use error.message; follow Retry-After for limits.
See API key settings and the endpoint index.
See authentication headers for raw-key and HMAC formats.
Introduction mode and card sizes
introductionMode selects markdown or html for the introduction (up to 5,000 characters). categoryCardSize controls the category-card homepage grid. categories[].cardSize controls the service cards inside that category's page.
Both sizes accept large, standard or compact. Omitted homepage size defaults to standard; omitted category-page size defaults to compact. Explicit sizes are preserved. Include existing category entries/memberships when supplying a replacement categories array.
