Skip to content
CADCAMFUN
Docs

Documentation

Tool storage

Tool storage data and collection or per-tool import/export.

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

7 endpoints in the toolsStorage 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.

post /api/tools/{id}/storage toolsStorage.save
get /api/tools/{id}/storage toolsStorage.read
delete /api/tools/{id}/storage toolsStorage.remove
get /api/tools/export-import toolsStorage.export
post /api/tools/export-import toolsStorage.import
get /api/tools/{id}/export-import toolsStorage.exportById
post /api/tools/{id}/export-import toolsStorage.importById
Tool storage operations in 3D Drag to orbit · scroll to zoom · right-drag to pan
One block per operation (7), 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/tools

post /api/tools/{id}/storage # toolsStorage.save

Requires Authorization: Bearer <token>.

Parameters
NameInTypeRequired
id path string required
Request body · required · application/json
unknown
Responses
200 object application/json
{
  success: true
  message: string
  data: unknown | null
}
400 EnvBadRequestEncoded application/json
EnvBadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 EnvForbiddenEncoded application/json
EnvForbiddenEncoded
404 EnvNotFoundEncoded application/json
EnvNotFoundEncoded
405 EnvMethodNotAllowedEncoded application/json
EnvMethodNotAllowedEncoded
500 EnvInternalEncoded application/json
EnvInternalEncoded
SDK example
toolsStorage.save
import { CadCam } from "@cadcamfun/api/sdk"

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

// ToolsStorageSaveInput
const result = await client.toolsStorage.save({
  id: "<id>"
})
curl
POST /api/tools/{id}/storage
curl --request POST "${CADCAMFUN_URL}/api/tools/<id>/storage" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
Try it
get /api/tools/{id}/storage # toolsStorage.read

Requires Authorization: Bearer <token>.

Parameters
NameInTypeRequired
id path string required
path query string | null optional
signedUrl query string | null optional
Responses
200 object application/json
{
  success: true
  message: string
  data: unknown | null
}
400 EnvBadRequestEncoded application/json
EnvBadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 EnvForbiddenEncoded application/json
EnvForbiddenEncoded
404 EnvNotFoundEncoded application/json
EnvNotFoundEncoded
405 EnvMethodNotAllowedEncoded application/json
EnvMethodNotAllowedEncoded
500 EnvInternalEncoded application/json
EnvInternalEncoded
SDK example
toolsStorage.read
import { CadCam } from "@cadcamfun/api/sdk"

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

// ToolsStorageReadInput
const result = await client.toolsStorage.read({
  id: "<id>"
})
curl
GET /api/tools/{id}/storage
curl --request GET "${CADCAMFUN_URL}/api/tools/<id>/storage" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Try it
delete /api/tools/{id}/storage # toolsStorage.remove

Requires Authorization: Bearer <token>.

Parameters
NameInTypeRequired
id path string required
path query string | null optional
Responses
200 object application/json
{
  success: true
  message: string
  data: unknown | null
}
400 EnvBadRequestEncoded application/json
EnvBadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 EnvForbiddenEncoded application/json
EnvForbiddenEncoded
404 EnvNotFoundEncoded application/json
EnvNotFoundEncoded
405 EnvMethodNotAllowedEncoded application/json
EnvMethodNotAllowedEncoded
500 EnvInternalEncoded application/json
EnvInternalEncoded
SDK example
toolsStorage.remove
import { CadCam } from "@cadcamfun/api/sdk"

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

// ToolsStorageRemoveInput
const result = await client.toolsStorage.remove({
  id: "<id>"
})
curl
DELETE /api/tools/{id}/storage
curl --request DELETE "${CADCAMFUN_URL}/api/tools/<id>/storage" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Try it
get /api/tools/{id}/export-import # toolsStorage.exportById

Requires Authorization: Bearer <token>.

Parameters
NameInTypeRequired
id path string required
ids query string | string[] | null optional
format query string | null optional
Responses
200 any JSON value application/json
unknown
400 EnvBadRequestEncoded application/json
EnvBadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 EnvForbiddenEncoded application/json
EnvForbiddenEncoded
404 EnvNotFoundEncoded application/json
EnvNotFoundEncoded
405 EnvMethodNotAllowedEncoded application/json
EnvMethodNotAllowedEncoded
500 EnvInternalEncoded application/json
EnvInternalEncoded
SDK example
toolsStorage.exportById
import { CadCam } from "@cadcamfun/api/sdk"

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

// ToolsStorageExportByIdInput
const result = await client.toolsStorage.exportById({
  id: "<id>"
})
curl
GET /api/tools/{id}/export-import
curl --request GET "${CADCAMFUN_URL}/api/tools/<id>/export-import" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Try it
post /api/tools/{id}/export-import # toolsStorage.importById

Requires Authorization: Bearer <token>.

Parameters
NameInTypeRequired
id path string required
Request body · required · application/json
unknown
Responses
200 object application/json
{
  success: true
  message: string
  data: unknown | null
}
400 EnvBadRequestEncoded application/json
EnvBadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 EnvForbiddenEncoded application/json
EnvForbiddenEncoded
404 EnvNotFoundEncoded application/json
EnvNotFoundEncoded
405 EnvMethodNotAllowedEncoded application/json
EnvMethodNotAllowedEncoded
500 EnvInternalEncoded application/json
EnvInternalEncoded
SDK example
toolsStorage.importById
import { CadCam } from "@cadcamfun/api/sdk"

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

// ToolsStorageImportByIdInput
const result = await client.toolsStorage.importById({
  id: "<id>"
})
curl
POST /api/tools/{id}/export-import
curl --request POST "${CADCAMFUN_URL}/api/tools/<id>/export-import" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
Try it

/api/tools/export-import

get /api/tools/export-import # toolsStorage.export

Requires Authorization: Bearer <token>.

Parameters
NameInTypeRequired
ids query string | string[] | null optional
format query string | null optional
Responses
200 any JSON value application/json
unknown
400 EnvBadRequestEncoded application/json
EnvBadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 EnvForbiddenEncoded application/json
EnvForbiddenEncoded
404 EnvNotFoundEncoded application/json
EnvNotFoundEncoded
405 EnvMethodNotAllowedEncoded application/json
EnvMethodNotAllowedEncoded
500 EnvInternalEncoded application/json
EnvInternalEncoded
Example response captured · 404
GET /api/tools/export-import
{
  "_tag": "EnvNotFound",
  "success": false,
  "message": "No accessible tools found",
  "errors": null
}
SDK example
toolsStorage.export
import { CadCam } from "@cadcamfun/api/sdk"

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

// ToolsStorageExportInput
const result = await client.toolsStorage.export({})
curl
GET /api/tools/export-import
curl --request GET "${CADCAMFUN_URL}/api/tools/export-import" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
Try it
post /api/tools/export-import # toolsStorage.import

Requires Authorization: Bearer <token>.

Request body · required · application/json
unknown
Responses
200 object application/json
{
  success: true
  message: string
  data: unknown | null
}
400 EnvBadRequestEncoded application/json
EnvBadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
403 EnvForbiddenEncoded application/json
EnvForbiddenEncoded
404 EnvNotFoundEncoded application/json
EnvNotFoundEncoded
405 EnvMethodNotAllowedEncoded application/json
EnvMethodNotAllowedEncoded
500 EnvInternalEncoded application/json
EnvInternalEncoded
SDK example
toolsStorage.import
import { CadCam } from "@cadcamfun/api/sdk"

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

// ToolsStorageImportInput
const result = await client.toolsStorage.import({})
curl
POST /api/tools/export-import
curl --request POST "${CADCAMFUN_URL}/api/tools/export-import" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
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.

EnvBadRequestEncoded
{
  _tag: "EnvBadRequest"
  success: false
  message: string
  errors: unknown | null
}
EnvForbiddenEncoded
{
  _tag: "EnvForbidden"
  success: false
  message: string
  errors: unknown | null
}
EnvInternalEncoded
{
  _tag: "EnvInternal"
  success: false
  message: string
  errors: unknown | null
}
EnvMethodNotAllowedEncoded
{
  _tag: "EnvMethodNotAllowed"
  success: false
  message: string
  errors: unknown | null
}
EnvNotFoundEncoded
{
  _tag: "EnvNotFound"
  success: false
  message: string
  errors: unknown | null
}
UnauthorizedEncoded
{
  _tag: "Unauthorized"
  message: string
}

Calling this group

Operation ids have the form toolsStorage.<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.