diff --git a/openapi.yaml b/openapi.yaml
index cacde1e..e4b9393 100644
--- a/openapi.yaml
+++ b/openapi.yaml
@@ -4051,6 +4051,69 @@ paths:
$ref: '#/components/schemas/SignupPageList'
"401":
$ref: '#/components/responses/Unauthorized'
+ post:
+ tags: [Signup Pages]
+ summary: Make a Signup Page
+ description: |
+ Makes a Signup Page as the **New Signup Page** screen does, active unless `active: false`.
+ Only Organisation Editors can (403 otherwise). Returns the Signup Page in the list's shape,
+ with its `public_link`.
+
+ - **Fixed** (`type: fixed`): Individual A is the person signing up, with `project_id`,
+ `beneficiary_state_id` (project status), `contact_form_id` and `surveys`. Each entry in
+ `individuals` adds Individual B, C, ... in that order, related to Individual A through
+ one of the Organisation's Relationship Categories (`relationship` is its parent or child
+ title, e.g. "Child"). The Organisation needs at least one Relationship Category.
+ - **Flexible** (`type: flexible`): each entry in `audiences` is a Beneficiary Role
+ respondents can add any number of people as, in any order. Each audience must be a role
+ with a permitted relationship (role-holder relationship) in the Organisation. The first
+ audience's project, status and Contact Form are the Signup Page's own unless given.
+
+ Every Project, Contact Form, Relationship Category and audience must be the
+ Organisation's, and each survey one its Project collects (with `wave_id` one of that
+ survey's waves). Otherwise the response is 422, naming each problem in `errors`.
+ operationId: createReferralLinkDetail
+ security: [{tokenAuth: []}]
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SignupPageCreateRequest'
+ example:
+ charity_id: 42
+ name: "Family signup"
+ type: fixed
+ project_id: 7
+ beneficiary_state_id: 1
+ contact_form_id: 155
+ surveys: [{ id: 391, wave_id: 12 }]
+ thank_you_message: "Thanks for signing up!"
+ individuals:
+ - relationship_category_id: 3
+ relationship: "Child"
+ project_id: 8
+ beneficiary_state_id: 1
+ contact_form_id: 156
+ responses:
+ "201":
+ description: The new Signup Page
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SignupPage'
+ "401":
+ $ref: '#/components/responses/Unauthorized'
+ "403":
+ description: You're in the Organisation but aren't an Organisation Editor
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Error'
+ "404":
+ $ref: '#/components/responses/NotFound'
+ "422":
+ $ref: '#/components/responses/UnprocessableEntity'
/referral_link_details/{id}/definition:
get:
@@ -16490,6 +16553,84 @@ components:
format: email
- $ref: '#/components/schemas/SignupPageEmail'
+ SignupPageCreateRequest:
+ type: object
+ required: [charity_id, name, type]
+ properties:
+ charity_id:
+ type: integer
+ description: The Organisation
+ name:
+ type: string
+ type:
+ type: string
+ enum: [fixed, flexible]
+ active:
+ type: boolean
+ default: true
+ project_id:
+ type: integer
+ description: Individual A's Project (fixed), or the Signup Page's (flexible; defaults to the first audience's)
+ beneficiary_state_id:
+ type: integer
+ description: The project status (Beneficiary State) people are added with
+ contact_form_id:
+ type: integer
+ description: Individual A's Contact Form (Beneficiary Category)
+ surveys:
+ $ref: '#/components/schemas/SignupPageSurveyChoice'
+ description:
+ type: string
+ thank_you_message:
+ type: string
+ individuals:
+ type: array
+ description: Fixed only. Individual B, C, ... in order
+ items:
+ type: object
+ properties:
+ relationship_category_id:
+ type: integer
+ relationship:
+ type: string
+ description: The Relationship Category's parent or child title for this individual, e.g. "Child"
+ project_id:
+ type: integer
+ beneficiary_state_id:
+ type: integer
+ contact_form_id:
+ type: integer
+ surveys:
+ $ref: '#/components/schemas/SignupPageSurveyChoice'
+ audiences:
+ type: array
+ description: Flexible only. One per audience (Beneficiary Role)
+ items:
+ type: object
+ properties:
+ beneficiary_role_id:
+ type: integer
+ project_id:
+ type: integer
+ beneficiary_state_id:
+ type: integer
+ contact_form_id:
+ type: integer
+ surveys:
+ $ref: '#/components/schemas/SignupPageSurveyChoice'
+
+ SignupPageSurveyChoice:
+ type: array
+ description: Surveys (Story Categories) the Project collects, each optionally with one of its waves
+ items:
+ type: object
+ required: [id]
+ properties:
+ id:
+ type: integer
+ wave_id:
+ type: integer
+
SignupPageEmailSettingsRequest:
type: object
properties:
diff --git a/server.js b/server.js
index 1b685db..d5064cf 100644
--- a/server.js
+++ b/server.js
@@ -923,7 +923,7 @@ function buildDocsPage() {
GETOrganisations
GETProjects
GETAlbums (Portfolios)
- GETSignup Pages
+ POSTSignup Pages
POSTUsers
POSTContacts
GETContact Bio Forms
@@ -1400,6 +1400,24 @@ function buildDocsPage() {
{ code: "200", cls: "response-2xx", desc: "Paginated list of Signup Pages, ordered by name" },
{ code: "401", cls: "response-4xx", desc: "Not authenticated" }
], "What the Manage Sign-up Pages table shows for each Signup Page: type (fixed or flexible), status and active, public_link (the customised link when there is one), emails_enabled, who created and last updated it and when, and individuals: each individual or audience with its Contact Form, Project, project status, Surveys and any Wave, and send_emails. Deactivated Signup Pages are included.")}
+ ${endpointCard("POST", "/referral_link_details", "Make a Signup Page", true, [
+ { name: "charity_id", in: "body", type: "integer", required: true, desc: "The Organisation. You must be an Organisation Editor of it" },
+ { name: "name", in: "body", type: "string", required: true, desc: "The Signup Page's name" },
+ { name: "type", in: "body", type: "string", required: true, desc: "fixed or flexible" },
+ { name: "active", in: "body", type: "boolean", required: false, desc: "Default true" },
+ { name: "project_id", in: "body", type: "integer", required: false, desc: "Individual A's Project (fixed). For flexible, defaults to the first audience's" },
+ { name: "beneficiary_state_id", in: "body", type: "integer", required: false, desc: "The project status people are added with" },
+ { name: "contact_form_id", in: "body", type: "integer", required: false, desc: "Individual A's Contact Form" },
+ { name: "surveys", in: "body", type: "object[]", required: false, desc: "{id, wave_id}: Surveys the Project collects, each with an optional Wave" },
+ { name: "individuals", in: "body", type: "object[]", required: false, desc: "Fixed: Individual B, C, ... each with relationship_category_id, relationship (its parent or child title, e.g. Child), project_id, beneficiary_state_id, contact_form_id and surveys" },
+ { name: "audiences", in: "body", type: "object[]", required: false, desc: "Flexible: one per audience with beneficiary_role_id, project_id, beneficiary_state_id, contact_form_id and surveys" }
+ ], [
+ { code: "201", cls: "response-2xx", desc: "The new Signup Page, as the list shows it, with its public_link" },
+ { code: "401", cls: "response-4xx", desc: "Not authenticated" },
+ { code: "403", cls: "response-4xx", desc: "You aren't an Organisation Editor" },
+ { code: "404", cls: "response-4xx", desc: "An Organisation you aren't in" },
+ { code: "422", cls: "response-4xx", desc: "{errors: [...]} naming each problem, e.g. no Relationship Category for a fixed Signup Page, an audience without a permitted relationship, or another Organisation's Project or Contact Form" }
+ ], "Makes a Signup Page as the New Signup Page screen does. A fixed Signup Page needs the Organisation to have a Relationship Category; each audience on a flexible one needs a permitted relationship.")}
${endpointCard("GET", "/referral_link_details/{id}/definition", "Get a Signup Page's Form Definition", true, [
{ name: "id", in: "path", type: "integer", required: true, desc: "Signup Page ID" }
], [