Ler e alterar a configuração
Lê e altera a configuração visual global da loja e consulta as variáveis CSS que ela gera.
Três rotas sobre a configuração global: ler tudo, alterar campos e ver o CSS gerado. Leia antes a visão geral para entender como o estilo ativo do tema se sobrepõe a estas cores. Exigem o privilégio manage_theme.
Ler a configuração
/api/v1/admin/themeAdminLê a configuração visual global da loja
Devolve a configuração tal como está gravada, sem a sobreposição do estilo ativo (essa mescla só acontece na rota pública da vitrine).
Exemplo de requisição
curl "$BASE_URL/api/v1/admin/theme" \
-H "Authorization: Bearer $TOKEN"{
"id": "20299fa2-f761-434f-aa54-811e242f65a3",
"logo_url": "/uploads/dfe2555e-bfd0-41a8-9fa1-9586999f3798/theme/logo/logo.png",
"favicon_url": "",
"store_name": "Loja de Demonstração Venddor",
"primary_color": "#2563eb",
"secondary_color": "#2563eb",
"accent_color": "#f59e0b",
"bg_color": "#ffffff",
"text_color": "#1f2937",
"header_bg_color": "#ffffff",
"footer_bg_color": "#2563eb",
"link_color": "#2563eb",
"link_hover_color": "#1f54c8",
"heading_color": "#1f2937",
"muted_text_color": "#797f87",
"border_color": "#e5e7eb",
"button_text_color": "#ffffff",
"font_family": "Inter, sans-serif",
"heading_font": "Inter, sans-serif",
"border_radius": "8px",
"max_width": "1280px",
"custom_css": "",
"custom_head_html": "",
"font_size_base": "16px",
"font_size_lg": "20px",
"font_size_sm": "14px",
"line_height_base": "1.6",
"heading_weight": "800",
"header_layout": "left",
"footer_columns": 4,
"sidebar_position": "left",
"pwa_enabled": true,
"pwa_short_name": "",
"updated_at": "2026-09-06T05:23:00.918969Z"
}Campos da resposta
iduuidlogo_urlstring/uploads/... ou URL.favicon_urlstringstore_namestringprimary_colorstringsecondary_colorstringaccent_colorstringbg_colorstringtext_colorstringheader_bg_colorstringfooter_bg_colorstringlink_colorstringlink_hover_colorstringheading_colorstringmuted_text_colorstringborder_colorstringbutton_text_colorstringfont_familystringheading_fontstringborder_radiusstring8px).max_widthstring1280px).custom_cssstringcustom_head_htmlstringhead de todas as páginas (por exemplo, tags de analytics).font_size_basestring16px).font_size_lgstringfont_size_smstringline_height_basestring1.6).heading_weightstring700, 800).header_layoutstringleftcenteredfooter_columnsinteger234sidebar_positionstringleftrightnoneextended_configobjectpwa_enabledbooleanpwa_short_namestringupdated_atstringAlterar a configuração
/api/v1/admin/themeAdminAltera campos da configuração visual global
Alteração parcial: só os campos enviados mudam. Use "" para limpar um texto. Valores de cor precisam ser hexadecimais (#rgb, #rrggbb ou #rrggbbaa) ou transparent, inherit, currentColor, ou vazio. header_layout, footer_columns e sidebar_position não são checados pelo servidor: envie só os valores documentados. A resposta é a configuração inteira, como no GET.
Corpo da requisição
logo_urlstring/uploads/..., URL http(s) ou data: de imagem. Outro esquema (javascript:) é recusado.favicon_urlstringstore_namestringprimary_colorstringsecondary_colorstringaccent_colorstringbg_colorstringtext_colorstringheader_bg_colorstringfooter_bg_colorstringlink_colorstringlink_hover_colorstringheading_colorstringmuted_text_colorstringborder_colorstringbutton_text_colorstringfont_familystringheading_fontstringborder_radiusstringmax_widthstringcustom_cssstringcustom_head_htmlstringhead.font_size_basestringfont_size_lgstringfont_size_smstringline_height_basestringheading_weightstringheader_layoutstringleftcenteredfooter_columnsinteger234sidebar_positionstringleftrightnoneextended_configobject{} ou ausente não altera.pwa_enabledbooleanpwa_short_namestringExemplo de requisição
curl -X PUT "$BASE_URL/api/v1/admin/theme" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"store_name":"Loja do João","primary_color":"#dc2626"}'Variáveis CSS geradas
/api/v1/admin/theme/cssAdminMostra as variáveis CSS geradas pela configuração global
Devolve o mapa de variáveis CSS e o bloco :root pronto, calculados apenas da configuração global (e dos tokens do extended_config que têm variável própria), sem o estilo ativo. Serve para pré-visualizar o que esta configuração produz.
{
"variables": {
"--color-primary": "#2563eb",
"--color-accent": "#f59e0b",
"--color-bg": "#ffffff",
"--font-family": "Inter, sans-serif",
"--border-radius": "8px",
"--max-width": "1280px"
},
"css": ":root {\n --color-primary: #2563eb;\n --color-accent: #f59e0b;\n --color-bg: #ffffff;\n --font-family: Inter, sans-serif;\n --border-radius: 8px;\n --max-width: 1280px;\n}"
}Campos da resposta
variablesobject--color-*), fontes (--font-*), --border-radius, --max-width, --line-height-base e --heading-weight (22 variáveis na loja de teste). O exemplo mostra só algumas.cssstring:root { ... } pronto para inserir numa página.Erros
| Status | Quando | Corpo |
|---|---|---|
| 400 | Corpo JSON inválido; cor fora do formato; logo_url ou favicon_url inválido; nenhum campo enviado | {"error":"invalid color","detail":"color must be a valid hex value like #1a2b3c (primary_color=\"red\")"}, {"error":"invalid logo_url","detail":"invalid_image_url: unsupported scheme \"javascript\""} ou {"error":"no fields to update"} |
| 401 | Sem token ou token expirado | {"error":"missing authorization header"} |
| 403 | Sem o privilégio manage_theme | {"error":"insufficient privileges","required":"manage_theme"} |
| 500 | extended_config que não é JSON válido; campo protegido por um patch aplicado; falha interna | {"error":"failed to update theme","detail":"..."} |