Plugin API
The Plugin API is the Bearer-authenticated surface shared by MCP, VS Code, Chrome, and Figma.
Authentication
Authorization: Bearer sf_xxxxxxxx
Create and revoke tokens at Dashboard → API tokens.
All routes below are under /api/v1/plugin and require the PluginAuth middleware.
GET /me
Returns the token owner.
curl -s https://svgforge.dev/api/v1/plugin/me \
-H "Authorization: Bearer sf_xxx"
GET /search
Same behavior as public Search Icons.
| Query | Type | Description |
|---|---|---|
q |
string | Keyword |
prefix |
string | Optional pack filter |
limit |
number | Max results |
curl -s "https://svgforge.dev/api/v1/plugin/search?q=bell&prefix=lucide" \
-H "Authorization: Bearer sf_xxx"
GET /collections
Lists Collections for the authenticated user.
curl -s https://svgforge.dev/api/v1/plugin/collections \
-H "Authorization: Bearer sf_xxx"
MCP: get_my_collections.
GET /collections/:id/items
Lists icons in one Collection owned by the authenticated user. Items include icon_key and preview_svg when available.
curl -s https://svgforge.dev/api/v1/plugin/collections/1/items \
-H "Authorization: Bearer sf_xxx"
POST /collections/items
Add an icon to a Collection.
| Body field | Type | Required | Description |
|---|---|---|---|
collection_id |
number | Yes | Target Collection id |
icon_key |
string | Yes | prefix:name |
curl -s -X POST https://svgforge.dev/api/v1/plugin/collections/items \
-H "Authorization: Bearer sf_xxx" \
-H "Content-Type: application/json" \
-d "{\"collection_id\":1,\"icon_key\":\"lucide:home\"}"
MCP write tools that call this stay off unless SVGForge_MCP_ALLOW_WRITE=1.
GET /custom-icons
Lists private uploaded icons. Requires Pro (or team) plan; otherwise 403.
curl -s https://svgforge.dev/api/v1/plugin/custom-icons \
-H "Authorization: Bearer sf_xxx"
MCP: get_custom_icons.
Errors
| Status | Meaning |
|---|---|
401 |
Missing / invalid token |
403 |
Plan insufficient (e.g. custom icons) |
400 |
Validation (e.g. missing collection_id) |
429 |
Rate limited (see Rate Limits & Quota) |
Plugin and MCP calls share the authenticated user's Free/Pro quota (not per-token). Back off using data.retryAfter or the Retry-After header.