Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
158 changes: 158 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ tags:
description: Event Categories — templates for an organisation's events (e.g. Workshops, Classes, Meetings)
- name: Event Catalogues
description: Public, bookable lists of an organisation's upcoming events, and who can see them on the Contacts' Portal
- name: Contacts' Portal
description: Each Contact's own link to the Contacts' Portal, where they book onto events from Event Catalogues
- name: Webhooks
description: |
HTTPS endpoints an Organisation's admins register to receive signed events when
Expand Down Expand Up @@ -4310,6 +4312,120 @@ paths:
"422":
$ref: '#/components/responses/UnprocessableEntityList'

/projects/{project_id}/portal_links:
get:
tags: [Contacts' Portal]
summary: List Contacts' Portal links in a project
operationId: listPortalLinks
description: |
Lists the project's Contacts who can see at least one Event Catalogue on the Contacts'
Portal, where Contacts book onto events, as the project's Portal Links page shows them:
whether each has a Portal link, when it was last sent and how, and whether they can be
sent it by email or SMS. The link itself is never returned, because it signs the Contact
in to their Portal. Project Managers and Reporters of the project, and the organisation's
Admins and Reporters, may read it. To give a Contact access, change who can see an Event
Catalogue in the project (`PATCH /event_catalogues/{id}/projects/{project_id}/access`).
security: [{tokenAuth: []}]
parameters:
- name: project_id
in: path
required: true
schema:
type: integer
- $ref: '#/components/parameters/Page'
- $ref: '#/components/parameters/PerPage'
responses:
"200":
description: One page of Contacts, by name
content:
application/json:
schema:
$ref: '#/components/schemas/PaginatedPortalLinks'
example:
page: 1
page_size: 1
page_count: 1
total_count: 1
data:
- contact_id: 9001
name: Amara Diallo
link_status: active
last_sent_at: "2026-10-20T09:15:00Z"
last_sent_channel: email
can_email: true
can_sms: false
"401":
$ref: '#/components/responses/Unauthorized'
"403":
$ref: '#/components/responses/PortalLinksForbidden'
"404":
$ref: '#/components/responses/NotFound'

/projects/{project_id}/portal_links/send:
post:
tags: [Contacts' Portal]
summary: Send Contacts their Portal link
operationId: sendPortalLinks
description: |
Sends each Contact their own link to the Contacts' Portal by email or SMS, as the Send
button on the project's Portal Links page does, creating the link if they don't have one
yet. Every Contact must be in the project and able to see at least one of its Event
Catalogues; otherwise nothing is sent and the response says why. Contacts with no email
address (or, for SMS, no mobile number) are skipped and named in `skipped`. Only the
project's Project Managers and the organisation's Admins may send links.
security: [{tokenAuth: []}]
parameters:
- name: project_id
in: path
required: true
schema:
type: integer
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [contact_ids, channel]
properties:
contact_ids:
type: array
items:
type: integer
channel:
type: string
enum: [email, sms]
example:
contact_ids: [9001, 9002]
channel: email
responses:
"200":
description: The links were queued to send
content:
application/json:
schema:
type: object
properties:
sent:
type: integer
description: How many Contacts were sent their link
skipped:
type: array
description: Names of the Contacts with no way to receive it
items:
type: string
example:
sent: 1
skipped: [Ben Okafor]
"401":
$ref: '#/components/responses/Unauthorized'
"403":
$ref: '#/components/responses/PortalLinksForbidden'
"404":
$ref: '#/components/responses/NotFound'
"422":
$ref: '#/components/responses/UnprocessableEntityList'

/library/search:
get:
tags: [Library]
Expand Down Expand Up @@ -7218,6 +7334,14 @@ components:
$ref: '#/components/schemas/Error'
example:
error: "You don't have permission to manage this organisation's Event Catalogues."
PortalLinksForbidden:
description: You don't have permission for this project's Portal links
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: "You don't have permission to send Portal links in this project."
EventFormatAdminOnly:
description: You are not an Organisation Admin of the organisation that owns the Event Format
content:
Expand Down Expand Up @@ -11120,6 +11244,40 @@ components:
items:
type: integer

PortalLink:
type: object
properties:
contact_id:
type: integer
name:
type: string
link_status:
type: string
enum: [active, deactivated, none]
description: none means the Contact has never been sent a link
last_sent_at:
type: string
format: date-time
nullable: true
last_sent_channel:
type: string
enum: [email, sms]
nullable: true
can_email:
type: boolean
can_sms:
type: boolean

PaginatedPortalLinks:
allOf:
- $ref: '#/components/schemas/PaginationEnvelope'
- type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/PortalLink'

PaginatedEventFormats:
allOf:
- $ref: '#/components/schemas/PaginationEnvelope'
Expand Down
31 changes: 31 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,7 @@ function buildDocsPage() {
<a href="#events" class="nav-link"><span class="nav-method method-GET">GET</span>Events</a>
<a href="#event-formats" class="nav-link"><span class="nav-method method-GET">GET</span>Event Formats</a>
<a href="#event-catalogues" class="nav-link"><span class="nav-method method-GET">GET</span>Event Catalogues</a>
<a href="#contacts-portal" class="nav-link"><span class="nav-method method-POST">POST</span>Contacts' Portal</a>
</div>
<div class="nav-section">
<div class="nav-section-label">Integrations</div>
Expand Down Expand Up @@ -2593,6 +2594,36 @@ function buildDocsPage() {
</div>
</section>

<!-- Contacts' Portal -->
<section class="section" id="contacts-portal">
<div class="section-eyebrow">Events</div>
<h2 class="section-title">Contacts' Portal</h2>
<div class="section-desc">
<p>Each Contact has their own link to the Contacts' Portal, where they see the Event Catalogues their project lets them see and book onto events. These endpoints do what a project's Portal Links page does: list the Contacts who can see at least one Event Catalogue, and send them their link by email or SMS. The link itself is never returned, because it signs the Contact in to their Portal.</p>
<p>To give a Contact Portal access, first let them see an Event Catalogue (<code>PATCH /event_catalogues/{id}/projects/{project_id}/access</code>), then send them their link. Project Managers, Reporters and Organisation Admins and Reporters can list; only Project Managers and Organisation Admins can send.</p>
</div>
<div class="endpoint-list">
${endpointCard("GET", "/projects/{project_id}/portal_links", "List Contacts' Portal links in a project", true, [
{ name: "project_id", in: "path", type: "integer", required: true, desc: "Project ID" },
{ name: "page", type: "integer", required: false, desc: "Page number" },
{ name: "per_page", type: "integer", required: false, desc: "Records per page" }
], [
{ code: "200", cls: "response-2xx", desc: "Each Contact's link_status (active, deactivated or none), last_sent_at, last_sent_channel, can_email and can_sms" },
{ code: "403", cls: "response-4xx", desc: "Not a Project Manager or Reporter of the project, or an Organisation Admin or Reporter" },
{ code: "404", cls: "response-4xx", desc: "Not found" }
])}
${endpointCard("POST", "/projects/{project_id}/portal_links/send", "Send Contacts their Portal link", true, [
{ name: "project_id", in: "path", type: "integer", required: true, desc: "Project ID" },
{ name: "contact_ids", type: "array", required: true, desc: "Contacts in the project who can see an Event Catalogue" },
{ name: "channel", type: "string", required: true, desc: "email or sms" }
], [
{ code: "200", cls: "response-2xx", desc: "sent (how many) and skipped (names of Contacts with no email address or mobile number)" },
{ code: "403", cls: "response-4xx", desc: "Not a Project Manager of the project or an Organisation Admin" },
{ code: "422", cls: "response-4xx", desc: "e.g. a Contact who can't see any Event Catalogue yet, or none can receive it" }
])}
</div>
</section>

<!-- Webhooks -->
<section class="section" id="webhooks">
<div class="section-eyebrow">Integrations</div>
Expand Down