Skip to content
StatusSupportDashboard

Add data

client.data.add(stringnamespace, DataAddParams { data } body, RequestOptionsoptions?): DataAddResponse { requestId, status }
post/v1/data/{namespace}

Add data to a namespace. This method returns immediately; data is processed asynchronously.

ParametersExpand Collapse
namespace: string

The namespace to ingest data into

body: DataAddParams { data }
data: DataObject { id } | Array<DataObjectArray>

A data object to ingest. Must have an id field. All other fields are flexible and can any JSON types.

Accepts one of the following:
DataObject { id }

A data object to ingest. Must have an id field. All other fields are flexible and can any JSON types.

id: string

Unique identifier for this data object. This should be a meaningful identifier in the customer's system, as it is the main way to search for specific items between systems.

Array<DataObjectArray>
id: string

Unique identifier for this data object. This should be a meaningful identifier in the customer's system, as it is the main way to search for specific items between systems.

ReturnsExpand Collapse
DataAddResponse { requestId, status }

Response confirming data was accepted for asynchronous processing. The requestId can be used for debugging and tracking.

requestId: string

Unique identifier for tracking this request. Data processing happens asynchronously after this response.

status: "accepted"

Request was accepted for processing

Add data
import Safetykit from 'safetykit';

const client = new Safetykit({
  apiKey: process.env['SAFETYKIT_API_KEY'], // This is the default and can be omitted
});

const response = await client.data.add('namespace', {
  data: {
    id: 'user-12345',
    display_name: 'Jane Smith',
    headline: 'Product Designer at TechCorp',
    bio: 'Passionate about creating intuitive user experiences. 10+ years in UX/UI design.',
    location: 'San Francisco, CA',
    profile_image: 'https://cdn.example.com/users/12345/avatar.jpg',
    cover_photo: 'https://cdn.example.com/users/12345/cover.jpg',
    website: 'https://janesmith.design',
    follower_count: 15420,
    is_verified: true,
    tags: ['designer', 'ux', 'product'],
  },
});

console.log(response.requestId);
{
  "requestId": "req_01h2m7qdmdjckc30e1mnq6xqfd",
  "status": "accepted"
}
Returns Examples
{
  "requestId": "req_01h2m7qdmdjckc30e1mnq6xqfd",
  "status": "accepted"
}