---
title: "Upsert rows"
method: POST
path: "/api/v2/reference-tables/tables/{id}/rows"
tags: ["Reference Tables"]
---

# Upsert rows

`POST /api/v2/reference-tables/tables/{id}/rows`

## Request

- Base URL: `https://api.datadoghq.com`
- URL: `https://api.datadoghq.com/api/v2/reference-tables/tables/{id}/rows`
- Auth: one of:
  - API key in header `DD-API-KEY` and API key in header `DD-APPLICATION-KEY`
  - OAuth 2
    - Authorization code: `/oauth2/v1/authorize`
    - Token URL: `/oauth2/v1/token`

Create or update rows in a Reference Table by their primary key values. If a row with the specified primary key exists, it is updated; otherwise, a new row is created.

## Path parameters

- `id` string, required

## Request body

- BatchUpsertRowsRequestArray: The request body for creating or updating multiple rows into a reference table.
  - `data` BatchUpsertRowsRequestData[], required: List of row resources to create or update in the reference table.
    - `attributes` BatchUpsertRowsRequestDataAttributes: Attributes containing row data values for row creation or update operations.
      - `values` object, required: Key-value pairs representing row data, where keys are schema field names and values match the corresponding column types.
    - `id` string, required: The primary key value that uniquely identifies the row to create or update.
    - `type` 'row', required: Row resource type.

## Response `200`

Rows created or updated successfully

## Other responses

- `400`: Bad Request
- `403`: Forbidden
- `404`: Not Found
- `429`: Too many requests
- `500`: Internal Server Error

---

[API](https://skmtc.dev/datadog/apis/datadog-api-v2-collection.md) - [All operations](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/llms.txt) - [OpenAPI document](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/revisions/da68bf029e4c?raw)
