Files
homarr/apps/docs/docs/widgets/custom-api/index.mdx
T

62 lines
2.5 KiB
Plaintext

---
title: "Custom API"
description: "The Custom API widget shows a Custom JSX v2 definition with server-side API requests, widget options, and actions."
hide_title: true
---
import { WidgetHeader } from "@site/src/components/widgets/header";
import { AddingWidget } from "@site/src/components/widgets/adding";
import { customApiWidget } from ".";
<WidgetHeader widget={customApiWidget} categories={["Custom", "API"]} />
The Custom API widget shows a Custom JSX v2 definition. Create the definition in [Management → Custom Widgets](/docs/management/custom-widgets).
A definition contains API sources, named requests, a widget options schema, and one safe JSX template.
Temporary inputs exist only while the tile is mounted. Homarr encrypts source credentials separately.
Homarr does not send these credentials to the browser. Homarr does not include them in an export.
### Add the widget
<AddingWidget />
Select a definition from the searchable picker. Configure its generated widget options.
Select a refresh interval. The board item stores the definition ID and the validated widget option values.
Credentials remain on the server.
:::note
Enable the definition before you use it. The definition must also be available to the board.
:::
### Permissions and actions
Each named request declares its minimum board permission. This permission does not depend on the HTTP method.
Anonymous visitors can load queries from a Custom API widget on a public board. Definitions placed only on private
boards remain unavailable to them.
Queries and actions can use GET, POST, PUT, or PATCH. DELETE is valid only for actions so it can never run
automatically while a board loads. The `kind` value controls the remaining runtime behavior.
A DELETE request requires full board permission and confirmation. An anonymous viewer cannot run an action.
Homarr disables interactive controls in board edit mode. An action runs only after a user action.
Mounting, refresh polling, and automatic retries do not run actions. An authoring preview simulates actions by default.
An administrator can enable live actions for the short preview session.
### Refresh behavior
The refresh interval runs load queries again. `SubFetch` runs manual queries.
Each query can declare a cache duration. A successful action can invalidate only its declared queries.
Read [Custom Widgets management](/docs/management/custom-widgets) for authoring, widget options, named requests, Mantine, network scopes, and security limits.