A new profile can be created from either the profiles resource or profile resource.

  • A new profile can be created by calling the url /v1/companies/<companyId>/buckets/<bucketId>/profiles. The method should be POST and a successful profile creation will result in a response status 201 CREATED
  • This can also be done by calling the url /v1/companies/<companyId>/buckets/<bucketId>/profiles/<profileId>. The method should be POST and a successful profile creation will result in a response status 201 CREATED.


Required permission profile.create

Request Headers

Header

Required

Acceptable Value(s)

Description

Content-typeYesapplication/json
AcceptYesapplication/json, application/javascript, image/*Image response will return a 1x1 pixel result.
Content-encodingNogzipCaller can send a gzipped request to the API and set the Content-encoding as gzip.
Accept-encodingNogzip

Caller can request a gzipped response from the API and set the Accept-encoding as gzip.


Query Parameters

Key

Required

Description

app_keyNoAn app key refers to a collectApp. If an app key is specified, the profile data is added as the collectApp corresponding to that app key. If no app key is specified then profile data is added using the default collectApp "web"
max_return_sizeNoMax return size refers to the size of the profile to be returned to the caller. If no max_return_size is specified, the profile of size 500 is returned to the caller. Please read the documentation about profile trimming to learn more about how the profile is trimmed to the specified size.
max_return_eventsNoMax return events refers to the the total number of events to be returned to the caller. The returned events can be distributed over several sessions. The max_return_events can be less than expected in the response if the profile does not have enough events or if the profile becomes larger than the max_return_size.


Response Headers

Header

Description

LocationAbsolute url of the newly created resource.
Content-typeContent type of the response body.
VaryWill contain the Accept-encoding header.
Content-encodingWill contain encoding "gzip".


Example 1: A typical request and response body


Request Body
{
   "id":"<profileId>",
   "createdAt":<timestamp milliseconds>,
   "sessions":[    {
            "id":"<sessionId>",
            "createdAt":<timestamp milliseconds>,
            "collectApp":"<collect app name>",
            "section":"<section name>",
            "data":{
                "key":"value"
            }
            "events":[
               {
                  "id":"<eventId>",
                  "createdAt":<Timestamp milliseconds>,
                  "definitionId":"<definitionId>",


                  "data":{
                    "key":"value"
                  }
               }
            ]
         }
   ],
   "attributes":[
      {
        "collectApp""<collect app name>",
        "section""<section name>",
        "data": {
          "key""value"
        }
      }
   ]}


Response Body
{
   "profile":{
      "id":"<profileId>",
      "version":"1.0",
      "createdAt":<timestamp milliseconds>,
      "sessions":[
         {
            "id":"<sessionId>",
            "createdAt":<timestamp milliseconds>,
            "collectApp":"<collect app name>",
            "section":"<section name>",
            "data":{
               "key":"value"
            },
            "services":[
               {
                  "id":"geo",
                  "data":{
                     "countryCode":0,
                     "countryName":"<a country>",
                     "region":"<a region>",
                     "city":"<a city>",
                     "postalCode":null,
                     "latitude":0.0,
                     "longitude":0.0,
                     "dmaCode":0,
                     "areaCode":0,
                     "metroCode":0
                  }
               }
            ],
            "events":[
               {
                  "id":"<eventId>",
                  "createdAt":<timestamp milliseconds>,
                  "definitionId":"<definitionId>",
                  "data":{
                     "key":"value"
                  },
                  "services":[
                   ]
               }
            ]
         }
      ],
      "attributes":[
         {
            "collectApp""<collect app name>",
            "section""<section name>",
            "data": {
                "key""value"
            }
        }
      ],
      "services":[
       ]
   },
   "links":{
      "self":"http://&lt;hostname&gt;/v1/companies/&lt;companyId&gt;/buckets/&lt;bucketId&gt;/profiles/&lt;profileId>"
   }}


Example 2: A minimal request and response body

Minimal Request Body
{
   "id":"<profileId>"
}


Minimal Response Body

{
   "profile":{
      "id":"<profileId>",
      "version":"1.0",
      "createdAt":<timestamp milliseconds>,
      "sessions":[
        ],
      "attributes":[
        ],
      "services":[
        ],
      "mergedProfiles":[
        ]
   },
   "links":{
      "self":"http://&lt;hostname&gt;/v1/companies/&lt;companyId&gt;/buckets/&lt;bucketId&gt;/profiles/&lt;profileId>",
   }}