Every API here is available over the APIs.io API and to AI agents over MCP.
openapi: 3.2.0
info:
title: VoltPlan Admin Catalog Tools API
version: 0.3.0
description: 'VoltPlan''s HTTP API. The wiring-diagram MCP server (Model Context Protocol over Streamable HTTP, tag `MCP`, at `/.well-known/mcp`) generates 12V/24V/48V wiring diagrams and performs wire gauge, fuse, battery bank, inverter, solar, and charging-time calculations; it needs no API key or account. The REST endpoints under `/api` serve the VoltPlan web app. Authentication: public endpoints need no credentials; user endpoints expect a PocketBase `users` auth token as `Authorization: Bearer ` (`userBearer`); admin endpoints additionally require `is_admin=true` and answer 403 otherwise (`adminBearer`); the IndexNow trigger uses a shared secret (`indexNowBearer`). Each operation''s `security` field names its requirement.'
contact:
name: VoltPlan
url: https://voltplan.app/developers
email: support@voltplan.app
license:
name: MIT
url: https://github.com/YUZU-Hub/wiring-diagram-mcp/blob/main/LICENSE
servers:
- url: https://voltplan.app
tags:
- name: admin-catalog-tools
description: 'Admin-only catalog tooling behind /admin: review and delete user-submitted custom components, extract component data from product pages with an LLM, save extracted components to the catalog, and look up amazon.de product links. All operations require an admin PocketBase token (adminBearer) and answer 403 otherwise.'
paths:
/api/admin/custom-components:
get:
operationId: listAdminCustomComponents
tags:
- admin-catalog-tools
summary: List all user-submitted custom components
description: 'Returns every `custom_components` record, fetched with the PocketBase superuser client (`getFullList`, batch size 500), newest first (`sort: -created`). There is no pagination; `totalItems` equals `items.length`.'
security:
- adminBearer: []
responses:
'200':
description: All custom components.
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCatalogCustomComponentList'
'403':
$ref: '#/components/responses/AdminForbidden'
'500':
$ref: '#/components/responses/AdminCatalogCustomComponentsFetchFailed'
/api/admin/custom-components/delete:
post:
operationId: deleteAdminCustomComponent
tags:
- admin-catalog-tools
summary: Delete a user-submitted custom component
description: Deletes the `custom_components` record with the given id using the PocketBase superuser client. An unknown id is reported as 500 (the PocketBase 404 is not mapped).
security:
- adminBearer: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCatalogDeleteCustomComponentRequest'
responses:
'200':
description: Record deleted.
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCatalogDeleteCustomComponentResponse'
'400':
$ref: '#/components/responses/AdminCatalogCustomComponentIdRequired'
'403':
$ref: '#/components/responses/AdminForbidden'
'500':
$ref: '#/components/responses/AdminCatalogCustomComponentDeleteFailed'
/api/admin/extract-component:
post:
operationId: extractAdminComponent
tags:
- admin-catalog-tools
summary: Extract component data from a product page with an LLM
description: 'Turns a product page into a component draft. Nothing is persisted — save the result with `POST /api/admin/save-component`. Depends on external AI and fetch services, so a request can take tens of seconds; any upstream failure ends in 500.
1. Input precedence: `productInfo.url` > `url` > `searchTerm`. A `searchTerm` without `url` first calls `POST /api/admin/search-amazon` on `NEXT_PUBLIC_BASE_URL`, forwarding the caller''s `Authorization` header; if no product is found, extraction continues from the search term alone.
2. The page is fetched as markdown through Jina Reader (`https://r.jina.ai/`, optional `JINA_API_KEY`, 30 s timeout) and cached in-process for 1 h (at most 50 entries).
3. Blocked or captcha Amazon pages fall back to a SearxNG search (`search.yuzuhub.com`) for the ASIN.
4. Existing brand names are read from the PocketBase `component_brands` collection.
5. The Anthropic Messages API extracts the specification (`ANTHROPIC_API_KEY` required; model `EXTRACT_MODEL`, default `claude-haiku-4-5-20251001`; up to 5 turns in which the model may call a `searxng_search` tool).
6. A second `search-amazon` call supplies one amazon.de affiliate link; without a hit the link is an amazon.de search-results URL carrying the affiliate tag.
7. http(s) icon URLs go through self-hosted background removal (BRIA RMBG-1.4 via `@huggingface/transformers`); on failure the original URL is kept.'
security:
- adminBearer: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCatalogExtractComponentRequest'
responses:
'200':
description: Extracted component draft.
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCatalogExtractedComponent'
'400':
$ref: '#/components/responses/AdminCatalogExtractBadRequest'
'403':
$ref: '#/components/responses/AdminForbidden'
'500':
$ref: '#/components/responses/AdminCatalogExtractFailed'
/api/admin/save-component:
post:
operationId: saveAdminComponent
tags:
- admin-catalog-tools
summary: Save an extracted component to the catalog
description: 'Creates a `components` record (always `preferred_suggestion: false`; null and empty fields are dropped). `brand` is a brand name that is matched or created in `component_brands`. An `icon` data URI is uploaded as a `.png` file; any other `icon` string is stored as-is. Each `affiliate_links` entry becomes an `affiliate_links` record. Brand and per-link failures do not fail the request; they are reported in `warnings`. The route performs no input validation of its own, so invalid input surfaces as 500.'
security:
- adminBearer: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCatalogSaveComponentRequest'
responses:
'200':
description: Component created.
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCatalogSaveComponentResponse'
'403':
$ref: '#/components/responses/AdminForbidden'
'500':
$ref: '#/components/responses/AdminCatalogSaveFailed'
/api/admin/search-amazon:
post:
operationId: searchAdminAmazon
tags:
- admin-catalog-tools
summary: Find an amazon.de product link for a component
description: 'Exact matches (`isExactMatch: true`, one link):
- `originalUrl` on amazon.de containing an ASIN (trusted without a request);
- `originalUrl` on another Amazon marketplace whose ASIN `HEAD https://www.amazon.de/dp/` confirms;
- `searchTerms` that is a bare 10-character ASIN.
Otherwise a full-text search: SearxNG (`search.yuzuhub.com`, engines brave, google, duckduckgo, bing), then Jina Reader on amazon.de''s own search page (20 s timeout, optional `JINA_API_KEY`). Returns up to 5 candidates with `isExactMatch: false`. Upstream failures never produce an error; they yield `links: []` and `link: null`.'
security:
- adminBearer: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCatalogAmazonSearchRequest'
responses:
'200':
description: Search result (possibly empty).
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCatalogAmazonSearchResponse'
'400':
$ref: '#/components/responses/AdminCatalogAmazonSearchBadRequest'
'403':
$ref: '#/components/responses/AdminForbidden'
'500':
$ref: '#/components/responses/AdminCatalogAmazonSearchFailed'
components:
schemas:
AdminCatalogAmazonSearchResponse:
type: object
additionalProperties: false
required:
- links
- link
- isExactMatch
properties:
searchTerms:
type:
- string
- 'null'
description: Echo of the request value; omitted when not sent.
links:
type: array
maxItems: 5
items:
$ref: '#/components/schemas/AdminCatalogAmazonSearchResult'
link:
oneOf:
- $ref: '#/components/schemas/AdminCatalogAmazonSearchResult'
- type: 'null'
description: First entry of `links`, or null.
isExactMatch:
type: boolean
AdminCatalogExtractedAffiliateLink:
type: object
additionalProperties: false
required:
- url
- country
- isExact
- title
properties:
url:
type: string
description: amazon.de product URL with the affiliate `tag`, or an amazon.de search-results URL as fallback.
country:
const: universal
isExact:
type: boolean
title:
type: string
description: '`Search results page` for the fallback link.'
AdminCatalogExtractProductInfo:
type: object
description: A candidate picked from `search-amazon` results. Only `url` is read; the other fields are accepted and ignored.
properties:
url:
type: string
description: Page to crawl.
name:
type: string
description:
type: string
title:
type: string
AdminCatalogSaveComponentRequest:
type: object
description: Mirrors `ComponentData` in `src/app/api/admin/save-component/route.ts`. Optional fields accept `null` because the extract response is sent verbatim. Unknown keys are ignored.
required:
- name
- type
properties:
name:
type: string
type:
type: string
enum:
- battery
- charger
- inverter
- transformer
- power
- load
- fuse
- shunt
- switch
- disconnect
- tool
voltage_in:
type:
- number
- 'null'
voltage_in_type:
type:
- string
- 'null'
enum:
- ac
- dc
- null
voltage_out:
type:
- number
- 'null'
voltage_out_type:
type:
- string
- 'null'
enum:
- ac
- dc
- null
watt:
type:
- number
- 'null'
estd_price_euro:
type:
- number
- 'null'
description:
type:
- string
- 'null'
image:
type:
- string
- 'null'
icon:
type:
- string
- 'null'
description: A data URI is uploaded as a PNG file; any other string is stored as-is.
duty_cycle:
type:
- number
- 'null'
default_utilization_factor:
type:
- number
- 'null'
usage_hours_per_day:
type:
- number
- 'null'
amperage:
type:
- number
- 'null'
cutoff_voltage:
type:
- number
- 'null'
fuse_type:
type:
- string
- 'null'
wire_gauge:
type:
- string
- 'null'
brand:
type:
- string
- 'null'
description: Brand name, matched or created in `component_brands`.
affiliate_links:
type:
- array
- 'null'
items:
$ref: '#/components/schemas/AdminCatalogSaveAffiliateLink'
AdminCatalogSaveComponentError:
type: object
additionalProperties: false
required:
- success
- error
properties:
success:
const: false
error:
type: string
warnings:
type: array
minItems: 1
items:
type: string
description: Non-fatal problems (brand or affiliate-link creation failed). Omitted when empty.
AdminCatalogDeleteCustomComponentResponse:
type: object
additionalProperties: false
required:
- success
properties:
success:
const: true
AdminCatalogExtractedComponent:
type: object
description: The LLM's JSON output, not validated server-side (fields may be missing, `null`, or additional), enriched by the server with `icon` and `affiliate_links`. Send it, optionally edited, to `save-component`.
required:
- affiliate_links
properties:
name:
type: string
type:
type: string
description: Expected one of battery, charger, inverter, transformer, power, load, fuse, shunt, switch, disconnect, tool; not enforced.
brand:
type:
- string
- 'null'
voltage_in:
type:
- number
- 'null'
voltage_in_type:
type:
- string
- 'null'
description: '`ac` or `dc`.'
voltage_out:
type:
- number
- 'null'
voltage_out_type:
type:
- string
- 'null'
description: '`ac` or `dc`.'
watt:
type:
- number
- 'null'
estd_price_euro:
type:
- number
- 'null'
description:
type:
- string
- 'null'
image:
type:
- string
- 'null'
icon:
type:
- string
- 'null'
description: '`data:image/png;base64,…` after background removal, else an http(s) image URL, else a generic `symbols/*.svg` path for battery, charger, inverter, transformer, power and load; absent or null otherwise.'
duty_cycle:
type:
- number
- 'null'
minimum: 0
maximum: 100
default_utilization_factor:
type:
- number
- 'null'
minimum: 0
maximum: 100
usage_hours_per_day:
type:
- number
- 'null'
minimum: 0
maximum: 24
amperage:
type:
- number
- 'null'
cutoff_voltage:
type:
- number
- 'null'
fuse_type:
type:
- string
- 'null'
wire_gauge:
type:
- string
- 'null'
affiliate_links:
type: array
minItems: 1
maxItems: 1
items:
$ref: '#/components/schemas/AdminCatalogExtractedAffiliateLink'
AdminCatalogExtractComponentRequest:
type: object
description: 'At least one of `url`, `searchTerm`, `productInfo` must be set (otherwise 400). Precedence: `productInfo.url` > `url` > `searchTerm`.'
properties:
url:
type: string
description: Product page to crawl.
searchTerm:
type: string
description: 'Used only without `url`: resolved to a product page via `search-amazon`.'
productInfo:
$ref: '#/components/schemas/AdminCatalogExtractProductInfo'
ErrorResponse:
type: object
description: Error body returned by VoltPlan REST endpoints.
required:
- error
properties:
error:
type: string
description: Human-readable error message.
details:
type: string
description: Optional extra context about the failure.
AdminCatalogAmazonSearchResult:
type: object
additionalProperties: false
required:
- url
- country
- title
- isExact
- name
- image
properties:
url:
type: string
description: '`https://www.amazon.de/dp/<ASIN>`.'
country:
const: de
title:
type: string
isExact:
type: boolean
name:
type: string
image:
type:
- string
- 'null'
AdminCatalogAmazonSearchRequest:
type: object
description: At least one of `searchTerms` and `originalUrl` must be non-empty (otherwise 400).
properties:
searchTerms:
type:
- string
- 'null'
description: Free-text query or a bare ASIN.
originalUrl:
type:
- string
- 'null'
description: Product URL on any Amazon marketplace.
AdminCatalogSaveComponentResponse:
type: object
additionalProperties: false
required:
- success
- componentId
- message
properties:
success:
const: true
componentId:
type: string
description: Id of the new `components` record.
message:
const: Component saved successfully
warnings:
type: array
minItems: 1
items:
type: string
description: Non-fatal problems (brand or affiliate-link creation failed). Omitted when empty.
AdminCatalogDeleteCustomComponentRequest:
type: object
required:
- id
properties:
id:
type: string
minLength: 1
description: Id of the `custom_components` record.
AdminCatalogSaveAffiliateLink:
type: object
description: Other keys (e.g. `isExact`, `title`) are ignored.
required:
- url
- country
properties:
url:
type: string
country:
type: string
AdminCatalogCustomComponent:
type: object
description: A `custom_components` record as returned by PocketBase (mirrors `CustomComponent` in `src/lib/types.ts`). Unset text fields are `""`, numbers `0`, booleans `false`.
required:
- id
- collectionId
- collectionName
- name
- created
- updated
properties:
id:
type: string
collectionId:
type: string
collectionName:
const: custom_components
name:
type: string
wattage:
type: number
type:
type: string
description: '`load`, `battery`, `power`, `charger`, `inverter` or `transformer`; `""` when unset.'
voltage_in:
type: number
voltage_out:
type: number
voltage_in_type:
type: string
description: '`dc`, `ac`, or `""` when unset.'
voltage_out_type:
type: string
description: '`dc`, `ac`, or `""` when unset.'
description:
type: string
product_url:
type: string
user_email:
type: string
approved:
type: boolean
approved_at:
type: string
description: Approval time; `""` when unset. PocketBase datetime `YYYY-MM-DD HH:MM:SS.sssZ` (space, not `T`).
created:
type: string
description: Creation time. PocketBase datetime `YYYY-MM-DD HH:MM:SS.sssZ` (space, not `T`).
updated:
type: string
description: Last update time. PocketBase datetime `YYYY-MM-DD HH:MM:SS.sssZ` (space, not `T`).
AdminCatalogCustomComponentList:
type: object
additionalProperties: false
required:
- items
- totalItems
properties:
items:
type: array
items:
$ref: '#/components/schemas/AdminCatalogCustomComponent'
totalItems:
type: integer
minimum: 0
description: Equals `items.length`.
responses:
AdminCatalogExtractBadRequest:
description: None of `url`, `searchTerm`, `productInfo` was given, or `productInfo` has no `url` and no `searchTerm` was given.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
missingInput:
value:
error: URL, search term, or product info is required
noUrl:
value:
error: Could not determine URL to crawl
AdminCatalogAmazonSearchFailed:
description: Unexpected error, e.g. a malformed JSON body; `error` carries the message.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Unexpected end of JSON input
AdminCatalogCustomComponentsFetchFailed:
description: The PocketBase query failed or the admin credentials (`POCKETBASE_ADMIN_EMAIL`, `POCKETBASE_ADMIN_PASSWORD`) are not configured.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Failed to fetch custom components
AdminCatalogCustomComponentIdRequired:
description: '`id` is missing or empty.'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Component ID is required
AdminCatalogAmazonSearchBadRequest:
description: Neither `searchTerms` nor `originalUrl` was given.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: searchTerms or originalUrl is required
AdminCatalogCustomComponentDeleteFailed:
description: Malformed JSON body, unknown id, PocketBase error, or admin credentials not configured.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Failed to delete component
AdminForbidden:
description: Admin access required. Returned for a missing, invalid or expired bearer token as well as for a valid token whose user lacks `is_admin=true`; admin endpoints never answer 401.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Admin access required
AdminCatalogSaveFailed:
description: Malformed JSON body, PocketBase rejected the `components` record (e.g. missing `name` or `type`), or admin credentials not configured. `warnings` collected before the failure are included.
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCatalogSaveComponentError'
example:
success: false
error: Failed to create record.
AdminCatalogExtractFailed:
description: 'Extraction failed; `error` carries the thrown message. Besides the examples: `Claude API error: <status> …`, `Claude did not return a final response after <n> turns`, and the parser message for a malformed JSON body.'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
missingKey:
value:
error: ANTHROPIC_API_KEY environment variable is not configured
noContent:
value:
error: No meaningful content extracted from the page and ASIN fallback failed
unparsable:
value:
error: Failed to parse Claude response as JSON
securitySchemes:
userBearer:
type: http
scheme: bearer
bearerFormat: JWT
description: 'PocketBase `users` auth token sent as `Authorization: Bearer <token>`. The server validates it per request with a PocketBase `authRefresh` call.'
adminBearer:
type: http
scheme: bearer
bearerFormat: JWT
description: Same PocketBase `users` auth token as `userBearer`, validated with `authRefresh`; the user record must additionally have `is_admin=true`. Missing, invalid and non-admin tokens all receive 403 (`AdminForbidden`).
indexNowBearer:
type: http
scheme: bearer
description: 'Shared secret configured server-side as `INDEXNOW_SECRET`, sent as `Authorization: Bearer <secret>`. A missing or wrong secret receives 401.'
externalDocs:
description: MCP server source, tool parameter schemas, and changelog
url: https://github.com/YUZU-Hub/wiring-diagram-mcp
x-mcp-tools:
- name: generate_wiring_diagram
description: Generate a complete 12V/24V/48V wiring diagram from a list of components (batteries, loads, chargers, solar panels, inverters). Returns PNG or SVG.
- name: calculate_wire_gauge
description: Calculate the correct wire gauge (AWG and mm²), voltage drop, and fuse size for a DC circuit given voltage, current, and cable length.
- name: calculate_battery_bank
description: Size a battery bank for a given daily energy demand, days of autonomy, and depth of discharge.
- name: calculate_battery_config
description: Work out a series/parallel configuration of individual cells or batteries for a target system voltage and capacity.
- name: calculate_charging_time
description: Estimate battery charging time from a given charger or solar array.
- name: calculate_inverter_size
description: Recommend an inverter size based on AC load profile, surge requirements, and system voltage.
- name: calculate_power_budget
description: Build a 24h power budget from loads to size batteries, solar, and wiring.
- name: calculate_solar_size
description: Size a solar array based on daily energy needs, location / sun hours, and system voltage.
- name: list_component_types
description: List the component types VoltPlan knows about (batteries, chargers, loads, inverters, panels, etc.).
- name: find_components
description: Find products in VoltPlan's small, curated component catalogue that match a spec (category, system voltage, watts, Ah/Wh, pure sine, free text), closest rating first, with product pages and buy links plus an always-available Amazon search fallback.
- name: build_bom
description: 'Build the full shopping list (bill of materials) for a system described like generate_wiring_diagram: components with matching catalogue products, cables per gauge, fuses, fuse holders, terminals, heat-shrink, and tools, with buy links.'