This document provides a guide and overview for the InsertDataField RPC, which allows you to register a DataField directly via API. Once registered, the DataField name can be used immediately as a contextual attribute key when calling GetTreatments, with no further setup.
API Definition
InsertDataField requires a Treatment Management API key, passed in the x-api-key header. A key without Treatment Management permissions is rejected with 403 PERMISSION_DENIED.
Entities
UserPropertyParams
DataFieldPb
InsertDataField
API to register a DataField
InsertDataField is idempotent on (project_id, name). Calling it again with the same project and name returns the existing data_field_id without creating a duplicate or returning an error.
Sample cURL Request
Sample Response