Documentation
Toolpath history
Toolpath versions, restoration, library discovery, and threaded program comments.
Send these requests to your own running sidecar. Values stay in this browser.
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
8 endpoints in the toolpathExtras 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/toolpaths/library | toolpathExtras.library |
| get | /api/toolpaths/{id}/versions | toolpathExtras.listVersions |
| post | /api/toolpaths/{id}/versions | toolpathExtras.createVersion |
| post | /api/toolpaths/{id}/versions/restore | toolpathExtras.restoreVersion |
| get | /api/toolpaths/{id}/comments | toolpathExtras.listComments |
| post | /api/toolpaths/{id}/comments | toolpathExtras.createComment |
| put | /api/toolpaths/{id}/comments/{commentId} | toolpathExtras.updateComment |
| delete | /api/toolpaths/{id}/comments/{commentId} | toolpathExtras.removeComment |
/api/toolpaths/library
toolpathExtras.library Requires Authorization: Bearer <token>.
| Name | In | Type | Required |
|---|---|---|---|
| projectId | query | string | required |
| type | query | string | null | optional |
| operationType | query | string | null | optional |
| category | query | string | null | optional |
| search | query | string | null | optional |
200 Array<object> application/json
Array<{ id: string name: string description: string type: string operationType: string category: string tags: string[] data: unknown gcode: string projectId: string }>
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK example
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// ToolpathExtrasLibraryInput
const result = await client.toolpathExtras.library({}) curl
curl --request GET "${CADCAMFUN_URL}/api/toolpaths/library?projectId=<projectId>" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" Try it
/api/toolpaths
toolpathExtras.listVersions Requires Authorization: Bearer <token>.
| Name | In | Type | Required |
|---|---|---|---|
| id | path | string | required |
200 Array<object> application/json
Array<{ id: string toolpathId: string data: unknown gcode: string | null changeMessage: string | null userId: string createdAt: string user: { name: string | null email: string | null } | null }>
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK example
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// ToolpathExtrasListVersionsInput
const result = await client.toolpathExtras.listVersions({
id: "<id>"
}) curl
curl --request GET "${CADCAMFUN_URL}/api/toolpaths/<id>/versions" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" Try it
toolpathExtras.createVersion Requires Authorization: Bearer <token>.
| Name | In | Type | Required |
|---|---|---|---|
| id | path | string | required |
{ data?: unknown | null gcode?: string | null changeMessage?: string | null }
201 object application/json
{ id: string toolpathId: string data: unknown gcode: string | null changeMessage: string | null userId: string createdAt: string message: string }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK example
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// ToolpathExtrasCreateVersionInput
const result = await client.toolpathExtras.createVersion({
id: "<id>",
data: null,
gcode: "",
changeMessage: ""
}) curl
curl --request POST "${CADCAMFUN_URL}/api/toolpaths/<id>/versions" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
--header "Content-Type: application/json" \
--data-binary @request.json Try it
toolpathExtras.restoreVersion Requires Authorization: Bearer <token>.
| Name | In | Type | Required |
|---|---|---|---|
| id | path | string | required |
{ versionId: string }
200 object application/json
{ id: string name: string description: string | null data: unknown type: string | null operationType: string | null gcode: string | null thumbnail: string | null isPublic: boolean projectId: string createdAt: string updatedAt: string createdBy: string drawingId: string | null materialId: string | null toolId: string | null machineConfigId: string | null message: string }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK example
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// ToolpathExtrasRestoreVersionInput
const result = await client.toolpathExtras.restoreVersion({
id: "<id>",
versionId: ""
}) curl
curl --request POST "${CADCAMFUN_URL}/api/toolpaths/<id>/versions/restore" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
--header "Content-Type: application/json" \
--data-binary @request.json Try it
toolpathExtras.listComments Requires Authorization: Bearer <token>.
| Name | In | Type | Required |
|---|---|---|---|
| id | path | string | required |
200 Array<object> application/json
Array<{ id: string toolpathId: string content: string userId: string createdAt: string updatedAt: string user: { id: string name: string | null email: string | null image: string | null } | null }>
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK example
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// ToolpathExtrasListCommentsInput
const result = await client.toolpathExtras.listComments({
id: "<id>"
}) curl
curl --request GET "${CADCAMFUN_URL}/api/toolpaths/<id>/comments" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" Try it
toolpathExtras.createComment Requires Authorization: Bearer <token>.
| Name | In | Type | Required |
|---|---|---|---|
| id | path | string | required |
{ content: string }
201 object application/json
{ id: string toolpathId: string content: string userId: string createdAt: string updatedAt: string user: { id: string name: string | null email: string | null image: string | null } | null }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK example
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// ToolpathExtrasCreateCommentInput
const result = await client.toolpathExtras.createComment({
id: "<id>",
content: ""
}) curl
curl --request POST "${CADCAMFUN_URL}/api/toolpaths/<id>/comments" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
--header "Content-Type: application/json" \
--data-binary @request.json Try it
toolpathExtras.updateComment Requires Authorization: Bearer <token>.
| Name | In | Type | Required |
|---|---|---|---|
| id | path | string | required |
| commentId | path | string | required |
{ content: string }
200 object application/json
{ id: string toolpathId: string content: string userId: string createdAt: string updatedAt: string user: { id: string name: string | null email: string | null image: string | null } | null }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK example
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// ToolpathExtrasUpdateCommentInput
const result = await client.toolpathExtras.updateComment({
id: "<id>",
commentId: "<commentId>",
content: ""
}) curl
curl --request PUT "${CADCAMFUN_URL}/api/toolpaths/<id>/comments/<commentId>" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
--header "Content-Type: application/json" \
--data-binary @request.json Try it
toolpathExtras.removeComment Requires Authorization: Bearer <token>.
| Name | In | Type | Required |
|---|---|---|---|
| id | path | string | required |
| commentId | path | string | required |
200 object application/json
{ message: string }
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 ForbiddenEncoded application/json
ForbiddenEncoded
404 NotFoundEncoded application/json
NotFoundEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
SDK example
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// ToolpathExtrasRemoveCommentInput
const result = await client.toolpathExtras.removeComment({
id: "<id>",
commentId: "<commentId>"
}) curl
curl --request DELETE "${CADCAMFUN_URL}/api/toolpaths/<id>/comments/<commentId>" \
--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 }
ForbiddenEncoded{ _tag: "Forbidden" message: string }
InternalErrorEncoded{ _tag: "InternalError" message: string }
NotFoundEncoded{ _tag: "NotFound" message: string }
Calling this group
Operation ids have the form toolpathExtras.<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.
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
| Symptom | Likely cause | Fix |
|---|---|---|
| 401 on every call | Token from a previous launch, or missing Bearer prefix | Send Authorization: Bearer <token> with the token the sidecar was started with. |
| 400 before anything happens | Body or parameter does not match the schema | Compare the payload with the request schema on the card. |
| 403 or 404 on a record you can see elsewhere | The acting account differs | Send the right x-session-token, or use the local profile that owns the record. |
| 409 | Conflicting state, such as a duplicate name or a stale branch head | Re-read the resource and retry with current data. |
| Try it says "blocked by CORS" | The docs are served from a non-loopback origin | Run the docs locally or copy the request as curl. |
| Connection refused | The sidecar restarted on a new port | Read the port from the new ready line. |