Developer documentation

CodeCanvas API reference

Give an LLM or trusted developer tool the ability to inspect a CodeCanvas project, locate a type or member, and make a focused model change.

Overview

The CodeCanvas API is a JSON REST API for trusted developer tools. It works with the visual type model stored in a project, not source files on disk.

A practical integration first lists projects, reads the selected project, then sends a focused operation such as updating one method or adding one property. The API returns the changed model item so your LLM can confirm its work.

LLM workflow

  1. 1

    List projects

    Call the workspace endpoint with no project selector. Save the numeric project ID for the project the user names.

  2. 2

    Inspect the model

    Read the project by ID. The response includes types and their members, including stable IDs and names.

  3. 3

    Locate the target

    Match the requested type and member by its ID when available, or by its exact name. Read before changing so the LLM can verify the target.

  4. 4

    Apply one operation

    Send a focused add, update, or delete operation. The API validates ownership and returns the changed item.

curl "https://code-canvas.cloud/api/external/workspace" \
  -H "Authorization: Bearer YOUR_API_KEY"

Authentication

Pass your API key as a bearer token with every request.

Authorization: Bearer cc_live_your_secret_key

workspace:read

List projects and inspect the types, members, and layout in a project owned by the API-key owner.

workspace:write

Apply focused type and member changes to a project owned by the API-key owner.

Key security

Keep keys private

Do not expose API keys in browser code, public repositories, screenshots, or client-side applications.

Rotate when needed

Creating a replacement key invalidates the previous key. Update your integration with the new key right away.

Revoke immediately

Revoke a key from Account if you suspect it has been exposed. Revoked keys cannot access the API.

Projects and inspection

GET/api/external/workspace

List workspace projects

Returns the projects owned by the API-key owner. Use the returned numeric id to select a project.

Required scope: workspace:read

Request

curl "https://code-canvas.cloud/api/external/workspace" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response

{
  "projects": [
    { "id": 42, "name": "Domain model", "visibility": "private" }
  ]
}
GET/api/external/workspace?projectId={id}

Inspect a workspace project

Returns the complete type model and layout for one project. Use ?name=Domain%20model only when the name is unique.

Required scope: workspace:read

Request

curl "https://code-canvas.cloud/api/external/workspace?projectId=42" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response

{
  "workspace": {
    "id": 42,
    "name": "Domain model",
    "types": [
      { "id": "order", "name": "Order", "kind": "class", "members": [
        { "id": "total", "name": "CalculateTotal()", "kind": "Method", "type": "decimal" }
      ] }
    ],
    "layout": {}
  }
}

Make a targeted model change

POST /api/external/workspace/operations applies one focused change. It does not replace the entire project. Read the project first, then use the IDs returned by the inspection response whenever possible.

Update one function

Request

curl -X POST "https://code-canvas.cloud/api/external/workspace/operations" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "projectId": 42,
    "operation": "updateMember",
    "type": "order",
    "member": "total",
    "patch": {
      "name": "CalculateGrandTotal()",
      "type": "decimal"
    }
  }'

Response

{
  "ok": true,
  "projectId": 42,
  "operation": "updateMember",
  "member": {
    "id": "total",
    "name": "CalculateGrandTotal()",
    "kind": "Method",
    "type": "decimal"
  }
}

Add a property to a type

Request

curl -X POST "https://code-canvas.cloud/api/external/workspace/operations" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "projectId": 42,
    "operation": "addMember",
    "type": "order",
    "value": {
      "name": "Status",
      "kind": "Property",
      "type": "string",
      "canGet": true,
      "canSet": true,
      "access": ["public"]
    }
  }'

Response

{
  "ok": true,
  "projectId": 42,
  "operation": "addMember",
  "member": {
    "name": "Status",
    "kind": "Property",
    "type": "string"
  }
}

Focused operations

FieldTypeRequiredDescription
projectIdnumberRequiredThe numeric project ID returned by the project list.
operationstringRequiredOne of addType, updateType, deleteType, addMember, updateMember, or deleteMember.
typestringRequiredThe target type ID or exact type name.
memberstringFor member operationsThe target member ID or exact member name.
patchobjectFor update operationsOnly the fields to change. IDs and a type’s members cannot be overwritten through a type patch.
valueobjectFor add operationsThe new type or member. A type needs name and kind; a member needs name and kind.

Response codes

200

Success

The request completed and the response contains the changed model item.

400

Invalid request

A required field is missing, invalid, or the operation name is unsupported.

401

Missing or invalid key

The API key is missing, invalid, or revoked.

403

Missing scope

The API key does not include the required scope.

404

Not found

The project, type, or member does not exist or is not owned by the API-key owner.

409

Conflict

A duplicate name exists or a project-name lookup is ambiguous. Use stable IDs.

500

Server error

The request could not be completed. Retry later with the same payload.

Error format

Error responses use JSON with an error message.

{
  "error": "Member not found."
}

Need to manage your key?

Create, rotate, or revoke your API key from your signed-in account page.

Open account