> ## Documentation Index
> Fetch the complete documentation index at: https://docs.baseplate.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Upsert Data Rows

> Upserts the rows. Creates a document if no document_id is provided in the request. If one is provided, and it already exists, the data rows will be replaced.

### Path Parameters

<ParamField path="id" type="string" required>
  Dataset ID
</ParamField>

### Header

<ParamField header="Authorization" type="string" required>
  Baseplate API key. Must be in the format "Bearer \$BASEPLATE\_API\_KEY"
</ParamField>

### Body

<ParamField body="rows" type="array" required>
  Rows to upsert. See <Link href="/api-reference/documents/overview">Overview</Link> for example.
</ParamField>

<ParamField body="document_id" type="string">
  The document ID to upsert. If not provided, a document ID will be created for
  you.
</ParamField>
