# Widgets

Widget data and schema retrieval

## Retrieve widget data

> Returns widget template context data including attributes, name, slug, and template.

```json
{"openapi":"3.1.0","info":{"title":"CMS API - Content Management & Pages","version":"1.0.0"},"tags":[{"name":"Widgets","description":"Widget data and schema retrieval"}],"servers":[{"description":"Default commerce site","url":"https://{commerce_url}","variables":{"commerce_url":{"default":"sandbox.akinon.com","description":"Commerce storefront hostname"}}}],"paths":{"/widgets/{slug}/":{"get":{"tags":["Widgets"],"operationId":"retrieveWidget","summary":"Retrieve widget data","description":"Returns widget template context data including attributes, name, slug, and template.","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"},"description":"Widget slug identifier"}],"responses":{"200":{"description":"Widget data retrieved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WidgetData"}}}},"404":{"description":"Widget not found"}}}}},"components":{"schemas":{"WidgetData":{"type":"object","description":"Widget template context data returned by the widget endpoint. Contains widget name, slug, template path,\nand attributes. The attributes structure depends on the widget type schema. Used for rendering widgets\nin pages and templates.","required":["name","slug","template","attributes"],"properties":{"name":{"type":"string"},"slug":{"type":"string"},"template":{"type":"string"},"attributes":{"type":"object","description":"Widget attributes (structure depends on widget type)","additionalProperties":true}}}}}}
```

## Retrieve widget schema

> Returns the widget type schema for the specified widget slug.

```json
{"openapi":"3.1.0","info":{"title":"CMS API - Content Management & Pages","version":"1.0.0"},"tags":[{"name":"Widgets","description":"Widget data and schema retrieval"}],"servers":[{"description":"Default commerce site","url":"https://{commerce_url}","variables":{"commerce_url":{"default":"sandbox.akinon.com","description":"Commerce storefront hostname"}}}],"paths":{"/widgets/{slug}/schema/":{"get":{"tags":["Widgets"],"operationId":"retrieveWidgetSchema","summary":"Retrieve widget schema","description":"Returns the widget type schema for the specified widget slug.","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"},"description":"Widget slug identifier"}],"responses":{"200":{"description":"Widget schema retrieved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WidgetType"}}}},"404":{"description":"Widget not found or has no widget type"}}}}},"components":{"schemas":{"WidgetType":{"type":"object","description":"Defines a widget type with its JSON schema for validating and configuring widget attributes.\nUsed to retrieve widget type information and understand what attributes a widget supports.\nThe schema defines the structure and validation rules for widget attributes.","required":["pk","name","schema"],"properties":{"pk":{"type":"integer"},"name":{"type":"string"},"schema":{"type":"object","description":"JSON schema defining widget attributes","additionalProperties":true}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://apidocs.akinon.com/commerce-openapis/cms/widgets.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
