People

The Events and Profiles API is in early access. The API can be enabled by an admin in your account. In Admin Center, go to Sunshine > Settings (https://your_subdomain.zendesk.com/admin/sunshine/settings), select the Events and Profiles API, and click Save.

The People API gives you a view of the customers who have profiles. The API defines each customer as a person with one or more profiles. The customers are defined as people.

The profiles are created with either the Profiles or the Events APIs.

JSON Format

People are represented by a JSON object named data with the following properties.

Name Type Comment
people array A list of persons, each represented by an object with an "id" property
links string

Get Current Person

GET /api/sunshine/people/me

Returns the current authenticated Sunshine person if the person exists.

Identifying a Zendesk Support user

You can identify a person as a Zendesk Support user if the person has a profile with an identifier named "user_id". The identifier name is used in Sunshine to specify a person's user id in Zendesk Support. Example:

{
  "profile": {
    "source": "support",
    "type": "default",
    "identifiers": {
      "user_id": "3456123"
    }
  }
}
Allowed for
  • Agents
Using cURL
curl https://{subdomain}.zendesk.com/api/sunshine/people/me \
  -H "Accept: application/json" \
  -v -u {email_address}:{password}
Example response
Status: 200 OK
{
    "data": {
        "id": "5c8053c36e8b08003016f37f",
        "profiles": [
            {
                "source": "support",
                "type": "default",
                "identifiers": {
                    "user_id": "10001"
                },
                "attributes": {
                    "favorite_color": "green"
                }
            }
        ],
        "attributes": null
    }
}

Get People from your account

GET /api/sunshine/people

Returns a list of all people belonging to your account. The person object is represented as a computed profile, which displays an aggregated view of all the profiles combined.

Allowed For
  • Agents
Using cURL
curl https://{subdomain}.zendesk.com/api/sunshine/people \
  -H "Accept: application/json" \
  -v -u {email_address}:{password}
Example response
Status: 200 OK
{
  "data": [
    {"id":"5c3f8679c591ca0001d5db5a"},
    {"id":"5c3fabfba6847b0001fdb16c"}
  ],
  "links": null
}

Get a Person

GET /api/sunshine/people/<person_id> OR GET /api/sunshine/people?identifier={identifier_query}

The below endpoints are deprecated. Any new calls should be made to the /people endpoints above.

GET /api/sunshine/person/<person_id> (DEPRECATED) OR GET /api/sunshine/person?identifier={identifier_query} (DEPRECATED)

Returns the profiles of a person. The results contains all the profiles created and attached to the person.

See also Identifier Query Syntax.

Allowed For
  • Agents
Using cURL
curl -G "https://{subdomain}.zendesk.com/api/sunshine/person/5c3fabfba6847b0001fdb16c" \
  -H "Accept: application/json" \
  -v -u {email_address}:{password}

OR

curl -G "https://{subdomain}.zendesk.com/api/sunshine/person" \
  --data-urlencode "identifier=shopify:customer:email:foo@bar.com" \
  -H "Accept: application/json" \
  -v -u {email_address}:{password}

Get Person (advanced)

GET /api/sunshine/people/<person_id>?{included_profiles_query} (DEPRECATED) OR GET /api/sunshine/people?identifier={identifier_query}&{included_profiles_query} (DEPRECATED)

The below endpoints are deprecated. Any new calls should be made to the /people endpoints above.

GET /api/sunshine/person/<person_id>?{included_profiles_query} (DEPRECATED) OR GET /api/sunshine/person?identifier={identifier_query}&{included_profiles_query} (DEPRECATED)

Similar to Get Person, but if a person has a lot of profiles returned. You can retrieve specific profiles by passing the profile sources/types that you are care about

The following query string parameters are required:

You can also include any of the following optional query string parameters:

  • merge - If this is set to "true", we will attempt to merge all attributes for the returned profiles.
Allowed For
  • Agents
Using cURL
curl -G "https://{subdomain}.zendesk.com/api/sunshine/person/5c3fabfba6847b0001fdb16c" \
  --data-urlencode "included_profiles=support,chat,talk" \
  --data-urlencode "merge=true" \
  -H "Accept: application/json" \
  -v -u {email_address}:{password}

OR

curl -G "https://{subdomain}.zendesk.com/api/sunshine/person" \
  --data-urlencode "identifier=shopify:customer:email:foo@bar.com" \
  --data-urlencode "included_profiles=shopify:customer,support,amazon" \
  -H "Accept: application/json" \
  -v -u {email_address}:{password}

They will be processed by our services in the order of shopify:customer, then support, then amazon. There are currently no limits on the number of filters you can chain in one request.

List Events of Person

GET /api/sunshine/people/<person_id>/events OR GET /api/sunshine/people/events?identifier={identifier_query}

The below endpoints are deprecated. Any new calls should be made to the /people endpoints above.

GET /api/sunshine/person/<person_id>/events (DEPRECATED) OR GET /api/sunshine/person/events?identifier={identifier_query} (DEPRECATED)

Retreives events for each profile attached to the specified person.

See also Identifier Query Syntax.

Allowed For
  • Agents
Using cURL
curl -G "https://{subdomain}.zendesk.com/api/sunshine/person/5c3fabfba6847b0001fdb16c/events" \
  -H "Accept: application/json" \
  -v -u {email_address}:{password}

OR

curl -G "https://{subdomain}.zendesk.com/api/sunshine/person/events" \
  --data-urlencode "identifier=shopify:customer:email:foo@bar.com" \
  -H "Accept: application/json" \
  -v -u {email_address}:{password}
Example Response
Status: 200 OK
{
  "data": [
    {
      "id": "5cdf36818b9ecd0001e38497",
      "type": "checkout",
      "source": "online_store",
      "description": "",
      "authenticated": true,
      "created_at": "2019-05-17T22:32:33Z",
      "received_at": "2019-05-17T22:32:33Z",
      "properties": {
        "price": 400
      }
    },
    {
      "id": "5cdf36808b9ecd0001e38494",
      "type": "page_view",
      "source": "online_store",
      "description": "",
      "authenticated": true,
      "created_at": "2019-05-17T22:32:32Z",
      "received_at": "2019-05-17T22:32:32Z",
      "properties": {
        "item": "headphones"
      }
    }
  ]
}

Delete Person

DELETE /api/sunshine/people/<person_id> OR DELETE /api/sunshine/people?identifier={identifier_query}

The below endpoints are deprecated. Any new calls should be made to the /people endpoints above.

DELETE /api/sunshine/person/<person_id> (DEPRECATED) OR DELETE /api/sunshine/person?identifier={identifier_query} (DEPRECATED)

Delete the person and all relevant profiles.

See also Identifier Query Syntax.

Allowed For
  • Agents
Using cURL
curl -G "https://{subdomain}.zendesk.com/api/sunshine/person/5c3fabfba6847b0001fdb16c" \
  -H "Accept: application/json" \
  -v -u {email_address}:{password} -X DELETE

OR

curl -G "https://{subdomain}.zendesk.com/api/sunshine/person" \
  --data-urlencode "identifier=shopify:customer:email:foo@bar.com" \
  -H "Accept: application/json" \
  -v -u {email_address}:{password} -X DELETE
Example Response
Status: 202 OK