-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsegment-http-tracking-api-openapi.yml
More file actions
737 lines (737 loc) · 22.5 KB
/
segment-http-tracking-api-openapi.yml
File metadata and controls
737 lines (737 loc) · 22.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
openapi: 3.1.0
info:
title: Segment HTTP Tracking API
description: >-
The Segment HTTP Tracking API enables developers to record analytics
data from any website or application by sending HTTP requests directly
to Segment servers. It supports identify, track, page, screen, group,
alias, and batch calls, and Segment routes the collected data to
configured destinations. The API accepts batch requests up to 500 KB
and requires each payload to include a userId or anonymousId. It is
a server-side alternative to Segment's client-side SDKs.
version: '1.0.0'
contact:
name: Segment Support
url: https://segment.com/help/
termsOfService: https://segment.com/legal/terms/
externalDocs:
description: Segment HTTP Tracking API Documentation
url: https://segment.com/docs/connections/sources/catalog/libraries/server/http-api/
servers:
- url: https://api.segment.io/v1
description: Production Server (US)
- url: https://events.eu1.segmentapis.com/v1
description: Production Server (EU)
tags:
- name: Alias
description: >-
Operations for merging two user identities together.
- name: Batch
description: >-
Operations for sending multiple calls in a single request.
- name: Group
description: >-
Operations for associating users with groups or organizations.
- name: Identify
description: >-
Operations for identifying users and associating traits with them.
- name: Page
description: >-
Operations for recording page views on websites.
- name: Screen
description: >-
Operations for recording screen views in mobile applications.
- name: Track
description: >-
Operations for tracking events and actions performed by users.
security:
- basicAuth: []
paths:
/identify:
post:
operationId: identify
summary: Identify a user
description: >-
Associates a user with their traits. An identify call lets you
tie a user to their actions and record traits about them. It
includes a unique user ID and any optional traits you know
about them, like their email, name, or role.
tags:
- Identify
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/IdentifyCall'
responses:
'200':
description: Event accepted successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
'400':
description: Invalid request payload.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Invalid or missing write key.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/track:
post:
operationId: track
summary: Track an event
description: >-
Records an action that a user performs. A track call requires
an event name and can include properties that describe the
event, such as revenue, product details, or other contextual
information.
tags:
- Track
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/TrackCall'
responses:
'200':
description: Event accepted successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
'400':
description: Invalid request payload.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Invalid or missing write key.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/page:
post:
operationId: page
summary: Record a page view
description: >-
Records a page view on a website. A page call lets you record
whenever a user sees a page of your website, along with any
optional properties about the page.
tags:
- Page
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PageCall'
responses:
'200':
description: Event accepted successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
'400':
description: Invalid request payload.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Invalid or missing write key.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/screen:
post:
operationId: screen
summary: Record a screen view
description: >-
Records a screen view in a mobile application. A screen call
lets you record whenever a user sees a screen of your mobile
app, along with optional properties about the screen.
tags:
- Screen
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ScreenCall'
responses:
'200':
description: Event accepted successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
'400':
description: Invalid request payload.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Invalid or missing write key.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/group:
post:
operationId: group
summary: Associate user with a group
description: >-
Associates an identified user with a group such as a company,
organization, or account. A group call lets you record which
group a user belongs to and set traits on the group.
tags:
- Group
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/GroupCall'
responses:
'200':
description: Event accepted successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
'400':
description: Invalid request payload.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Invalid or missing write key.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/alias:
post:
operationId: alias
summary: Merge two user identities
description: >-
Merges two user identities by connecting a previous ID to a
new user ID. This is an advanced method that is useful when
you want to associate an anonymous user with an identified
user after they sign up or log in.
tags:
- Alias
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AliasCall'
responses:
'200':
description: Event accepted successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
'400':
description: Invalid request payload.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Invalid or missing write key.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/batch:
post:
operationId: batch
summary: Send a batch of events
description: >-
Sends multiple identify, track, page, screen, group, and alias
calls in a single request. The batch endpoint accepts up to
500 KB per request and a maximum of 2500 events per batch.
Each individual event must be less than 32 KB.
tags:
- Batch
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BatchCall'
responses:
'200':
description: Batch accepted successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
'400':
description: Invalid request payload.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Invalid or missing write key.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
components:
securitySchemes:
basicAuth:
type: http
scheme: basic
description: >-
HTTP Basic authentication using the source write key as the
username and an empty password. The write key is found in the
Segment source settings.
schemas:
SuccessResponse:
type: object
properties:
success:
type: boolean
description: >-
Whether the request was accepted.
ErrorResponse:
type: object
properties:
success:
type: boolean
description: >-
Always false for error responses.
message:
type: string
description: >-
A human-readable error message.
Context:
type: object
description: >-
Dictionary of extra context for the call. Context is a
dictionary of extra information that provides useful context
about a data point, such as the user's IP address, locale,
or device information.
properties:
active:
type: boolean
description: >-
Whether the user is active.
ip:
type: string
description: >-
The IP address of the user.
locale:
type: string
description: >-
The locale string for the user.
userAgent:
type: string
description: >-
The user agent string of the client.
library:
type: object
description: >-
Information about the library making the call.
properties:
name:
type: string
description: >-
The name of the library.
version:
type: string
description: >-
The version of the library.
page:
type: object
description: >-
Information about the current page.
properties:
path:
type: string
description: >-
The path of the page.
referrer:
type: string
format: uri
description: >-
The referrer URL.
search:
type: string
description: >-
The search query string.
title:
type: string
description: >-
The page title.
url:
type: string
format: uri
description: >-
The full URL of the page.
device:
type: object
description: >-
Information about the user's device.
properties:
id:
type: string
description: >-
The device ID.
manufacturer:
type: string
description: >-
The device manufacturer.
model:
type: string
description: >-
The device model.
name:
type: string
description: >-
The device name.
type:
type: string
description: >-
The device type.
Integrations:
type: object
description: >-
Dictionary of destinations to enable or disable. Pass a
destination name as key and true/false as the value to
control which destinations receive the data.
additionalProperties:
oneOf:
- type: boolean
- type: object
IdentifyCall:
type: object
description: >-
An identify call associates a user with their traits.
properties:
userId:
type: string
description: >-
Unique identifier for the user in your database.
anonymousId:
type: string
description: >-
A pseudo-unique substitute for a user ID for cases when
you do not have an absolutely unique identifier.
traits:
type: object
description: >-
Free-form dictionary of traits of the user, like email
or name.
additionalProperties: true
context:
$ref: '#/components/schemas/Context'
integrations:
$ref: '#/components/schemas/Integrations'
timestamp:
type: string
format: date-time
description: >-
ISO 8601 date string when the message was originally sent.
messageId:
type: string
description: >-
Unique identifier for the message to deduplicate.
TrackCall:
type: object
required:
- event
description: >-
A track call records an action that a user performs.
properties:
userId:
type: string
description: >-
Unique identifier for the user in your database.
anonymousId:
type: string
description: >-
A pseudo-unique substitute for a user ID.
event:
type: string
description: >-
Name of the action that a user has performed.
properties:
type: object
description: >-
Free-form dictionary of properties of the event, like
revenue or product details.
additionalProperties: true
context:
$ref: '#/components/schemas/Context'
integrations:
$ref: '#/components/schemas/Integrations'
timestamp:
type: string
format: date-time
description: >-
ISO 8601 date string when the message was originally sent.
messageId:
type: string
description: >-
Unique identifier for the message to deduplicate.
PageCall:
type: object
description: >-
A page call records a page view on a website.
properties:
userId:
type: string
description: >-
Unique identifier for the user in your database.
anonymousId:
type: string
description: >-
A pseudo-unique substitute for a user ID.
name:
type: string
description: >-
Name of the page.
properties:
type: object
description: >-
Free-form dictionary of properties of the page.
properties:
path:
type: string
description: >-
The path portion of the page URL.
referrer:
type: string
format: uri
description: >-
The referrer URL.
search:
type: string
description: >-
The search query string of the URL.
title:
type: string
description: >-
The page title.
url:
type: string
format: uri
description: >-
The full URL of the page.
additionalProperties: true
context:
$ref: '#/components/schemas/Context'
integrations:
$ref: '#/components/schemas/Integrations'
timestamp:
type: string
format: date-time
description: >-
ISO 8601 date string when the message was originally sent.
messageId:
type: string
description: >-
Unique identifier for the message to deduplicate.
ScreenCall:
type: object
description: >-
A screen call records a screen view in a mobile application.
properties:
userId:
type: string
description: >-
Unique identifier for the user in your database.
anonymousId:
type: string
description: >-
A pseudo-unique substitute for a user ID.
name:
type: string
description: >-
Name of the screen.
properties:
type: object
description: >-
Free-form dictionary of properties of the screen.
additionalProperties: true
context:
$ref: '#/components/schemas/Context'
integrations:
$ref: '#/components/schemas/Integrations'
timestamp:
type: string
format: date-time
description: >-
ISO 8601 date string when the message was originally sent.
messageId:
type: string
description: >-
Unique identifier for the message to deduplicate.
GroupCall:
type: object
required:
- groupId
description: >-
A group call associates an identified user with a group.
properties:
userId:
type: string
description: >-
Unique identifier for the user in your database.
anonymousId:
type: string
description: >-
A pseudo-unique substitute for a user ID.
groupId:
type: string
description: >-
A unique identifier for the group.
traits:
type: object
description: >-
Free-form dictionary of traits of the group, like name,
industry, or number of employees.
additionalProperties: true
context:
$ref: '#/components/schemas/Context'
integrations:
$ref: '#/components/schemas/Integrations'
timestamp:
type: string
format: date-time
description: >-
ISO 8601 date string when the message was originally sent.
messageId:
type: string
description: >-
Unique identifier for the message to deduplicate.
AliasCall:
type: object
required:
- previousId
- userId
description: >-
An alias call merges two user identities.
properties:
userId:
type: string
description: >-
The new user ID to associate.
previousId:
type: string
description: >-
The previous ID to be merged with the user ID.
context:
$ref: '#/components/schemas/Context'
integrations:
$ref: '#/components/schemas/Integrations'
timestamp:
type: string
format: date-time
description: >-
ISO 8601 date string when the message was originally sent.
messageId:
type: string
description: >-
Unique identifier for the message to deduplicate.
BatchCall:
type: object
required:
- batch
description: >-
A batch call sends multiple events in a single request.
properties:
batch:
type: array
description: >-
An array of identify, track, page, screen, group, or alias
call objects. Maximum 2500 events per batch. Each event
must be less than 32 KB.
maxItems: 2500
items:
type: object
required:
- type
properties:
type:
type: string
description: >-
The type of call.
enum:
- identify
- track
- page
- screen
- group
- alias
userId:
type: string
description: >-
Unique identifier for the user.
anonymousId:
type: string
description: >-
A pseudo-unique substitute for a user ID.
event:
type: string
description: >-
Event name, required for track calls.
properties:
type: object
description: >-
Event or page/screen properties.
additionalProperties: true
traits:
type: object
description: >-
User or group traits.
additionalProperties: true
groupId:
type: string
description: >-
Group ID, required for group calls.
previousId:
type: string
description: >-
Previous ID, required for alias calls.
name:
type: string
description: >-
Page or screen name.
context:
$ref: '#/components/schemas/Context'
integrations:
$ref: '#/components/schemas/Integrations'
timestamp:
type: string
format: date-time
description: >-
ISO 8601 date string.
messageId:
type: string
description: >-
Unique identifier for the message.
context:
$ref: '#/components/schemas/Context'
integrations:
$ref: '#/components/schemas/Integrations'