# Create a component datasource

Creates a new datasource item for a specific component using the provided data field values. The datasource will be created in the appropriate location based on the component's configuration.

Endpoint: POST /api/v1/components/{componentId}/datasources
Version: v2.0
Security: HTTPBearer

## Security:

  - `HTTPBearer` (unknown)
    http bearer JWT

## Path parameters:

  - `componentId` (string, required)
    The unique identifier of the component for which to create a datasource. To get this ID, use the [List allowed components for a placeholder](#operation/pages-get_allowed_components_by_placeholder) endpoint.

## 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.

## Request fields (application/json):

  - `siteName` (string, required)
    The name of the site for which the datasource is created.
    Example: skate-park

  - `dataFields` (object, required)
    A key-value map of data field names and their values for the datasource.
    Example: {"PromoText":"Summer Sale"}

  - `children` (any)
    A list of child datasource objects, or null if none.

  - `language` (string)
    The language code for the datasource.
    Example: en

## Response 201:

  - `201` (unknown)
    Successful response

## Response 201 fields (application/json):

  - `datasourceId` (string)
    The unique identifier of the created datasource.
    Example: 9f8c7e6d-5b4a-4c3d-8e7f-1a2b3c4d5e6f

  - `datasourceLocation` (string)
    The location path of the created datasource.
    Example: /sitecore/content/Verticals/SkatePark/Data/Promos

## 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.

