GET/ all-attributes/ :model/
Get all attributes
You can get a list of all attribute names and their types for each model: the standard fields and your custom attributes.
| Attributes | Type | Required | Description |
|---|---|---|---|
| model | string | yes | Specific model with its own list of attributes.
|
Request
- cURL
- JavaScript
- PHP
- Python
curl -X GET "https://<your_app_subdomain>.user.com/api/public/all-attributes/:model/" \
-H "Authorization: Token <your_64_char_api_key>" \
-H "Accept: */*; version=2"
const response = await fetch(
"https://<your_app_subdomain>.user.com/api/public/all-attributes/:model/",
{
method: "GET",
headers: {
Authorization: "Token <your_64_char_api_key>",
Accept: "*/*; version=2",
},
},
);
const data = await response.json();
console.log(data);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://<your_app_subdomain>.user.com/api/public/all-attributes/:model/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Token <your_64_char_api_key>",
"Accept: */*; version=2",
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
response = requests.get(
"https://<your_app_subdomain>.user.com/api/public/all-attributes/:model/",
headers={
"Authorization": "Token <your_64_char_api_key>",
"Accept": "*/*; version=2",
},
)
print(response.json())
Response examples
- 200 OK
- 404 Not Found
[{"name": "key","type": "string"},{"name": "user_id","type": "string"},{"name": "assigned_to","type": "integer"},{"name": "last_contacted","type": "datetime"},{"name": "last_heard_from","type": "datetime"},{"name": "email","type": "string"},{"name": "gender","type": "fixed","choices": [,1 field,1 field1 field],"allow_multiple_choices": false},{"name": "status","type": "fixed","choices": [,1 field1 field],"allow_multiple_choices": false},{"name": "first_name","type": "string"},{"name": "last_name","type": "string"},{"name": "phone_number","type": "string"},{"name": "first_seen","type": "datetime"},{"name": "last_seen","type": "datetime"},{"name": "page_views","type": "integer"},{"name": "last_ip","type": "string"},{"name": "hostname","type": "string"},{"name": "referrer","type": "string"},{"name": "country","type": "string"},{"name": "region","type": "string"},{"name": "city","type": "string"},{"name": "geofencing_location","type": "json"},{"name": "unsubscribed_from_sms","type": "boolean"},{"name": "device","type": "fixed","choices": [,1 field,1 field1 field],"allow_multiple_choices": false},{"name": "os_type","type": "string"},{"name": "browser","type": "string"},{"name": "browser_language","type": "string"},{"name": "widget_language","type": "string"},{"name": "browser_version","type": "integer"},{"name": "resolution","type": "string"},{"name": "current_url","type": "string"},{"name": "score","type": "integer"},{"name": "facebook_url","type": "string"},{"name": "linkedin_url","type": "string"},{"name": "twitter_url","type": "string"},{"name": "google_url","type": "string"},{"name": "unsubscribed","type": "boolean"},{"name": "whatsapp_unsubscribed","type": "boolean"},{"name": "spambounced","type": "boolean"},{"name": "softbounced","type": "boolean"},{"name": "hardbounced","type": "boolean"},{"name": "notifications","type": "boolean"},{"name": "email_mx_valid","type": "boolean"},{"name": "created_at","type": "datetime"},{"name": "updated_at","type": "datetime"},{"name": "lt_opened_email","type": "datetime"},{"name": "lt_clicked_email","type": "datetime"},{"name": "most_active_time","type": "datetime"},{"name": "is_active","type": "boolean"},{"name": "widget_visibility","type": "fixed","choices": [,1 field1 field],"allow_multiple_choices": false},{"name": "Boolean attribute","type": "boolean"},{"name": "Date attribute","type": "date"},{"name": "Datetime attribute","type": "datetime"},{"name": "Fixed choices attribute","type": "fixed","choices": [,1 field1 field],"allow_multiple_choices": true},{"name": "Floating-point number attribute","type": "float"},{"name": "Integer attribute","type": "integer"},{"name": "JSON attribute","type": "json"},{"name": "String attribute","type": "string"}]{
"detail": "Unknown model."
}
The 404 with "detail": "Unknown model." comes back for any other model, including clientuser, which Create attribute uses for contacts. The list has no IDs and no name_std: for a custom attribute's name_std, keep the Create attribute response.
Response fields
The 200 OK response body is an array. Each item has these fields.
- name
- For a standard field, its name in the API (
email). For a custom attribute, its display name as created (Loyalty tier), notname_std. - type
- Value type of the attribute:
boolean,date,datetime,fixed,float,integer,jsonorstring. - choices
- Options, each as
{"<value>": "<label>"}. Onfixedattributes that have options, and on any attribute created withchoices. Missing otherwise. - allow_multiple_choices
- Whether more than one option can be selected. Present together with
choices.
note
Errors that can come from any endpoint (401, 429, 500, 502, 504) are described in HTTP response codes.