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
List projects
Call the workspace endpoint with no project selector. Save the numeric project ID for the project the user names.
- 2
Inspect the model
Read the project by ID. The response includes types and their members, including stable IDs and names.
- 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
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_keyworkspace: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
/api/external/workspaceList 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" }
]
}/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
| Field | Type | Required | Description |
|---|---|---|---|
| projectId | number | Required | The numeric project ID returned by the project list. |
| operation | string | Required | One of addType, updateType, deleteType, addMember, updateMember, or deleteMember. |
| type | string | Required | The target type ID or exact type name. |
| member | string | For member operations | The target member ID or exact member name. |
| patch | object | For update operations | Only the fields to change. IDs and a type’s members cannot be overwritten through a type patch. |
| value | object | For add operations | The new type or member. A type needs name and kind; a member needs name and kind. |
Response codes
Success
The request completed and the response contains the changed model item.
Invalid request
A required field is missing, invalid, or the operation name is unsupported.
Missing or invalid key
The API key is missing, invalid, or revoked.
Missing scope
The API key does not include the required scope.
Not found
The project, type, or member does not exist or is not owned by the API-key owner.
Conflict
A duplicate name exists or a project-name lookup is ambiguous. Use stable IDs.
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