Managing Circuits
Create, list, update, and deprecate your AI circuits via the API.
Managing Circuits
A circuit is your versioned, reusable unit of AI logic on ModelWorks. This guide covers everything you can do with a circuit itself — creating one, fetching it, updating its metadata, starring it, and deprecating it. For the versions inside a circuit, see Circuit Versions.
Base URL
All examples assume the following base URL:
https://modelworks.ai/apiAuthentication
All endpoints below require an API token sent as Authorization: Bearer YOUR_API_TOKEN, unless the endpoint is marked public. See Authentication.
All list endpoints support pagination with limit (items per page) and page (1-based page number), and return a meta object containing total_count, limit, and page.
Create a circuit
POST /circuits
Creates a new circuit owned by the authenticated user.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes | Human-friendly circuit name. |
description | string | no | Short description shown in listings. |
is_private | boolean | no | If true, the circuit is private (default false). |
is_protected | boolean | no | If true, the circuit is protected. |
license_type | string | no | License identifier for the circuit. |
user_circuit_metric_uid | string | no | UID of an existing metric configuration to attach. |
Example
curl -X POST https://modelworks.ai/api/circuits \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "SEC Filing Discovery",
"description": "Finds SEC filings for a given ticker.",
"is_private": false,
"is_protected": false,
"license_type": "mit"
}'Response (200 OK)
Returns the created circuit object, including its uid, name, description, visibility flags, and timestamps.
Get a circuit
Fetch a circuit by its UID, or get just its primary version UID. To get the UID for a circuit, use the Slug Resolution endpoint to look up username/circuit-name before calling these endpoints.
GET /circuits/{circuit_uid}
Fetch a circuit by its unique ID. Public circuits need no auth; private or protected circuits require the owner's token.
curl https://modelworks.ai/api/circuits/73120d53-bf89-44fa-a035-5b88fe41574a \
-H "Authorization: Bearer YOUR_API_TOKEN"| Parameter | Type | Description |
|---|---|---|
circuit_uid | string | The circuit's unique ID. |
GET /circuits/{circuit_uid}/primary
Returns the UID of the circuit's primary version — the version that gets run when callers don't pin a specific one. Cache this and reuse it instead of re-fetching on every request.
curl https://modelworks.ai/api/circuits/73120d53-bf89-44fa-a035-5b88fe41574a/primary \
-H "Authorization: Bearer YOUR_API_TOKEN"| Parameter | Type | Description |
|---|---|---|
circuit_uid | string | The circuit's unique ID. |
List circuits
GET /users/{uid}/circuits
List a user's public circuits by their user UID. No authentication is needed to view public circuits; include your token only if you want to see private ones you own. To get a user's UID, use the Slug Resolution endpoint.
curl "https://modelworks.ai/api/users/4a1b2c3d-1234-4abc-9def-1234567890ab/circuits?limit=20&page=1" \
-H "Authorization: Bearer YOUR_API_TOKEN"| Parameter | Type | Description |
|---|---|---|
uid | string | The user whose circuits to list. |
limit | integer | Items per page (optional). |
page | integer | 1-based page number (optional). |
GET /circuits/{circuit_uid}/circuit-versions
List the versions of a circuit, newest first. Pagination applies.
curl "https://modelworks.ai/api/circuits/73120d53-bf89-44fa-a035-5b88fe41574a/circuit-versions?limit=10&page=1" \
-H "Authorization: Bearer YOUR_API_TOKEN"| Parameter | Type | Description |
|---|---|---|
circuit_uid | string | The circuit's unique ID. |
limit | integer | Items per page (optional). |
page | integer | 1-based page number (optional). |
Update a circuit
PUT /circuits/{circuit_uid}
Update a circuit's metadata or visibility. Owner only. To get the circuit's UID, use the Slug Resolution endpoint.
Request body
All fields are optional — send only the ones you want to change.
| Field | Type | Description |
|---|---|---|
description | string | New description. |
is_private | boolean | Toggle private visibility. |
is_protected | boolean | Toggle protected visibility. |
license_type | string | New license identifier. |
Example
curl -X PUT https://modelworks.ai/api/circuits/73120d53-bf89-44fa-a035-5b88fe41574a \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"description": "Finds SEC filings for a given ticker (updated).",
"is_private": true
}'Deprecate a circuit
PUT /circuits/{circuit_uid}/deprecate
Marks the circuit and all of its versions as deprecated. Owner only. Deprecated circuits still run, but callers see deprecation notices.
curl -X PUT https://modelworks.ai/api/circuits/73120d53-bf89-44fa-a035-5b88fe41574a/deprecate \
-H "Authorization: Bearer YOUR_API_TOKEN"| Parameter | Type | Description |
|---|---|---|
circuit_uid | string | The circuit's unique ID. |
Star and unstar
Starring is a way to bookmark circuits you find useful. All circuit star endpoints are scoped by the circuit's UID — use the Slug Resolution endpoint to look up a circuit's UID first.
POST /circuits/{circuit_uid}/stars
Star a circuit. Requires an API token.
curl -X POST https://modelworks.ai/api/circuits/73120d53-bf89-44fa-a035-5b88fe41574a/stars \
-H "Authorization: Bearer YOUR_API_TOKEN"DELETE /circuits/{circuit_uid}/stars
Unstar a circuit.
curl -X DELETE https://modelworks.ai/api/circuits/73120d53-bf89-44fa-a035-5b88fe41574a/stars \
-H "Authorization: Bearer YOUR_API_TOKEN"GET /circuits/{circuit_uid}/stars
Check whether you have starred a circuit. Returns a boolean.
curl https://modelworks.ai/api/circuits/73120d53-bf89-44fa-a035-5b88fe41574a/stars \
-H "Authorization: Bearer YOUR_API_TOKEN"GET /users/stars
List the circuits you have starred (up to 50).
curl https://modelworks.ai/api/users/stars \
-H "Authorization: Bearer YOUR_API_TOKEN"Check access
GET /circuits/{circuit_uid}/ping
Returns a boolean indicating whether you can read the circuit. No auth required. This is a cheap way to check access before attempting a heavier query call.
curl https://modelworks.ai/api/circuits/73120d53-bf89-44fa-a035-5b88fe41574a/pingEmbeds
GET /circuits/{circuit_uid}/embeds
List the circuits that embed this one. Paginated, max 200 results.
curl "https://modelworks.ai/api/circuits/73120d53-bf89-44fa-a035-5b88fe41574a/embeds?limit=20&page=1" \
-H "Authorization: Bearer YOUR_API_TOKEN"Explain
GET /circuits/{circuit_uid}/explain
Returns the circuit's explain detail — a human-readable breakdown of what the circuit does. Visibility is gated by the circuit's visibility settings and your access.
curl https://modelworks.ai/api/circuits/73120d53-bf89-44fa-a035-5b88fe41574a/explain \
-H "Authorization: Bearer YOUR_API_TOKEN"