Every API here is available over the APIs.io API and to AI agents over MCP.
openapi: 3.2.0
info:
title: VoltPlan Redirects 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: Redirects
description: Tracked outbound redirects to Amazon or merchant pages and affiliate click tracking. No authentication. Lookups (`components`, `affiliate_links`, `bom_products`) use an unauthenticated PocketBase client, so the collections' view rules apply (e.g. inactive `bom_products` rows are invisible); only the click write uses the cached superuser client. Clicks are not recorded in development, for bot user agents, or when PocketBase admin credentials are missing or the superuser login fails.
paths:
/api/go:
get:
operationId: goRedirect
tags:
- Redirects
summary: Redirect a tracked outbound product link
description: 'Resolves an outbound product link and answers 302 to the target, or 307 to the VoltPlan homepage when nothing resolves. Branches by priority: (1) `bom` — curated `bom_products` row: the row''s URL (Amazon ASIN or manufacturer-direct) when its country matches the visitor''s region (`universal` rows count as `de`), else the same slot''s row curated for the visitor''s country, else a localized Amazon search; unknown or inactive rows → 307. (2) `q` — stored affiliate link of `component_id`/`c` for the visitor''s region when one exists, otherwise a localized Amazon search for `q`; never 307. (3) `component_id`, `c` or a known legacy `p` slug (`sterling-pro-combi-s-1600`, `renogy-rover-40a`) — stored affiliate link for the region, otherwise a localized Amazon search for the component name; unknown component → 307. (4) No usable parameter, including an unknown `p` slug → 307. `component_id` takes precedence over `c`, both over `p`. Region comes from the region parameters in their listed precedence, falling back to `de`. The click is recorded in `component_click_events` (with `User-Agent` and `Referer`), except in development or for bot user agents.'
parameters:
- name: bom
in: query
required: false
description: Curated `bom_products` row id; highest-priority branch. Unknown or inactive rows redirect home (307).
schema:
type: string
- name: q
in: query
required: false
description: Free-text product query; used when `bom` is absent or blank. Redirects to the stored affiliate link of `component_id`/`c` when one exists for the region, else to a localized Amazon search for `q`; never 307.
schema:
type: string
- name: component_id
in: query
required: false
description: PocketBase `components` id. Without `q`, an unknown id redirects home (307).
schema:
type: string
- name: c
in: query
required: false
description: Alias of `component_id`, used when `component_id` is absent.
schema:
type: string
- name: p
in: query
required: false
description: Legacy product slug (`sterling-pro-combi-s-1600`, `renogy-rover-40a`), used when neither `component_id` nor `c` is set; unknown slugs redirect home (307).
schema:
type: string
- name: source
in: query
required: false
description: Click source prefix; the recorded source is `<source>_affiliate` or `<source>_amazon_search` in all branches. Without `source` the component branch records `blog_affiliate` or `blog_amazon_search`.
schema:
type: string
- name: component_name
in: query
required: false
description: Name recorded for the click in the `q` branch; defaults to `q`.
schema:
type: string
- name: component_type
in: query
required: false
description: Type recorded for the click in the `q` branch.
schema:
type: string
- name: region
in: query
required: false
description: Marketplace override, highest precedence. Accepts a marketplace code (`de`, `us`, `uk`, `fr`, `es`, `it`, `au`), a country alias (`at`, `ch`, `lu`, `nl`, `se`, `dk`, `no` → `de`; `be` → `fr`; `ca`, `mx` → `us`; `nz` → `au`; `ie`, `gb` → `uk`; `pt` → `es`), a language code (`en` → `us`, `de`, `fr`, `es`, `it`) or a `lang-COUNTRY` tag (country part tried first, then language). Case-insensitive; any other value is ignored and the next region signal applies.
schema:
type: string
- name: country
in: query
required: false
description: Same as `region` for the marketplace; read only when `region` is absent or empty. A two-letter code is also taken as the visitor's country, ahead of the CDN headers and GeoIP.
schema:
type: string
- name: x-voltplan-region
in: header
required: false
description: Region override header, used when no query override applies.
schema:
type: string
- name: x-voltplan-country
in: header
required: false
description: Read only when `x-voltplan-region` is absent or empty. A two-letter code is also the visitor's country when no `country` query parameter sets it.
schema:
type: string
- name: x-vercel-ip-country
in: header
required: false
description: CDN country header; checked after the VoltPlan headers.
schema:
type: string
- name: cf-ipcountry
in: header
required: false
description: CDN country header; checked after `x-vercel-ip-country`.
schema:
type: string
- name: x-country-code
in: header
required: false
description: CDN country header; checked after `cf-ipcountry`.
schema:
type: string
- name: x-forwarded-for
in: header
required: false
description: First address is GeoIP-resolved to a country when no header above yields a region.
schema:
type: string
- name: x-real-ip
in: header
required: false
description: GeoIP-resolved when `x-forwarded-for` is absent.
schema:
type: string
- name: accept-language
in: header
required: false
description: 'Last signal: the first language range that normalizes to a region wins.'
schema:
type: string
responses:
'302':
description: 'Redirect to the resolved target: a stored regional affiliate link (Amazon product page carrying the region''s affiliate tag, or an untagged manufacturer-direct URL from a curated BOM row) or a localized Amazon search on the visitor''s marketplace.'
headers:
Location:
description: Redirect target URL.
schema:
type: string
format: uri
Cache-Control:
description: Always `no-store`.
schema:
type: string
enum:
- no-store
'307':
description: 'Homepage fallback (`NEXT_PUBLIC_BASE_URL`, default `https://voltplan.app/`): unknown or inactive `bom` row, unknown component in the component branch, unknown `p` slug, or no usable parameter. No `Cache-Control` header, no body.'
headers:
Location:
description: VoltPlan homepage URL.
schema:
type: string
format: uri
/{componentId}:
parameters:
- name: componentId
in: path
required: true
description: PocketBase `components` record id (15 alphanumeric characters, case-insensitive). Other values answer 404 without a database lookup.
schema:
type: string
pattern: ^[a-zA-Z0-9]{15}$
get:
operationId: getComponentRedirect
tags:
- Redirects
summary: Redirect a component short link to its affiliate target
description: Looks up the component (plus its `originalId` variant) and redirects to the stored affiliate link for the visitor's region, otherwise to a localized Amazon search for the component on that marketplace. A Renogy partner link is only used when the visitor's country (the `country` override, CDN country headers or GeoIP) is one its shop delivers to, or unknown; otherwise the marketplace's Amazon row or search applies. The visitor's country is recorded as `visitor_country` when known. Region comes from the region parameters in their listed precedence, falling back to `us`. The click is recorded in `component_click_events` with source `_affiliate` or `_amazon_search`, except in development or for bot `User-Agent`s. A malformed or unknown id answers 404.
parameters:
- name: src
in: query
required: false
description: Click attribution prefix stored in the recorded click source; defaults to `voltplan`.
schema:
type: string
- name: region
in: query
required: false
description: Marketplace override, highest precedence. Accepts a marketplace code (`de`, `us`, `uk`, `fr`, `es`, `it`, `au`), a country alias (`at`, `ch`, `lu`, `nl`, `se`, `dk`, `no` → `de`; `be` → `fr`; `ca`, `mx` → `us`; `nz` → `au`; `ie`, `gb` → `uk`; `pt` → `es`), a language code (`en` → `us`, `de`, `fr`, `es`, `it`) or a `lang-COUNTRY` tag (country part tried first, then language). Case-insensitive; any other value is ignored and the next region signal applies.
schema:
type: string
- name: country
in: query
required: false
description: Same as `region` for the marketplace; read only when `region` is absent or empty. A two-letter code is also taken as the visitor's country, ahead of the CDN headers and GeoIP.
schema:
type: string
- name: x-voltplan-region
in: header
required: false
description: Region override header, used when no query override applies.
schema:
type: string
- name: x-voltplan-country
in: header
required: false
description: Read only when `x-voltplan-region` is absent or empty. A two-letter code is also the visitor's country when no `country` query parameter sets it.
schema:
type: string
- name: x-vercel-ip-country
in: header
required: false
description: CDN country header; checked after the VoltPlan headers.
schema:
type: string
- name: cf-ipcountry
in: header
required: false
description: CDN country header; checked after `x-vercel-ip-country`.
schema:
type: string
- name: x-country-code
in: header
required: false
description: CDN country header; checked after `cf-ipcountry`.
schema:
type: string
- name: x-forwarded-for
in: header
required: false
description: First address is GeoIP-resolved to a country when no header above yields a region.
schema:
type: string
- name: x-real-ip
in: header
required: false
description: GeoIP-resolved when `x-forwarded-for` is absent.
schema:
type: string
- name: accept-language
in: header
required: false
description: 'Last signal: the first language range that normalizes to a region wins.'
schema:
type: string
responses:
'302':
description: Redirect to the stored affiliate link for the visitor's region or a localized Amazon search for the component.
headers:
Location:
description: Redirect target URL.
schema:
type: string
format: uri
Cache-Control:
description: Always `no-store`.
schema:
type: string
enum:
- no-store
'404':
$ref: '#/components/responses/RedirectNotFound'
head:
operationId: headComponentRedirect
tags:
- Redirects
summary: Same as GET without a body
description: Runs the GET handler, including click recording; same status codes and headers, no body.
parameters:
- name: src
in: query
required: false
description: Click attribution prefix stored in the recorded click source; defaults to `voltplan`.
schema:
type: string
- name: region
in: query
required: false
description: Marketplace override, highest precedence. Accepts a marketplace code (`de`, `us`, `uk`, `fr`, `es`, `it`, `au`), a country alias (`at`, `ch`, `lu`, `nl`, `se`, `dk`, `no` → `de`; `be` → `fr`; `ca`, `mx` → `us`; `nz` → `au`; `ie`, `gb` → `uk`; `pt` → `es`), a language code (`en` → `us`, `de`, `fr`, `es`, `it`) or a `lang-COUNTRY` tag (country part tried first, then language). Case-insensitive; any other value is ignored and the next region signal applies.
schema:
type: string
- name: country
in: query
required: false
description: Same as `region` for the marketplace; read only when `region` is absent or empty. A two-letter code is also taken as the visitor's country, ahead of the CDN headers and GeoIP.
schema:
type: string
- name: x-voltplan-region
in: header
required: false
description: Region override header, used when no query override applies.
schema:
type: string
- name: x-voltplan-country
in: header
required: false
description: Read only when `x-voltplan-region` is absent or empty. A two-letter code is also the visitor's country when no `country` query parameter sets it.
schema:
type: string
- name: x-vercel-ip-country
in: header
required: false
description: CDN country header; checked after the VoltPlan headers.
schema:
type: string
- name: cf-ipcountry
in: header
required: false
description: CDN country header; checked after `x-vercel-ip-country`.
schema:
type: string
- name: x-country-code
in: header
required: false
description: CDN country header; checked after `cf-ipcountry`.
schema:
type: string
- name: x-forwarded-for
in: header
required: false
description: First address is GeoIP-resolved to a country when no header above yields a region.
schema:
type: string
- name: x-real-ip
in: header
required: false
description: GeoIP-resolved when `x-forwarded-for` is absent.
schema:
type: string
- name: accept-language
in: header
required: false
description: 'Last signal: the first language range that normalizes to a region wins.'
schema:
type: string
responses:
'302':
description: Redirect to the stored affiliate link for the visitor's region or a localized Amazon search for the component.
headers:
Location:
description: Redirect target URL.
schema:
type: string
format: uri
Cache-Control:
description: Always `no-store`.
schema:
type: string
enum:
- no-store
'404':
$ref: '#/components/responses/RedirectNotFound'
/de/{componentId}:
parameters:
- name: componentId
in: path
required: true
description: PocketBase `components` record id (15 alphanumeric characters, case-insensitive). Other values answer 404 without a database lookup.
schema:
type: string
pattern: ^[a-zA-Z0-9]{15}$
get:
operationId: getComponentRedirectDe
tags:
- Redirects
summary: Redirect a component short link to its affiliate target (German locale)
description: Looks up the component (plus its `originalId` variant) and redirects to the stored affiliate link for the visitor's region, otherwise to a localized Amazon search for the component on that marketplace. A Renogy partner link is only used when the visitor's country (the `country` override, CDN country headers or GeoIP) is one its shop delivers to, or unknown; otherwise the marketplace's Amazon row or search applies. The visitor's country is recorded as `visitor_country` when known. Region comes from the region parameters in their listed precedence, falling back to `de`. The click is recorded in `component_click_events` with source `_affiliate` or `_amazon_search`, except in development or for bot `User-Agent`s. A malformed or unknown id answers 404.
parameters:
- name: src
in: query
required: false
description: Click attribution prefix stored in the recorded click source; defaults to `voltplan`.
schema:
type: string
- name: region
in: query
required: false
description: Marketplace override, highest precedence. Accepts a marketplace code (`de`, `us`, `uk`, `fr`, `es`, `it`, `au`), a country alias (`at`, `ch`, `lu`, `nl`, `se`, `dk`, `no` → `de`; `be` → `fr`; `ca`, `mx` → `us`; `nz` → `au`; `ie`, `gb` → `uk`; `pt` → `es`), a language code (`en` → `us`, `de`, `fr`, `es`, `it`) or a `lang-COUNTRY` tag (country part tried first, then language). Case-insensitive; any other value is ignored and the next region signal applies.
schema:
type: string
- name: country
in: query
required: false
description: Same as `region` for the marketplace; read only when `region` is absent or empty. A two-letter code is also taken as the visitor's country, ahead of the CDN headers and GeoIP.
schema:
type: string
- name: x-voltplan-region
in: header
required: false
description: Region override header, used when no query override applies.
schema:
type: string
- name: x-voltplan-country
in: header
required: false
description: Read only when `x-voltplan-region` is absent or empty. A two-letter code is also the visitor's country when no `country` query parameter sets it.
schema:
type: string
- name: x-vercel-ip-country
in: header
required: false
description: CDN country header; checked after the VoltPlan headers.
schema:
type: string
- name: cf-ipcountry
in: header
required: false
description: CDN country header; checked after `x-vercel-ip-country`.
schema:
type: string
- name: x-country-code
in: header
required: false
description: CDN country header; checked after `cf-ipcountry`.
schema:
type: string
- name: x-forwarded-for
in: header
required: false
description: First address is GeoIP-resolved to a country when no header above yields a region.
schema:
type: string
- name: x-real-ip
in: header
required: false
description: GeoIP-resolved when `x-forwarded-for` is absent.
schema:
type: string
- name: accept-language
in: header
required: false
description: 'Last signal: the first language range that normalizes to a region wins.'
schema:
type: string
responses:
'302':
description: Redirect to the stored affiliate link for the visitor's region or a localized Amazon search for the component.
headers:
Location:
description: Redirect target URL.
schema:
type: string
format: uri
Cache-Control:
description: Always `no-store`.
schema:
type: string
enum:
- no-store
'404':
$ref: '#/components/responses/RedirectNotFound'
head:
operationId: headComponentRedirectDe
tags:
- Redirects
summary: Same as GET without a body (German locale)
description: Runs the GET handler, including click recording; same status codes and headers, no body.
parameters:
- name: src
in: query
required: false
description: Click attribution prefix stored in the recorded click source; defaults to `voltplan`.
schema:
type: string
- name: region
in: query
required: false
description: Marketplace override, highest precedence. Accepts a marketplace code (`de`, `us`, `uk`, `fr`, `es`, `it`, `au`), a country alias (`at`, `ch`, `lu`, `nl`, `se`, `dk`, `no` → `de`; `be` → `fr`; `ca`, `mx` → `us`; `nz` → `au`; `ie`, `gb` → `uk`; `pt` → `es`), a language code (`en` → `us`, `de`, `fr`, `es`, `it`) or a `lang-COUNTRY` tag (country part tried first, then language). Case-insensitive; any other value is ignored and the next region signal applies.
schema:
type: string
- name: country
in: query
required: false
description: Same as `region` for the marketplace; read only when `region` is absent or empty. A two-letter code is also taken as the visitor's country, ahead of the CDN headers and GeoIP.
schema:
type: string
- name: x-voltplan-region
in: header
required: false
description: Region override header, used when no query override applies.
schema:
type: string
- name: x-voltplan-country
in: header
required: false
description: Read only when `x-voltplan-region` is absent or empty. A two-letter code is also the visitor's country when no `country` query parameter sets it.
schema:
type: string
- name: x-vercel-ip-country
in: header
required: false
description: CDN country header; checked after the VoltPlan headers.
schema:
type: string
- name: cf-ipcountry
in: header
required: false
description: CDN country header; checked after `x-vercel-ip-country`.
schema:
type: string
- name: x-country-code
in: header
required: false
description: CDN country header; checked after `cf-ipcountry`.
schema:
type: string
- name: x-forwarded-for
in: header
required: false
description: First address is GeoIP-resolved to a country when no header above yields a region.
schema:
type: string
- name: x-real-ip
in: header
required: false
description: GeoIP-resolved when `x-forwarded-for` is absent.
schema:
type: string
- name: accept-language
in: header
required: false
description: 'Last signal: the first language range that normalizes to a region wins.'
schema:
type: string
responses:
'302':
description: Redirect to the stored affiliate link for the visitor's region or a localized Amazon search for the component.
headers:
Location:
description: Redirect target URL.
schema:
type: string
format: uri
Cache-Control:
description: Always `no-store`.
schema:
type: string
enum:
- no-store
'404':
$ref: '#/components/responses/RedirectNotFound'
/search:
get:
operationId: searchRedirect
tags:
- Redirects
summary: Redirect a free-text query to an amazon.de search
description: Redirects to the amazon.de search results for `q`, carrying the DE affiliate tag; there is no region detection. The click is recorded in `component_click_events` with source `_amazon_search`, except for bot user agents. A missing or blank `q` answers 404.
parameters:
- name: q
in: query
required: true
description: Search query, trimmed. Missing or blank answers 404.
schema:
type: string
- name: src
in: query
required: false
description: Click attribution prefix stored in the recorded click source; defaults to `voltplan`.
schema:
type: string
responses:
'302':
description: Redirect to the amazon.de search results for `q`.
headers:
Location:
description: Redirect target URL.
schema:
type: string
format: uri
Cache-Control:
description: Always `no-store`.
schema:
type: string
enum:
- no-store
'404':
$ref: '#/components/responses/RedirectNotFound'
/api/affiliate-click:
post:
operationId: recordAffiliateClick
tags:
- Redirects
summary: Record a client-side affiliate link click
description: 'Writes one `component_click_events` row (`resolved_country: universal`; `User-Agent` and `Referer` truncated to 255 characters) with the cached superuser client. Development short-circuit: with `NODE_ENV=development` the handler answers `{ ok: true }` before reading the body, so nothing is validated or recorded. Bot user agents, a `component_id` that is not a PocketBase id (exactly 15 characters `a-z0-9`), missing PocketBase admin credentials, a failed admin login, a malformed JSON body and any server error also answer 200 `{ ok: true }` without recording.'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AffiliateClickRequest'
responses:
'200':
description: Accepted (also returned whenever recording is skipped or fails).
content:
application/json:
schema:
$ref: '#/components/schemas/AffiliateClickResponse'
example:
ok: true
'400':
description: '`component_id` missing or empty (not checked in development).'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Missing component_id
components:
schemas:
AffiliateClickResponse:
type: object
description: Acknowledgement of POST /api/affiliate-click.
required:
- ok
properties:
ok:
type: boolean
const: true
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.
AffiliateClickRequest:
type: object
description: Click tracked by POST /api/affiliate-click.
required:
- component_id
properties:
component_id:
type: string
minLength: 1
description: Clicked PocketBase `components` id; missing or empty → 400. Any value other than 15 characters `a-z0-9` is acknowledged (200) without recording.
component_name:
type: string
description: Stored as given; defaults to empty.
component_type:
type: string
description: Stored as given; defaults to empty.
link_type:
type: string
description: '`search` records source `amazon_search`, any other value or absence `affiliate`; ignored when `source` is set.'
target_url:
type: string
description: Destination URL; defaults to empty.
source:
type: string
description: Explicit click source; overrides the `link_type` mapping.
responses:
RedirectNotFound:
description: 'Agent-friendly 404 (buildNotFoundResponse): `text/markdown` when `Accept` lists `text/markdown` explicitly with a quality at least as high as `text/html` (wildcards never count), otherwise `text/html`. HEAD gets the same status and headers without a body.'
headers:
Vary:
description: Contains `Accept`; Next.js prepends its own router values (`RSC`, `Next-Router-State-Tree`, ...).
schema:
type: string
Cache-Control:
description: Always `no-store`.
schema:
type: string
enum:
- no-store
content:
text/html:
schema:
type: string
text/markdown:
schema:
type: string
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.
# --- truncated at 32 KB (32 KB total) ---
# Full source: https://artifacts.apis.io/voltplan-app/openapi/voltplan-app-redirects-api-openapi.yml