API Reference

The TrustRelay REST API is served by the trustrelay-api Go service.


Base URL

Always relative to the customer’s deployment (e.g. https://my-instance.trustrelay.io). All paths below are relative to this base.


Authentication

ContextMechanism
App routes (/api/*)Session cookie (session) set at login
MCP endpoints (/mcp, /api/mcp)Authorization: Bearer <PAT>

Requests to protected routes without a valid session/token return 401 Unauthorized.


Response envelope

All JSON endpoints (except binary media and MCP stream endpoints) wrap their response:

{ "value": <T>, "error": { "code": "...", "message": "..." } }

On success, error is omitted. On failure, value is omitted and error is populated.

Exceptions (raw responses, not wrapped):

  • GET /api/logo
  • GET /api/products/{productversionid}/cover
  • POST /api/export/dxf
  • /mcp and /api/mcp (MCP stream)

Rate limiting

Rate limiting is enforced per IP address on GET, POST, DELETE, PUT, and PATCH methods. The rate is controlled by the THROTTLE_REQUESTS_PER_SECOND environment variable. Exceeding the limit returns 429 Too Many Requests.


Timeouts

RouteTimeout
All routes30 seconds
POST /api/jsonrpc60 seconds
/mcp, /api/mcpNo timeout (long-lived)

Auth

POST /api/auth/login

Authenticates a user and sets a session cookie.

Request:

{ "email": "user@example.com", "password": "..." }

Response 200:

{ "value": { "token": "...", "expires_at": 1234567890 } }

POST /api/auth/logout

Invalidates the current session. The session cookie is cleared.

POST /api/auth/verify

Validates the current session cookie. Used by the SvelteKit hooks.server.ts on every page load.

Response 200:

{
  "value": {
    "user": {
      "account_id": "uuid",
      "email": "user@example.com",
      "first_name": "Jane",
      "last_name": "Doe",
      "organisation_id": "uuid",
      "is_org_anchor": false,
      "is_user_owner": true,
      "is_user_deputy": false,
      "lang": "en",
      "is_org_external": false
    },
    "settings": {
      "tenant_name": "My Platform",
      "logo_url": "https://..."
    },
    "unread_notifications": 2,
    "unread_inbox_messages": 0
  }
}

Version

GET /api/version

Returns build information. No authentication required.

Response 200:

{
  "value": {
    "app_name": "trustrelay-api",
    "version": "1.2.3",
    "build_time": "2026-04-07T00:00:00Z",
    "git_hash": "abc1234"
  }
}

Settings

All settings endpoints require a valid session.

MethodPathDescription
GET/api/settings/general-infoTenant name, description, logo URL
PUT/api/settings/general-infoUpdate tenant info
GET/api/settings/logoLogo source configuration
PUT/api/settings/logoUpdate logo source
GET/api/logoRaw binary logo image
GET/api/settings/supportSupport contact settings
PUT/api/settings/supportUpdate support settings
GET/api/settings/appsLLM, email, and image service settings
PUT/api/settings/appsUpdate app integrations
GET/api/settings/supported-appsReturns { "unsplash": true, "ai": false } feature flags
GET/api/settings/rolesSystem-level role assignments (anchor, deputy orgs)
POST/api/settings/rolesUpdate system roles
GET/api/settings/industry-classification-codesList of industry classification codes
GET/api/settings/countriesList of countries

Password reset

MethodPathDescription
GET/api/settings/password-reset-requestsList all active reset requests (admin)
GET/api/settings/password-reset-requests/{token}Get request by token (public)
POST/api/settings/password-reset-requestsCreate a reset request
POST/api/settings/reset-passwordSubmit new password via token

Users

MethodPathDescription
GET/api/usersList all platform users
GET/api/users/{userid}Get extended profile for a specific user
DELETE/api/users/{userid}Delete a user (admin only)

Current user (self)

MethodPathDescription
GET/api/user/overviewDashboard: pinned products, stats, activity (cached)
GET/api/user/profileCurrent user’s extended profile
PATCH/api/user/profileUpdate profile fields
GET/api/user/sessionsAll active login sessions
DELETE/api/user/sessions/{session}Revoke a session
GET/api/user/notificationsUnacknowledged notifications
POST/api/user/notifications/{notification}/ackAcknowledge a notification
POST/api/user/notifications/dismiss-allAcknowledge all pending notifications
GET/api/user/inboxInbox messages from product providers
POST/api/user/inbox/{message}/readMark message as read
POST/api/user/inbox/{message}/unreadMark message as unread
POST/api/user/inbox/{message}/flagFlag a message
POST/api/user/inbox/{message}/unflagUnflag a message
GET/api/user/personal-access-tokensList PATs
POST/api/user/personal-access-tokensCreate a new PAT
DELETE/api/user/personal-access-tokens/{patid}Revoke a PAT

Organisations

MethodPathDescription
GET/api/organisationsList all organisations
GET/api/organisations/{organisationid}Get public profile of an organisation
DELETE/api/organisations/{organisationid}Delete an organisation (admin only)
GET/api/organisationGet current user’s organisation (owner/deputy view)
PUT/api/organisationUpdate organisation details
PUT/api/organisation/rolesUpdate org owner/deputy assignments
GET/api/organisation/membersList organisation members

Data products

{productversionid} is the data_product_version_id UUID. {productid} is the parent data_product_id.

Listing and creating

MethodPathQuery paramsDescription
GET/api/productsfilter=published\|ou\|pinnedList products by filter
POST/api/productsCreate a blank draft product

Product lifecycle

MethodPathDescription
GET/api/products/{productversionid}Full extended profile
DELETE/api/products/{productversionid}Delete (draft only)
PUT/api/products/{productversionid}/pinPin/unpin for current user
POST/api/products/{productversionid}/publishPublish a draft
GET/api/products/{productversionid}/publication-statusReadiness checklist
POST/api/products/{productid}/draft-new-versionClone published → new draft
POST/api/products/{productid}/phase-outPhase out a published product

Metadata sections

Each section has a matching GET and PUT endpoint under /api/products/{productversionid}/:

SectionPath suffix
General Infogeneral-info
Data Schemadata-schema
Data Qualitydata-quality
Use Casesuse-cases
SLAsla
Supportsupport
Licenselicense
Lineagelineage
Pricingpricing
Approval Infoapproval-info
Credentialscredentials-info
Usage Infousage-info

Cover image

MethodPathDescription
GET/api/products/{productversionid}/coverRaw binary cover image
PUT/api/products/{productversionid}/coverUpload or set hotlink

Messaging and queries

MethodPathDescription
POST/api/products/{productversionid}/messagesSend message to all consumers
POST/api/products/{productversionid}/validate-sqlValidate a SQL statement against DuckDB

Agreements

MethodPathDescription
POST/api/products/{productversionid}/terminate-my-agreementConsumer terminates own agreement
POST/api/products/{productversionid}/consumers/{consumerid}/terminate-agreementProvider terminates a consumer’s agreement

Geo & time views

MethodPathDescription
GET/api/geo-productsProducts with geospatial queries (for map view)
GET/api/time-productsProducts with duration queries (for calendar view)
GET/api/insights/time/{category}/{topic}/{region}/{area}Time-series data from DuckDB

Search

GET /api/search?query=<term>&scope=<scope>

Full-text search over product general_info JSONB. Returns []ProductBasicInfo.


Access requests

MethodPathDescription
POST/api/sent-requestsSubmit an access request
GET/api/sent-requestsList own sent requests
DELETE/api/sent-requests/{requestid}Cancel a sent request
GET/api/received-requestsList requests received for own org’s products
PUT/api/received-requests/{requestid}/evaluationApprove or deny a request

See Access Management for business rules and status lifecycle.


Invitations

MethodPathDescription
GET/api/invitationsList recent invitations (last 30 days)
POST/api/invitationsCreate a new invitation
POST/api/org-invitationsInvite a user to your organisation
GET/api/invitations/{invitation_token}Get invitation by token (public, no auth)
DELETE/api/invitations/{invitation_id}Cancel an invitation
POST/api/invitations/{invitation_token}/acceptAccept an invitation (public, no auth)

Images

GET /api/images/previews?search=<term>

Proxies to the configured image service (e.g. Unsplash) to return cover image candidates. Requires the image integration to be enabled in Settings → Apps.


JSON-RPC

POST /api/jsonrpc

Executes named product queries via DuckDB. Uses JSON-RPC 2.0 request format. 60-second timeout.


MCP

MethodPathNotes
GET / POST / DELETE/mcpMCP streamable HTTP transport
GET / POST / DELETE/api/mcpAlias

Authentication: Authorization: Bearer <PAT>. No timeout. See MCP Integration.


DXF export

POST /api/export/dxf
Content-Type: application/json

Accepts a GeoJSON FeatureCollection. Returns a binary application/dxf attachment.


Error codes

HTTP statusMeaning
400Bad request — check the request body or business rule violation
401Unauthorized — missing or invalid session / PAT
403Forbidden — action not permitted for your role
404Not found
429Rate limited — slow down and retry
500Internal server error
ende