Skip to main content
POST
/
raw
/
dbs
/
{dbName}
/
tables
/
{tableName}
/
rows
JavaScript SDK
await client.raw.insertRows('My company', 'Customers', [{ key: 'customer1', columns: { 'First name': 'Steve', 'Last name': 'Jobs' } }]);
from cognite.client.data_classes import RowWrite
rows = [RowWrite(key="r1", columns={"col1": "val1", "col2": "val1"}),
RowWrite(key="r2", columns={"col1": "val2", "col2": "val2"})]
client.raw.rows.insert("db1", "table1", rows)

rows = {
"key-1": {"col1": 1, "col2": 2},
"key-2": {"col1": 3, "col2": 4, "col3": "high five"},
}
client.raw.rows.insert("db1", "table1", rows)
import pandas as pd
df = pd.DataFrame(
{"col-a": [1, 3, None], "col-b": [2, -1, 9]},
index=["r1", "r2", "r3"])
res = client.raw.rows.insert_dataframe(
"db1", "table1", df, dropna=True)
List<RawRow> createRowsList = List.of(RawRow.newBuilder() 
.setDbName("dbName")
.setTableName("tableName")
.setKey("key")
.setColumns(Struct.newBuilder()
.putFields("string", Values.of("VAL"))
.putFields("numeric", Values.of("VAL"))
.putFields("bool", Values.of(ThreadLocalRandom.current().nextBoolean()))
.putFields("null_value", Values.ofNull())
.putFields("array", Values.of(ListValue.newBuilder()
.addValues(Values.of(ThreadLocalRandom.current().nextDouble(10000d)))
.build()))
.putFields("struct", Values.of(Structs.of("nestedString", Values.of("myTrickyStringValue")
)))
).build());

List<RawRow> createRowsResults = client.raw().rows().upsert(createRowsList, false);
curl --request POST \
--url https://{cluster}.cognitedata.com/api/v1/projects/{project}/raw/dbs/{dbName}/tables/{tableName}/rows \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"key": "<string>",
"columns": {}
}
]
}
'
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://{cluster}.cognitedata.com/api/v1/projects/{project}/raw/dbs/{dbName}/tables/{tableName}/rows",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'items' => [
[
'key' => '<string>',
'columns' => [

]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://{cluster}.cognitedata.com/api/v1/projects/{project}/raw/dbs/{dbName}/tables/{tableName}/rows"

payload := strings.NewReader("{\n \"items\": [\n {\n \"key\": \"<string>\",\n \"columns\": {}\n }\n ]\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://{cluster}.cognitedata.com/api/v1/projects/{project}/raw/dbs/{dbName}/tables/{tableName}/rows")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"items\": [\n {\n \"key\": \"<string>\",\n \"columns\": {}\n }\n ]\n}"

response = http.request(request)
puts response.read_body
{}
{
"code": 400,
"message": "<string>",
"missingFields": [
{}
]
}

Authorizations

Authorization
string
header
required

Access token issued by the CDF project's configured identity provider. Access token must be an OpenID Connect token, and the project must be configured to accept OpenID Connect tokens. Use a header key of 'Authorization' with a value of 'Bearer $accesstoken'. The token can be obtained through any flow supported by the identity provider.

Path Parameters

dbName
string
required

Name of the database.

Required string length: 1 - 32
tableName
string
required

Name of the table.

Required string length: 1 - 64

Query Parameters

ensureParent
boolean
default:false

Create database/table if it doesn't exist already

Body

List of rows to create.

items
object[]

Response

Empty response.

The response is of type object.

Last modified on July 10, 2026