Skip to content
StatusSupportDashboard

Add data

data.add(strnamespace, DataAddParams**kwargs) -> DataAddResponse
post/v1/data/{namespace}

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

ParametersExpand Collapse
namespace: str

The namespace to ingest data into

data: Optional[Iterable[Data]]
id: str

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.

schema: Optional[Dict[str, Schema]]

Schema mapping field names to their definitions. Use content_type to specify which fields contain URLs that should be processed (images, videos, or websites), datetime fields, or 'metadata' for fields that should be stored but not indexed. Use display_hint to provide UI rendering hints.

content_type: Optional[Literal["image_url", "video_url", "website_url", 2 more]]

The type of content (image_url, video_url, website_url, datetime, or metadata). When specified as a URL type, SafetyKit will process the URL. Use 'metadata' for fields that should be stored but not indexed.

Accepts one of the following:
"image_url"
"video_url"
"website_url"
"datetime"
"metadata"
display_hint: Optional[SchemaDisplayHint]

Display hint for UI rendering of this field

type: Literal["title", "subtitle", "description", 6 more]

The display hint type

Accepts one of the following:
"title"
"subtitle"
"description"
"primary_image_url"
"video_url"
"location"
"email.replyTo"
"email.body"
"email.subject"
namespace_ref: Optional[str]

The namespace which an id refers to, creating a parent-child relationship with that namespace.

ReturnsExpand Collapse
class DataAddResponse:

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

request_id: str

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

status: Literal["accepted"]

Request was accepted for processing

Add data
import os
from safetykit import Safetykit

client = Safetykit(
    api_key=os.environ.get("SAFETYKIT_API_KEY"),  # This is the default and can be omitted
)
response = client.data.add(
    namespace="namespace",
    data=None,
    schema={
        "profile_image": {
            "content_type": "image_url"
        },
        "cover_photo": {
            "content_type": "image_url"
        },
        "website": {
            "content_type": "website_url"
        },
    },
)
print(response.request_id)
{
  "requestId": "req_01h2m7qdmdjckc30e1mnq6xqfd",
  "status": "accepted"
}
Returns Examples
{
  "requestId": "req_01h2m7qdmdjckc30e1mnq6xqfd",
  "status": "accepted"
}