# Retrieve components on a page

Retrieves the components on a page.

Endpoint: GET /api/v1/pages/{pageId}/components
Version: v2.0
Security: HTTPBearer

## Security:

  - `HTTPBearer` (unknown)
    http bearer JWT

## Path parameters:

  - `pageId` (string, required)
    The unique identifier of the page from which to retrieve components. To get this ID, use [List pages of a site](#operation/sites-get_all_pages_by_site).

## Query parameters:

  - `language` (any)
    The language code for filtering components.

  - `version` (any)
    The version number of the page to retrieve components from.

  - `variantId` (any)
    The unique identifier of the  personalization or A/B/n test variant on the page. To get this ID, you can use the [List flow definitions](https://api-docs.sitecore.com/sai/agent-api/flow-definitions/flows-list_flow_definitions_by_page) endpoint. Use the `transpiledVariants[].ref`, or `variants[].ref` when available.
 
If you provide this value, the endpoint returns components of the specified variant. If you omit this value, the endpoint returns components of the base page.

  - `includeRenderingDetails` (boolean)

## Header parameters:

  - `x-sc-job-id` (any)
    A unique identifier for the job, used to trace, audit, and revert actions performed by an AI agent through the Agent API.

## Response 200:

  - `200` (unknown)
    Successful response

## Response 200 fields (application/json):

  - `pageId` (string)
    The unique identifier of the page.
    Example: 3f2504e0-4f89-11d3-9a0c-0305e82c3301

  - `pageName` (string)
    The name of the page.
    Example: Home Page

  - `pagePath` (string)
    The path to the page.
    Example: /sitecore/content/Home

  - `version` (integer)
    The version number of the page.
    Example: 1

  - `language` (string)
    The language code of the page.
    Example: en

  - `route` (any)
    The route of the page, or null if not applicable.
    Example: /home

  - `layoutEditingKind` (any)
    The layout editing kind of the page, or null if not applicable.
    Example: Standard

  - `template` (any)
    The template used for the page, or null if not applicable.
    Example: Page Template

  - `template.id` (string)
    The unique identifier of the template.
    Example: 3f2504e0-4f89-11d3-9a0c-0305e82c3301

  - `template.name` (string)
    The name of the template.
    Example: Article Page

  - `components` (any)
    A list of components on the page, or null if none.

  - `components.id` (string)
    The unique identifier of the component instance.
    Example: d290f1ee-6c54-4b01-90e6-d701748f0851

  - `components.componentId` (string)
    The unique identifier of the component rendering definition.
    Example: 86a03271-dff4-470a-92bd-b68c67de2e25

  - `components.componentName` (string)
    The internal name of the component.
    Example: PartialDesignDynamicPlaceholder

  - `components.dataSource` (any)
    The unique identifier of the datasource item used by the component, or null if not applicable.
    Example: 9f8c7e6d-5b4a-4c3d-8e7f-1a2b3c4d5e6f

  - `components.dataSourceItem` (any)
    The resolved datasource item, including its field values — the content this component displays. Null when the component has no datasource or it could not be resolved.

  - `components.dataSourceItem.itemId` (string)
    The unique identifier of the datasource item. Use this in the [Update a content item](#operation/content-update_content) endpoint to edit the text shown on the page.
    Example: 7dd4de3d-de45-4989-ad71-a811181a7977

  - `components.dataSourceItem.name` (string)
    The name of the datasource item. Use this to distinguish between repeated components on the same page.
    Example: Teaser Item5

  - `components.dataSourceItem.path` (any)
    The full path to the datasource item. Omitted on children — a child's path is its parent's path plus its name.
    Example: /sitecore/content/Home/Solutions/Data/New Teaser Group

  - `components.dataSourceItem.template` (any)
    The name of the template the datasource item uses. Omitted on children.
    Example: Teaser Item

  - `components.dataSourceItem.fields` (object)
    The datasource item's field values — the content actually shown on the page. Fields whose value is empty are omitted; call get_content_item_by_id on this item for the complete field list including empty ones.

  - `components.dataSourceItem.children` (any)
    Child items of the datasource, such as the individual teasers of a Teaser Group or tiles of a Tiles component. Page text often lives here rather than on the datasource itself.

  - `components.placeholder` (any)
    The path of the placeholder where the component is placed, or null if not applicable.
    Example: /main/content

  - `components.parameters` (any)
    Parameters configured for the component.

  - `components.parameters.GridParameters` (any)
    Grid parameters for the component, or null if not applicable.
    Example: col-md-6

  - `components.parameters.FieldNames` (any)
    Field names associated with the component, or null if not applicable.
    Example: Title, Description

  - `components.parameters.Styles` (any)
    The styles for the component, or null if not applicable.
    Example: background-color: red; color: white;

  - `components.parameters.RenderingIdentifier` (any)
    The unique identifier of the rendering, or null if not applicable.
    Example: 86a03271-dff4-470a-92bd-b68c67de2e25

  - `components.parameters.CSSStyles` (any)
    CSS styles for the component, or null if not applicable.
    Example: font-size: 16px; margin: 10px;

  - `components.parameters.DynamicPlaceholderId` (any)
    The identifier for dynamic placeholders, or null if not applicable.
    Example: placeholder-1234

  - `components.deviceId` (any)
    The unique identifier of the device definition for which the component is configured, or null if not device-specific.
    Example: 123e4567-e89b-12d3-a456-426614174000

  - `components.layoutId` (any)
    The unique identifier of the layout definition in which the component is placed, or null if not applicable.
    Example: 321e6547-e89b-12d3-a456-426614174000

  - `components.componentDetails` (any)
    Detailed information about the component item.

  - `components.componentDetails.itemId` (string)
    The unique identifier of the item.
    Example: d290f1ee-6c54-4b01-90e6-d701748f0851

  - `components.componentDetails.name` (string)
    The name of the item.
    Example: Promo

  - `components.componentDetails.displayName` (string)
    The display name of the item.
    Example: Promotional Banner

  - `components.componentDetails.path` (string)
    The path to the item.
    Example: /sitecore/content/Home/Promotions/Banners/Promotional Banner

  - `components.componentDetails.template` (object)

  - `components.componentDetails.template.templateId` (string)
    The unique identifier of the template.
    Example: 9f8c7e6d-5b4a-4c3d-8e7f-1a2b3c4d5e6f

  - `components.componentDetails.template.name` (string)
    The name of the template.
    Example: Promo

  - `components.componentDetails.fields` (object)

  - `components.componentDetails.fields.nodes` (array)
    A list of field nodes associated with the component.

  - `components.componentDetails.fields.nodes.name` (string)
    The name of the field.
    Example: Title

  - `components.componentDetails.fields.nodes.value` (string)
    The value of the field.
    Example: Welcome to Our Site

  - `components.editable` (any)
    Whether the component is editable.
    Example: true

## Response 422:

  - `422` (unknown)
    Unprocessable entity

## Response 422 fields (application/json):

  - `detail` (array)

  - `detail.loc` (array)
    The location of the error in the request.

  - `detail.msg` (string)
    The error message.

  - `detail.type` (string)
    The type of error.

  - `detail.input` (any)
    The input that caused the error.

  - `detail.ctx` (object)
    The context in which the error occurred.

