You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/personas/profile-api.md
+29-23Lines changed: 29 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,19 +12,19 @@ The Segment Profile API provides a single API to read user-level and account-lev
12
12
13
13
You can use this API to:
14
14
15
-
-**Build an in-app recommendation** engine to show users or accounts the last 5 products they viewed but didn't purchase
15
+
-**Build an in-app recommendation** engine to show users or accounts the last five products they viewed but didn't purchase
16
16
-**Empower your sales and support associates** with the complete customer context by embedding the user profile in third-party tools like Zendesk or Desk.com
17
17
-**Power personalized marketing campaigns** by enriching dynamic / custom properties with profile traits in marketing tools like Braze
18
18
-**Qualify leads faster** by embedding the user event timeline in Salesforce
19
19
20
-
This document has four parts…
20
+
This document has four parts:
21
21
22
22
1.[**Product Highlights**](#product-highlights)
23
23
2.[**Quickstart**](#quickstart): Walks you through how to get started querying your user profile in <1 min
24
24
3.[**API Reference**](#api-reference): Retrieve a list of users sorted by recent activity or find a particular user
25
25
4.[**Best Practices**](#recommended-implementation): Recommended implementation and example Profile API workflow
26
26
27
-
## Product Highlights
27
+
## Product highlights
28
28
1.**Fast response times** — fetch traits from a user profile under 200ms
29
29
2.**Real-time data** — query streaming data on the user profile
30
30
3.**One identity** — query an end user's interactions across web, mobile, server, and third party touch-points
@@ -36,7 +36,7 @@ This document has four parts…
36
36
> warning ""
37
37
> **Important**: The Profile API is intended to be used server-side. You should not implement directly in client applications. See the [Best Practices](#recommended-implementation) section for more details.
38
38
39
-
### Configure Access
39
+
### Configure access
40
40
41
41
Your access token enables you to call the Profile API and access customer data.
42
42
@@ -59,6 +59,10 @@ Your access token enables you to call the Profile API and access customer data.
59
59
2. Take note of the user's available identifiers. For example, this user has a `user_id` with the value `9800664881`. The Profile API requires both the type of ID and the value separated by a colon. For example, `user_id:9800664881`.
60
60

61
61
62
+
> warning ""
63
+
> To query phone numbers that contain a plus sign (`+`), insert the escape characters `%2B` in place of the plus sign. <br>
64
+
> For example, if a `phone_number` identifier has the value `+5555550123`, enter `phone_number:%2B5555550123` in your query.
65
+
62
66
### Query the user's event traits
63
67
64
68
1. From the HTTP API testing application of your choice, configure the authentication as described above.
@@ -122,16 +126,18 @@ You can query all of a user's metadata (created_at, updated_at, ...):
122
126
123
127
**Search an account profile**
124
128
125
-
If you are sending group calls to Segment, you can now access your account profiles as well. You can retrieve your account traits, computed traits, and audience traits by querying the `group_id` you are interested in:
129
+
If you're sending group calls to Segment, you can now access your account profiles as well. Retrieve your account traits, computed traits, and audience traits by querying the `group_id` you are interested in:
The Segment API is organized around [REST](http://en.wikipedia.org/wiki/Representational_State_Transfer). The API has predictable, resource-oriented URLs, and uses HTTP response codes to indicate API errors. Segment uses standard HTTP features, like HTTP authentication and HTTP verbs, which are understood by off-the-shelf HTTP clients. [JSON](http://www.json.org/) is returned by all API responses, including errors.
153
+
The Segment API is organized around [REST](http://en.wikipedia.org/wiki/Representational_State_Transfer){:target="_blank"}. The API has predictable, resource-oriented URLs, and uses HTTP response codes to indicate API errors. Segment uses standard HTTP features, like HTTP authentication and HTTP verbs, which are understood by off-the-shelf HTTP clients. [JSON](http://www.json.org/){:target="_blank"} is returned by all API responses, including errors.
148
154
149
155
**Endpoint**
150
156
@@ -157,7 +163,7 @@ The Segment API is organized around [REST](http://en.wikipedia.org/wiki/Represen
157
163
158
164
### Authentication
159
165
160
-
The Profile API uses basic authentication for authorization — with the **Access Token** as the authorization key. Your **Access Token** carries access to all of your customer data, so be sure to keep them secret. Do not share your Access Token in publicly accessible areas such as GitHub or client-side code.
166
+
The Profile API uses basic authentication for authorization — with the **Access Token** as the authorization key. Your **Access Token** carries access to all of your customer data, so be sure to keep them secret. Don't share your Access Token in publicly accessible areas such as GitHub or client-side code.
161
167
162
168
You can create your Access Secret in your Personas Settings page. Segment recommends that you name your tokens with the name of your app and its environment, such as `marketing_site/production`. Access tokens are shown once — you won't be able to see it again. In the event of a security incident, you can revoke and cycle the access token.
163
169
@@ -205,7 +211,7 @@ Segment uses conventional HTTP response codes to indicate the success or failure
205
211
|**rate_limit_error**| Too many requests hit the API too quickly. |
206
212
|**validation_error**| Errors triggered when failing to validate fields (for example, when a collection name has invalid characters). |
207
213
208
-
### Rate Limit
214
+
### Rate limit
209
215
210
216
To ensure low response times, every Space has a default rate limit of 100 requests/sec. Please contact [[email protected]](mailto:[email protected]) if you need a higher limit with details around your use case. For more information about rate limits, see the [Product Limits](/docs/personas/product-limits) documentation.
211
217
@@ -269,7 +275,7 @@ Retrieve a single profile's traits within a collection using an `external_id`. F
269
275
GET /v1/spaces/<space_id>/collections/<users>/profiles/<external_id>/traits
|`verbose`| True for verbose field selection |`true`,`false`|
567
573
568
574
569
-
#### Get a Profile's Linked Users or Accounts
575
+
#### Get a profile's linked users or accounts
570
576
571
577
Get the users linked to an account, or accounts linked to a user, using an `external_id`.
572
578
@@ -626,14 +632,14 @@ GET /v1/spaces/<space_id>/collections/<users>/profiles/<external_id>/links
626
632
}
627
633
```
628
634
629
-
## Best Practices
630
-
### Recommended Implementation
635
+
## Best practices
636
+
### Recommended implementation
631
637
632
-
The Profile API does not support CORS because it has access to the sum of a customer's data. Segment also requests that you prevent the Access Token to the public, for example in a client-side application. Engineers implementing this API are advised to create a personalization service in their infrastructure, which other apps, websites, and services communicate with to fetch personalizations about their users.
638
+
The Profile API doesn't support CORS because it has access to the sum of a customer's data. Segment also requests that you prevent the Access Token to the public, for example in a client-side application. Engineers implementing this API are advised to create a personalization service in their infrastructure, which other apps, websites, and services communicate with to fetch personalizations about their users.
If you want to display the most relevant blog posts given a reader's favorite blog category:
639
645
@@ -653,7 +659,7 @@ Segment does not recommend using `external_ids` as a lookup field that might con
653
659
654
660
### Performance
655
661
656
-
Segment typically sees p95 response times under 200ms for the `/traits` endpoint, based on an in-region test in `us-west` to retrieve 50 traits. However, if you know which traits you are looking for, Segment suggests you use the `/traits?include=` parameter to provide a list of traits want to retrieve.
662
+
Segment typically sees p95 response times under 200ms for the `/traits` endpoint, based on an in-region test in `us-west` to retrieve 50 traits. However, if you know which traits you're looking for, Segment suggests you use the `/traits?include=` parameter to provide a list of traits you want to retrieve.
657
663
658
664
Another best practice to optimize performance in high-throughput applications is to use connection pooling. Your personalization service should share existing connections when making a request to the Profile API, instead of opening and closing a connection for each request. This additional TLS handshake is a common source of overhead for each request.
0 commit comments