Read the traits a site collects
const url = 'https://your-tenant-host/v1/id/traits';const options = {method: 'GET', headers: {'x-edgekit-site-id': 'site_example'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://your-tenant-host/v1/id/traits \ --header 'x-edgekit-site-id: site_example'Every user-writable, enabled trait this tenant collects, with a list trait’s enabled items and their labels: what a sign-up form and a preferences screen both render. Unauthenticated and edge-cacheable on the same terms as /config: Vary: x-edgekit-site-id, Access-Control-Allow-Origin: *, s-maxage=300, max-age=60. Reads the current trait settings rather than the deployed document, so a new trait appears immediately, not at the next deploy.
Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”The site this request is for, within this tenant. Every official EdgeKit SDK sets it from the client you configured; set it yourself only when calling this API directly.
Example
site_exampleThe site this request is for, within this tenant. Every official EdgeKit SDK sets it from the client you configured; set it yourself only when calling this API directly.
Responses
Section titled “Responses”The traits this tenant collects.
object
object
Open: accept a member not listed. Known: string, integer, number, boolean, list.
object
Example
{ "traits": [ { "name": "job_industry", "type": "string", "label": "Industry", "required": false, "constraints": { "items": [ { "id": "01926f3a-8b51-7e99-9aaa-8b9c0d1e2f3a", "label": "Fashion", "externalId": "IND_FASHION" } ] } } ]}Invalid request.
object
object
Example
{ "error": { "code": "unauthorized", "message": "Invalid or missing API key." }}Resource not found.
object
object
Example
{ "error": { "code": "unauthorized", "message": "Invalid or missing API key." }}Request validation failed.
object
object
Example
{ "error": { "code": "unauthorized", "message": "Invalid or missing API key." }}Unexpected error.
object
object
Example
{ "error": { "code": "unauthorized", "message": "Invalid or missing API key." }}