Skip to content
CADCAMFUN
Docs

Documentation

Notifications

Notification listing, read-state updates, deletion, and mark-all-read.

Playground

Send these requests to your own running sidecar. Values stay in this browser.

Not connected
How this works

The sidecar listens on a loopback port chosen at startup and prints it in its ready line; use that URL and the CADCAMFUN_TOKEN it was started with. Requests go straight from this page to that address.

The sidecar sends CORS headers only to the Tauri origins and to http://localhost or http://127.0.0.1 on any port. From the hosted docs the browser blocks the response, so run the docs locally (bun run dev in packages/web) to use the playground, or copy the request as curl. To experiment without touching real data, start the sidecar with CADCAMFUN_DATA_DIR pointed at a throwaway directory — see the API walkthrough.

Operations

4 endpoints in the notifications group, generated from the sidecar's own OpenAPI document. Protected operations take Authorization: Bearer $CADCAMFUN_TOKEN; see authentication. Behaviour and limits are in the subsystem guide.

get /api/notifications notifications.list
put /api/notifications/{id} notifications.update
delete /api/notifications/{id} notifications.remove
post /api/notifications/mark-all-read notifications.markAllRead
Notifications operations in 3D Drag to orbit · scroll to zoom · right-drag to pan
One block per operation (4), stacked per resource section of this page and coloured by method: green GET, orange POST, blue PUT, violet PATCH, red DELETE. Generated from the OpenAPI document at build time.

/api/notifications

get /api/notifications # notifications.list

Requires Authorization: Bearer <token>.

Parameters
NameInTypeRequired
limit query string | null optional
offset query string | null optional
cursor query string | null optional
onlyUnread query string | null optional
Responses
200 object application/json
{
  notifications: Array<{
    id: string
    type: "NEW_MESSAGE" | "PROJECT_CREATED" | "COMPONENT_CREATED" | "MEMBER_JOINED" | "ORGANIZATION_INVITATION" | "PR_OPENED" | "PR_MERGED" | "PR_REVIEWED" | "AI_COMMITTED" | "WORKFLOW_FAILED" | "WORKFLOW_PASSED"
    title: string
    content: string
    isRead: boolean
    createdAt: string
    userId: string
    organizationId: string | null
    projectId: string | null
    componentId: string | null
    messageId: string | null
    linkUrl: string | null
  }>
  unreadCount: number | "Infinity" | "-Infinity" | "NaN"
  nextCursor: string | null
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
Example response captured · 200
GET /api/notifications
{
  "notifications": [],
  "unreadCount": 0
}
SDK example
notifications.list
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// NotificationsListInput
const result = await client.notifications.list({})
curl
GET /api/notifications
curl --request GET "${CADCAMFUN_URL}/api/notifications" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Try it
put /api/notifications/{id} # notifications.update

Requires Authorization: Bearer <token>.

Parameters
NameInTypeRequired
id path string required
Request body · required · application/json
{
  isRead: boolean
}
Responses
200 object application/json
{
  id: string
  type: "NEW_MESSAGE" | "PROJECT_CREATED" | "COMPONENT_CREATED" | "MEMBER_JOINED" | "ORGANIZATION_INVITATION" | "PR_OPENED" | "PR_MERGED" | "PR_REVIEWED" | "AI_COMMITTED" | "WORKFLOW_FAILED" | "WORKFLOW_PASSED"
  title: string
  content: string
  isRead: boolean
  createdAt: string
  userId: string
  organizationId: string | null
  projectId: string | null
  componentId: string | null
  messageId: string | null
  linkUrl: string | null
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK example
notifications.update
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// NotificationsUpdateInput
const result = await client.notifications.update({
  id: "<id>",
  isRead: false
})
curl
PUT /api/notifications/{id}
curl --request PUT "${CADCAMFUN_URL}/api/notifications/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
Try it
delete /api/notifications/{id} # notifications.remove

Requires Authorization: Bearer <token>.

Parameters
NameInTypeRequired
id path string required
Responses
200 object application/json
{
  message: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK example
notifications.remove
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// NotificationsRemoveInput
const result = await client.notifications.remove({
  id: "<id>"
})
curl
DELETE /api/notifications/{id}
curl --request DELETE "${CADCAMFUN_URL}/api/notifications/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Try it

/api/notifications/mark-all-read

post /api/notifications/mark-all-read # notifications.markAllRead

Requires Authorization: Bearer <token>.

Responses
200 object application/json
{
  message: string
  count: number | "Infinity" | "-Infinity" | "NaN"
}
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK example
notifications.markAllRead
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// no input
const result = await client.notifications.markAllRead()
curl
POST /api/notifications/mark-all-read
curl --request POST "${CADCAMFUN_URL}/api/notifications/mark-all-read" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Try it

Schemas

Named schemas reachable from this group's parameters, bodies and responses. A ? marks an optional field; | null marks a field that may be present with a null value.

BadRequestEncoded
{
  _tag: "BadRequest"
  message: string
}
InternalErrorEncoded
{
  _tag: "InternalError"
  message: string
}
NotFoundEncoded
{
  _tag: "NotFound"
  message: string
}
UnauthorizedEncoded
{
  _tag: "Unauthorized"
  message: string
}

Calling this group

Operation ids have the form notifications.<name>. The generated Promise SDK (@cadcamfun/api/sdk) exposes most of them as client.<namespace>.<method>(input), where input is one flat object of path parameters and body fields; each card's SDK example shows the exact accessor and input type. Multipart uploads, binary or JavaScript responses and raw webhooks are not generated; those cards show fetch instead.

Errors from the Promise SDK
import { CadCam, ClientError } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

try {
  await client.projects.list()
} catch (error) {
  if (error instanceof ClientError) {
    // Transport | UnexpectedStatus | UnsupportedContentType | MalformedResponse | SseEventTooLarge
  } else {
    // a declared error body: switch on error._tag
  }
}

Troubleshooting

SymptomLikely causeFix
401 on every callToken from a previous launch, or missing Bearer prefixSend Authorization: Bearer <token> with the token the sidecar was started with.
400 before anything happensBody or parameter does not match the schemaCompare the payload with the request schema on the card.
403 or 404 on a record you can see elsewhereThe acting account differsSend the right x-session-token, or use the local profile that owns the record.
409Conflicting state, such as a duplicate name or a stale branch headRe-read the resource and retry with current data.
Try it says "blocked by CORS"The docs are served from a non-loopback originRun the docs locally or copy the request as curl.
Connection refusedThe sidecar restarted on a new portRead the port from the new ready line.