Skip to main content

UI Theme Settings API

This page documents the 4 gateway endpoints tagged UI Theme Settings in the gateway's OpenAPI document. Every example targets a gateway on http://localhost:4000 and authenticates with the SPANWAY_API_KEY environment variable, which holds the master key or a virtual key that has access to the route. Request and response fields are taken from the schema the running gateway publishes at /openapi.json, and the same document is bundled with this site as openapi.json.

MethodPathSummary
GET/get/ui_theme_settingsRead the Admin UI logo and favicon
PATCH/update/ui_theme_settingsChange the Admin UI logo and favicon
POST/upload/logoUpload a logo image for the Admin UI
GET/get/ui_logo/{filename}Download an uploaded Admin UI logo

Endpoints​

GET /get/ui_theme_settings​

Read the Admin UI logo and favicon

Shows the logo and favicon the Admin UI uses: the stored branding, or the UI_LOGO_PATH, UI_LOGO_PATH_DARK and SPANWAY_FAVICON_URL values when nothing is stored. Anyone may call it without a key, because the sign in page shows the logo before anyone signs in. It changes nothing.

Docs (https://docs.spanway.ai/docs/admin_ui/ui_theme)

Example request:

curl -X GET "http://localhost:4000/get/ui_theme_settings"

Responses:

StatusDescriptionBody
200The stored branding, or the UI_LOGO_PATH, UI_LOGO_PATH_DARK and SPANWAY_FAVICON_URL valuesapplication/json UIThemeSettingsResponse

Response fields (200):

FieldTypeRequiredDescription
valuesobjectYesValues
field_schemaobjectYesField Schema

PATCH /update/ui_theme_settings​

Change the Admin UI logo and favicon

Changes the logo shown at the top of the Admin UI sidebar, its dark mode variant and the browser favicon, for every user. Each value must be a public http or https URL, or the path an upload through /upload/logo returned. The branding is saved to the database config, applied at once and written to the audit log. Only proxy admins may call it, and it needs store_model_in_db.

Docs (https://docs.spanway.ai/docs/admin_ui/ui_theme)

Request body (application/json, schema UIThemeConfig):

FieldTypeRequiredDescription
logo_urlstring or nullNoURL or path to custom logo image. Can be a local file path or HTTP/HTTPS URL
logo_url_darkstring or nullNoURL or path to a custom logo image for dark mode. Can be a local file path or HTTP/HTTPS URL. Leave unset to reuse logo_url in dark mode
favicon_urlstring or nullNoURL to custom favicon image. Must be an HTTP/HTTPS URL to a .ico, .png, or .svg file

Example request:

curl -X PATCH "http://localhost:4000/update/ui_theme_settings" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"logo_url": "https://cdn.example.com/brand/logo.svg",
"logo_url_dark": "https://cdn.example.com/brand/logo-dark.svg",
"favicon_url": "https://cdn.example.com/brand/favicon.ico"
}'

Responses:

StatusDescriptionBody
200The branding is stored and applied to the running gatewayapplication/json UIThemeUpdateResponse
400A URL is not a public http or https URL with a hostapplication/json ErrorDetail
401No valid key was sent, or the key belongs to someone who is not a proxy adminapplication/json ProxyError
403The key passed the route check through allowed_routes or a custom role but is not a proxy admin keyapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500store_model_in_db is off, so settings cannot be saved. Set store_model_in_db: true in general_settingsapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
messagestringYesWhat changed
statusstringYesAlways success, failures are reported as HTTP errors
theme_configobjectYesThe logo and favicon URLs as stored

Upload a logo image for the Admin UI

Uploads a logo image (PNG, JPG, JPEG or SVG, at most 5 MB) as the file form field. The image is stored in the gateway database, so every instance serves it and it survives restarts. The answer carries the url path the gateway serves it from, which you then save as logo_url or logo_url_dark through /update/ui_theme_settings. Every upload writes an audit row with the file name, media type and size. Only proxy admins may call it.

Docs (https://docs.spanway.ai/docs/admin_ui/ui_theme)

Request body (multipart/form-data, object):

FieldTypeRequiredDescription
filestringYesA .png, .jpg, .jpeg or .svg image

Example request:

curl -X POST "http://localhost:4000/upload/logo" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-F file="@file.bin"

Responses:

StatusDescriptionBody
200The image is stored in the gateway database and can be referenced from the theme settingsapplication/json LogoUploadResponse
400The file is not a .png, .jpg, .jpeg or .svg image, or it is larger than 5 MBapplication/json ErrorDetail
401No valid key was sent, or the key belongs to someone who is not a proxy adminapplication/json ProxyError
403The key passed the route check through allowed_routes or a custom role but is not a proxy admin keyapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
503The gateway has no database to store the logo in, or the write failedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
messagestringYesWhat changed
statusstringYesAlways success, failures are reported as HTTP errors
filenamestringYesName the gateway stored the image under
file_sizeintegerYesSize of the stored image in bytes
urlstringYesPath the gateway serves the image from, usable as logo_url or logo_url_dark

GET /get/ui_logo/{filename}​

Download an uploaded Admin UI logo

Serves a logo image stored through /upload/logo. Anyone may call it without a key, because the browser loads the logo before anyone signs in. Only names the upload route generated are served, so nothing else in the database is reachable.

Docs (https://docs.spanway.ai/docs/admin_ui/ui_theme)

Parameters:

NameInTypeRequiredDescription
filenamepathstringYes

Example request:

curl -X GET "http://localhost:4000/get/ui_logo/filename-123"

Responses:

StatusDescriptionBody
200The image bytes, with its image media typeimage/png string
404No uploaded logo has that nameapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError