forked from camaraproject/APIBacklog
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsponsored_data_api.v1.yaml
More file actions
1289 lines (1261 loc) · 56 KB
/
sponsored_data_api.v1.yaml
File metadata and controls
1289 lines (1261 loc) · 56 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
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.0
info:
title: Sponsored Data API
version: 1.0.0
description: |
Sponsored Data API for OpenGateway/CAMARA Project
The Sponsored Data API allows sponsoring companies (EPs) to cover the cost of mobile data access for end-users on 4G and 5G networks. This API is part of the Open Gateway/CAMARA initiative and provides a set of operations for the dynamic management of mobile data sponsorship. Sponsoring companies can start or revoke sponsorships for users, as well as query the status of both sponsorship sessions and their campaigns.
[TODO: Pensar si vale la pena poner elegibilidad, balance y pausa de campaña]
The API also allows for the verification of user eligibility for sponsorship and the ability to pause and resume active campaigns. With this API, mobile operators can offer differentiated services that enable innovative business models, providing connectivity at no direct cost to the end-user, with funding provided by a sponsoring entity.
This service is ideal for advertising campaigns, product promotions, or services.
Objective of This Initial Version
In this initial version of the API, the sponsorship is proposed for all data traffic (ANY) carried by the user's default bearer, for a specified volume and time, without focusing on a specific destination.
* Onboarding*
Onboarding is the process by which a Sponsoring Company (EP) contracts a Sponsorship Campaign with the API Gateway Platform (OpenGateway) and the specific Mobile Network Operator (MNO). Initially, this event is supported by the signing of an agreement or documentation outlining the general objectives of the campaign and default sponsorship conditions. For example:
Type of Campaign: Prepaid or postpaid
Total data volume contracted for prepaid campaigns, e.g., 2000 MB
Campaign validity, e.g., (from/to) or (336 total hours consumed since activation)
Default sponsored data volume for users, e.g., 50 MB
Default sponsorship validity per user, e.g., 10 minutes
Additionally, during this onboarding process, the EP is provided with the "sponsorId" and the specific "campaign_Id".
* campaignId *
Campaign_ID is a unique identifier assigned to each sponsorship campaign contracted by a Sponsoring Company and assigned during the onboarding process.
* Traceability - sessionId *
All operations associated with a user (UE) sponsorship are grouped under a session identified by a sessionId. This identifier allows tracking and correlating all interactions within the same sponsorship session.
* Assignment of Identifiers *
Both, campaign_Id and sessionId, are assigned and managed exclusively by the API Gateway Platforms (OpenGateway) and communicated to both the Sponsoring Companies and the MNOs. CampaignId during the onboarding document signing proccess. And sessionId on real time during each sponsorship operation request.
* Authorization and Authentication *
The "Camara Security and Interoperability Profile" provides details on how a client requests an access token. Please refer to Identity and Consent Management (https://github.com/camaraproject/IdentityAndConsentManagement/) for the released version of the Profile.
The specific authorization flows to be used will be determined during the onboarding process, occurring between the API Client and the Telco Operator exposing the API, taking into account the declared purpose for accessing the API, and subject to the prevailing legal framework dictated by local legislation.
It is important to note that in cases where personal user data is processed by the API, and users can exercise their rights through mechanisms such as opt-in and/or opt-out, the use of 3-legged access tokens becomes mandatory. This measure ensures that the API remains in strict compliance with user privacy preferences and regulatory obligations, upholding the principles of transparency and user-centric data control.
* Authorization and Consent Approach *
The Sponsored Data API facilitates user-initiated sponsorship of data services, requiring active user engagement at specific moments via the sponsor’s application. Given the nature of this service, where users must explicitly request sponsorship, the "Authorization Code Flow - Frontend Flow" has been chosen as the authorization and consent method. This flow aligns with the need for secure, direct interaction between the user and the service, ensuring that consent is explicitly provided in a manner that complies with data protection regulations such as GDPR.
* API Functionality *
This API exposes the following endpoints: NOTE: All of these are REQUIRED for minimal and correct operation unless explicitly indicated otherwise [OPTIONAL OPERATION]
/sponsorship: Initiates sponsorship and includes a webhook for session-related notifications. With HTTP 201, the Gateway Platform returns the sessionId.
/sponsorship/{sponsorId}/{campaignId}/{sessionId}/session-status: Queries the status of a particular session. Returns session-related data.
/sponsorship/{sponsorId}/{campaignId}/{sessionId}/revoke: Revokes an active sponsorship session. If active, it must be terminated.
/campaign/{sponsorId}/{campaignId}/status: Queries the status of the campaign, returning if it is active, paused, or finished, data balance associated with the campaign, consumed data volume and additional information [OPTIONAL OPERATION]
/campaign/{sponsorId}/{campaignId}/active-sponsorship-list: Queries the list of users currently sponsored by the campaign. [OPTIONAL OPERATION]
/campaign/{sponsorId}/{campaignId}/alert-subscription: Requests subscription to events associated with the campaign. Includes a webhook for notifications. In this version of the API, only consumption thresholds and expiration events are available. [OPTIONAL OPERATION]
/campaign/{sponsorId}/{campaignId}/manage: Allows pausing and reactivating a campaign. During onboarding, it should be defined whether paused periods consume campaign validity time. [OPTIONAL OPERATION]
* Date and Time Formats *
All date and time values in this API are represented using the ISO 8601 format. For example, '2023-11-22T13:37:00Z' represents November 22, 2023 at 1:37 PM UTC.
* Roles *
Mobile Network Operators (MNOs): Providers of mobile services that manage network infrastructure and data provisioning.
Sponsoring Companies (SCs): Companies that fund the use of mobile data for their clients or specific users, aiming to offer a no-cost data experience.
API Gateway Operator Platform (OpenGateway level): A gateway with various functions based on best business practices established by OpenGateway. In addition to translation functions, it must track and manage campaigns and sessions established during operation.
Sponsored Users (SU): Mobile network users whose mobile data usage is sponsored by the EPs.
servers:
- url: "{apiRoot}/sponsored-data/v1.0.0"
variables:
apiRoot:
default: http://localhost:9091
description: API root, defined by the service provider, e.g. `api.example.com` or `api.example.com/somepath`
paths:
/sponsorship:
post:
summary: Start Sponsorship Session Request
description: This operation requests the sponsorship for a subscriber in a specific campaign, allowing them to use sponsored data within the limits set by this request or those defined in the campaign onboarding declaration by default.
operationId: startSponsorship
parameters:
- $ref: '#/components/parameters/x-correlator'
- $ref: '#/components/parameters/x-accessToken'
requestBody:
description: Parameters for creating the new sponsorship session
required: true
content:
application/json:
schema:
type: object
properties:
sponsorId:
$ref: '#/components/schemas/sponsorId'
campaignId:
$ref: '#/components/schemas/campaignId'
phoneNumber:
$ref: '#/components/schemas/phoneNumber'
dataVolume:
description: Data volume (in MegaBytes) to be sponsored by the sponsor for the mobile user. If not specified, the default data volume defined in the onboarding rules will apply.
type: integer
minimum: 1
maximum: 1000
duration:
description: Duration (in minutes) of the requested sponsorship. If not specified, the duration defined in the onboarding rules will apply.
type: integer
minimum: 1
maximum: 1440
webhookUrl:
$ref: '#/components/schemas/webhookUrl'
callbackToken:
description: Security token for authenticating notifications sent to the webhook.
type: string
format: "uuid"
pattern: "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89aAbB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$" # UUID versión 4 regular expression
required:
- sponsorId
- campaignId
- phoneNumber
- webhookUrl
- callbackToken
callbacks:
notifications:
"{$request.body#/webhookUrl}":
post:
tags:
- Sponsorship notifications callback
summary: "Sponsorship notifications callback"
description: |
This endpoint must be implemented by the API consumer. The sponsorship server will send notifications to this URI when a sponsorship ends, providing the reason for termination and session details
operationId: notifySponsorshipEnd
parameters:
- $ref: "#/components/parameters/x-correlator"
- $ref: "#/components/parameters/x-callbackToken"
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/SponsorshipEndNotification"
responses:
"204":
description: Successful notification
headers:
x-correlator:
$ref: '#/components/headers/x-correlator'
"400":
$ref: "#/components/responses/Generic400"
"401":
$ref: "#/components/responses/Generic401"
"403":
$ref: "#/components/responses/Generic403"
"410":
$ref: "#/components/responses/Generic410"
"500":
$ref: "#/components/responses/Generic500"
"503":
$ref: "#/components/responses/Generic503"
responses:
'201':
description: Successful operation. New sponsorship session created.
headers:
x-correlator:
$ref: '#/components/headers/x-correlator'
content:
application/json:
schema:
type: object
properties:
sponsorId:
$ref: '#/components/schemas/sponsorId'
campaignId:
$ref: '#/components/schemas/campaignId'
sessionId:
$ref: '#/components/schemas/sessionId'
startTime:
$ref: "#/components/schemas/time"
endTime:
$ref: "#/components/schemas/time"
description: |
End date and time of the sponsorship.
Calculated by adding the specified sponsorship duration to the start time (startTime).
If duration is not specified, the default value defined in the onboarding campaign profile is used.
sponsoredDataVolume:
description: The assigned data volume for the user. This value is derived from either the sponsorship request or, if not specified in the request, from the default value defined in the campaign profile during onboarding.
type: integer
minimum: 1
maximum: 1000
required:
- sponsorId
- campaignId
- sessionId
- startTime
- endTime
- sponsoredDataVolume
"400":
$ref: "#/components/responses/Generic400"
"401":
$ref: "#/components/responses/Generic401"
"403":
$ref: "#/components/responses/Generic403"
"404":
$ref: "#/components/responses/Generic404"
"405":
$ref: "#/components/responses/Generic405"
"406":
$ref: "#/components/responses/Generic406"
"415":
$ref: "#/components/responses/Generic415"
"422":
$ref: "#/components/responses/Generic422"
"429":
$ref: "#/components/responses/Generic429"
"500":
$ref: "#/components/responses/Generic500"
"501":
$ref: "#/components/responses/Generic501"
"502":
$ref: "#/components/responses/Generic502"
"503":
$ref: "#/components/responses/Generic503"
"504":
$ref: "#/components/responses/Generic504"
/sponsorship/{sponsorId}/{campaignId}/{sessionId}/session-status:
get:
summary: Sponsorship Session Status Inquiry
description: |
Queries detailed information about a sponsorship session for a specific campaign and sponsor.
NOTES:
The access token for this query must be a 2-legged token, and the sponsor must have been previously authorized with a 3-legged token at the time of session initiation.
The session must have been created by the same API client indicated in the access token.
operationId: getSessionStatus
parameters:
- $ref: '#/components/parameters/x-correlator'
- $ref: '#/components/parameters/x-accessToken'
- name: sponsorId
in: path
required: true
schema:
$ref: '#/components/schemas/sponsorId'
- name: campaignId
in: path
required: true
schema:
$ref: '#/components/schemas/campaignId'
- name: sessionId
in: path
required: true
schema:
$ref: '#/components/schemas/sessionId'
responses:
"200":
description: Contains information about the sponsorship session
headers:
x-correlator:
$ref: '#/components/headers/x-correlator'
content:
application/json:
schema:
type: object
properties:
sponsorId:
$ref: '#/components/schemas/sponsorId'
campaignId:
$ref: '#/components/schemas/campaignId'
sessionId:
$ref: '#/components/schemas/sessionId'
phoneNumber:
$ref: "#/components/schemas/phoneNumber"
startTime:
$ref: "#/components/schemas/time"
description: Date and time when the sponsorship started.
endTime:
$ref: "#/components/schemas/time"
description: Date and time when the session expires if it is still active, or the end time if the session concluded due to data volume exhaustion.
sessionStatus:
description: Indicates whether the session is active or inactive.
enum:
- active
- inactive
dataVolumeConsumed:
description: Volume of data consumed in the session. (MBytes)
type: integer
dataVolumeAvailable:
description: Volume of remaining available data in the session. (MBytes)
type: integer
endReason:
description: Reason for session termination, if it is no longer active.
enum:
- validity_expired
- data_exhausted
- session_revoked
- not_available
required:
- phoneNumber
- startTime
- endTime
- sessionActive
- dataVolumeConsumed
- dataVolumeAvailable
examples:
session_active:
description: Session still active
value:
sponsorId: "3fa85f64-5717-4562-b3fc-2c963f66afaf@company.com"
campaignId: "3fa85f64-5717-4562-b3fc-2c963f663faf@company.com"
sessionId: "3fa85f64-5717-4562-b3fc-2c963f66afa6@company.com"
phoneNumber: "+541149924576"
startTime: "2024-09-01T12:00:00Z"
endTime: "2024-09-01T14:00:00Z"
sessionStatus: "active"
dataVolumeConsumed: 60
dataVolumeAvailable: 40
endReason: not_available
session_inactive:
description: Session still active
value:
sponsorId: "3fa85f64-5717-4562-b3fc-2c963f66afaf@company.com"
campaignId: "3fa85f64-5717-4562-b3fc-2c963f663faf@company.com"
sessionId: "3fa85f64-5717-4562-b3fc-2c963f66afa6@company.com"
phoneNumber: "+541149924576"
startTime: "2024-09-01T12:00:00Z"
endTime: "2024-09-01T13:03:00Z"
sessionStatus: "active"
dataVolumeConsumed: 100
dataVolumeAvailable: 0
endReason: data_exhausted
"400":
$ref: "#/components/responses/Generic400"
"401":
$ref: "#/components/responses/Generic401"
"403":
$ref: "#/components/responses/Generic403"
"404":
$ref: "#/components/responses/Generic404"
"405":
$ref: "#/components/responses/Generic405"
"406":
$ref: "#/components/responses/Generic406"
"415":
$ref: "#/components/responses/Generic415"
"422":
$ref: "#/components/responses/Generic422"
"429":
$ref: "#/components/responses/Generic429"
"500":
$ref: "#/components/responses/Generic500"
"501":
$ref: "#/components/responses/Generic501"
"502":
$ref: "#/components/responses/Generic502"
"503":
$ref: "#/components/responses/Generic503"
"504":
$ref: "#/components/responses/Generic504"
/sponsorship/{sponsorId}/{campaignId}/{sessionId}/revoke:
delete:
summary: Revocation of Sponsorship
description: This operation revokes an active sponsorship, preventing further use of sponsored data for the subscriber.
operationId: revokeSponsorship
parameters:
- $ref: '#/components/parameters/x-correlator'
- $ref: '#/components/parameters/x-accessToken'
- name: sponsorId
in: path
required: true
schema:
$ref: '#/components/schemas/sponsorId'
- name: campaignId
in: path
required: true
schema:
$ref: '#/components/schemas/campaignId'
- name: sessionId
in: path
required: true
schema:
$ref: '#/components/schemas/sessionId'
responses:
'200':
description: Session revoked successfully
headers:
x-correlator:
$ref: '#/components/headers/x-correlator'
content:
application/json:
schema:
type: object
properties:
sponsorId:
$ref: '#/components/schemas/sponsorId'
campaignId:
$ref: '#/components/schemas/campaignId'
sessionId:
$ref: '#/components/schemas/sessionId'
phoneNumber:
$ref: "#/components/schemas/phoneNumber"
startTime:
$ref: "#/components/schemas/time"
description: Date and time when the sponsorship started.
endTime:
$ref: "#/components/schemas/time"
description: Date and time when the sponsorship finished.
requestResult:
type: string
enum:
- successful_revocation
"400":
$ref: "#/components/responses/Generic400"
"401":
$ref: "#/components/responses/Generic401"
"403":
$ref: "#/components/responses/Generic403"
"404":
$ref: "#/components/responses/Generic404"
"405":
$ref: "#/components/responses/Generic405"
"406":
$ref: "#/components/responses/Generic406"
"415":
$ref: "#/components/responses/Generic415"
"422":
$ref: "#/components/responses/Generic422"
"429":
$ref: "#/components/responses/Generic429"
"500":
$ref: "#/components/responses/Generic500"
"501":
$ref: "#/components/responses/Generic501"
"502":
$ref: "#/components/responses/Generic502"
"503":
$ref: "#/components/responses/Generic503"
"504":
$ref: "#/components/responses/Generic504"
/campaign/{sponsorId}/{campaignId}/campaign-status:
get:
summary: Campaign Status Inquiry [active, paused, concluded], data volume balance.
operationId: getCampaignStatus
parameters:
- $ref: '#/components/parameters/x-correlator'
- $ref: '#/components/parameters/x-accessToken'
- name: sponsorId
in: path
required: true
schema:
$ref: '#/components/schemas/sponsorId'
- name: campaignId
in: path
required: true
schema:
$ref: '#/components/schemas/campaignId'
responses:
'200':
description: Returns the status of the campaign
headers:
x-correlator:
$ref: '#/components/headers/x-correlator'
content:
application/json:
schema:
type: object
properties:
sponsorId:
$ref: '#/components/schemas/sponsorId'
campaignId:
$ref: '#/components/schemas/campaignId'
status:
type: string
description: Current status of the campaign (e.g., "active", "paused", "completed").
enum:
- active # The campaign is currently ongoing.
- paused # The campaign is temporarily halted. Active sponsorships continue until completion, and the campaign's duration does not extend due to this pause.
- completed #The campaign has finished successfully, either because all contracted data has been consumed or the time limit has been reached. This status could be sufficient to indicate that the campaign has ended.
- not_available
startTime:
$ref: "#/components/schemas/time"
description: Date and time when the campaign started.
endTime:
$ref: "#/components/schemas/time"
description: Date and time when the campaign expires if it is still active, or the end time if the campaign concluded due to data volume exhaustion.
campaignType:
description: Indicates whether the campaign is prepaid or postpaid
type: string
enum:
- prepaid
- postpaid
contractedDataVolume:
type: integer
description: Total data volume contracted for the campaign in MegaBytes.
usedDataVolume:
type: integer
description: Total data volume consumed in the campaign, in megabytes (MB), as allocated for sponsorships.
remainingDataVolume:
type: integer
description: Remaining data volume available for the campaign in MegaBytes.
completionReason:
type: string
description: Reason for completion (e.g., "time expired", "data exhausted").
enum:
- time_expired
- data_exhausted
- not_available # if the campaign is still active or paused
required:
- sponsorId
- campaignId
- status
- startTime
- endTime
- contractedDataVolume
- usedDataVolume
- remainingDataVolume
- completionReason
"400":
$ref: "#/components/responses/Generic400"
"401":
$ref: "#/components/responses/Generic401"
"403":
$ref: "#/components/responses/Generic403"
"404":
$ref: "#/components/responses/Generic404"
"405":
$ref: "#/components/responses/Generic405"
"406":
$ref: "#/components/responses/Generic406"
"415":
$ref: "#/components/responses/Generic415"
"422":
$ref: "#/components/responses/Generic422"
"429":
$ref: "#/components/responses/Generic429"
"500":
$ref: "#/components/responses/Generic500"
"501":
$ref: "#/components/responses/Generic501"
"502":
$ref: "#/components/responses/Generic502"
"503":
$ref: "#/components/responses/Generic503"
"504":
$ref: "#/components/responses/Generic504"
/campaign/{sponsorId}/{campaignId}/active-sponsorship-list:
get:
summary: Query of Active Sponsorships
operationId: getActiveSponsorships
parameters:
- $ref: '#/components/parameters/x-correlator'
- $ref: '#/components/parameters/x-accessToken'
- name: sponsorId
in: path
description: Sponsor ID
required: true
schema:
$ref: '#/components/schemas/sponsorId'
- name: campaignId
in: path
description: ID de la campaña
required: true
schema:
$ref: '#/components/schemas/campaignId'
responses:
'200':
description: List of users currently sponsored by the campaign.
headers:
x-correlator:
$ref: '#/components/headers/x-correlator'
content:
application/json:
schema:
type: object
properties:
sponsorId:
$ref: '#/components/schemas/sponsorId'
campaignId:
$ref: '#/components/schemas/campaignId'
activeSponsorships:
type: array
items:
type: object
properties:
sessionId:
$ref: '#/components/schemas/sessionId'
phoneNumber:
$ref: "#/components/schemas/phoneNumber"
totalCount:
description: Total number of sponsored subscribers currently.
type: integer
example: 5000
example:
sponsorId: "3fa85f64-5717-4562-b3fc-2c963f66afaf@company.com"
campaignId: "3fa85f64-5717-4562-b3fc-2c963f663faf@company.com"
activeSponsorships:
- sessionId: "3fa85f64-5717-4562-b3fc-2c963f66afa6@company.com"
phoneNumber: "+541100000001"
- sessionId: "3fa85f64-5717-4562-b3fc-2c967f66afa6@company.com"
phoneNumber: "+541100000002"
- sessionId: "3fa85f64-5717-4562-b3fc-2c953f66afa6@company.com"
phoneNumber: "+541100000003"
totalCount: 3
"400":
$ref: "#/components/responses/Generic400"
"401":
$ref: "#/components/responses/Generic401"
"403":
$ref: "#/components/responses/Generic403"
"404":
$ref: "#/components/responses/Generic404"
"405":
$ref: "#/components/responses/Generic405"
"406":
$ref: "#/components/responses/Generic406"
"415":
$ref: "#/components/responses/Generic415"
"422":
$ref: "#/components/responses/Generic422"
"429":
$ref: "#/components/responses/Generic429"
"500":
$ref: "#/components/responses/Generic500"
"501":
$ref: "#/components/responses/Generic501"
"502":
$ref: "#/components/responses/Generic502"
"503":
$ref: "#/components/responses/Generic503"
"504":
$ref: "#/components/responses/Generic504"
/campaign/{sponsorId}/{campaignId}/alert-subscription:
post:
summary: Campaigns - Subscription to Alert y Notifications
description: >
This operation enables Sponsors (EPs) to subscribe to receive notifications related to campaigns. With the subscription, the EP provides a webhook URL and a token, which will be used by the API Gateway to send notifications related to the campaign.
In this API version, only two types of alerts are provided:
- Notification for consuming more than 80% of the contracted data volume.
- Notification for campaign validity expiration.
- Notification for campaign data volume exhausted.
- Alerts for network failures will be addressed in future versions.
operationId: configureAlerts
parameters:
- $ref: '#/components/parameters/x-correlator'
- $ref: '#/components/parameters/x-accessToken'
- name: sponsorId
in: path
required: true
schema:
$ref: '#/components/schemas/sponsorId'
- name: campaignId
in: path
required: true
schema:
$ref: '#/components/schemas/campaignId'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
webhookUrl:
$ref: '#/components/schemas/webhookUrl'
callbackToken:
type: string
description: Security token to authenticate notifications sent to the webhook.
alertDataVolumeThresholds:
type: boolean
description: Indicates whether a notification should be sent when data consumption exceeds 80% of the contracted amount (applicable for prepaid campaigns)..
example: true
campaignExpiryNotification:
type: boolean
description: Indicates whether a notification should be sent when the campaign expires.
example: true
dataVolumeExhausted:
type: boolean
description: Indicates whether a notification should be sent when the campaign data volume is exhausted.
example: true
callbacks:
notifications:
"{$request.body#/webhookUrl}":
post:
tags:
- Campaign notifications callback
summary: "Callback definition for campaign notifications (webhookUrl)"
description: >
This endpoint must be implemented by the API consumer. The server will send notifications to this URL with the token provided in the subscription to authenticate the request.
operationId: notifyCampaignEvent
parameters:
- $ref: '#/components/parameters/x-correlator'
- $ref: '#/components/parameters/x-callbackToken'
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CampaignNotification"
responses:
"204":
description: Successful notification
headers:
x-correlator:
$ref: '#/components/headers/x-correlator'
content:
application/json:
schema:
type: object
properties:
sponsorId:
$ref: '#/components/schemas/sponsorId'
campaignId:
$ref: '#/components/schemas/campaignId'
notifications:
enum:
- alertDataVolumeThresholds
- campaignExpiryNotification
- dataVolumeExhausted
"400":
$ref: "#/components/responses/Generic400"
"401":
$ref: "#/components/responses/Generic401"
"403":
$ref: "#/components/responses/Generic403"
"410":
$ref: "#/components/responses/Generic410"
"500":
$ref: "#/components/responses/Generic500"
"503":
$ref: "#/components/responses/Generic503"
responses:
'200':
description: Campaign notifications subscription - SUCCESS
headers:
x-correlator:
$ref: '#/components/headers/x-correlator'
content:
application/json:
schema:
type: object
properties:
sponsorId:
$ref: '#/components/schemas/sponsorId'
campaignId:
$ref: '#/components/schemas/campaignId'
requestResult:
type: string
example: "Campaign notifications subscription - SUCCESS"
"400":
$ref: "#/components/responses/Generic400"
"401":
$ref: "#/components/responses/Generic401"
"403":
$ref: "#/components/responses/Generic403"
"404":
$ref: "#/components/responses/Generic404"
"405":
$ref: "#/components/responses/Generic405"
"406":
$ref: "#/components/responses/Generic406"
"415":
$ref: "#/components/responses/Generic415"
"422":
$ref: "#/components/responses/Generic422"
"429":
$ref: "#/components/responses/Generic429"
"500":
$ref: "#/components/responses/Generic500"
"501":
$ref: "#/components/responses/Generic501"
"502":
$ref: "#/components/responses/Generic502"
"503":
$ref: "#/components/responses/Generic503"
"504":
$ref: "#/components/responses/Generic504"
/campaign/management:
post:
summary: Campaign Management
description: >
This operation allows pausing or resuming a campaign based on the action parameter provided in the request body. The possible values for action are:
- PAUSE to temporarily halt new sponsorships (ongoing sponsorships will continue until completion).
- RESUME to reactivate the campaign.
If the campaign has already ended, the API will respond with a 400 error, indicating that the campaign is finished and cannot be modified. Pausing a campaign does not extend its end date or overall duration.
operationId: manageCampaign
parameters:
- $ref: '#/components/parameters/x-correlator'
- $ref: '#/components/parameters/x-accessToken'
requestBody:
description: Parameters to manage the campaign.
required: true
content:
application/json:
schema:
type: object
properties:
sponsorId:
$ref: '#/components/schemas/sponsorId'
campaignId:
$ref: '#/components/schemas/campaignId'
action:
type: string
enum:
- pause
- resume
description: "The action to be performed on the campaign. It can be 'PAUSE' to pause or 'RESUME' to resume."
responses:
'200':
description: Successful operation
headers:
x-correlator:
$ref: '#/components/headers/x-correlator'
content:
application/json:
schema:
type: object
properties:
requestResult:
type: string
example: "CAMPAIGN PAUSED SUCCESSFULLY or CAMPAIGN RESUMED SUCCESSFULLY"
sponsorId:
$ref: '#/components/schemas/sponsorId'
campaignId:
$ref: '#/components/schemas/campaignId'
startTime:
$ref: "#/components/schemas/time"
description: The timestamp indicating when the requested action (PAUSE or RESUME) on the campaign takes effect (in ISO 8601 format).
status:
type: string
description: Current status of the campaign (e.g., "active", "paused", "completed").
enum:
- paused
- resumed
- completed
"400":
$ref: "#/components/responses/Generic400"
"401":
$ref: "#/components/responses/Generic401"
"403":
$ref: "#/components/responses/Generic403"
"404":
$ref: "#/components/responses/Generic404"
"405":
$ref: "#/components/responses/Generic405"
"406":
$ref: "#/components/responses/Generic406"
"415":
$ref: "#/components/responses/Generic415"
"422":
$ref: "#/components/responses/Generic422"
"429":
$ref: "#/components/responses/Generic429"
"500":
$ref: "#/components/responses/Generic500"
"501":
$ref: "#/components/responses/Generic501"
"502":
$ref: "#/components/responses/Generic502"
"503":
$ref: "#/components/responses/Generic503"
"504":
$ref: "#/components/responses/Generic504"
components:
parameters:
x-correlator:
name: x-correlator
in: header
description: Correlation identifier in UUID version 4 format
required: true
schema:
type: string
format: "uuid"
pattern: "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89aAbB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$" # UUID versión 4 regular expression
x-accessToken:
name: accessToken
in: header
description: Access token for the Sponsor.
required: true
schema:
type: string
x-callbackToken:
name: x-callbackToken
in: header
description: |
Security token for authenticating the notification. It must match the value provided in the callbackToken field of the initial sponsorship request body.
required: true
schema:
type: string
format: uri
example: https://tonys-server.com
headers:
x-correlator:
required: true
schema:
type: string
format: "uuid"
pattern: "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89aAbB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
schemas:
sponsorId:
type: string
description: Unique sponsor identifier, assigned by the API GW Platform operator. Should include a domain associated with the company for easy recognition.
pattern: "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$" # Excample 'ID@sponsor_domain.com'
campaignId:
type: string
description: "Unique identifier for the campaign, including a UUID and the sponsor's domain."
pattern: "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$" # Example "UUID@sponsor_domain.com"
phoneNumber:
description: A public identifier addressing a telephone subscription. In mobile networks it corresponds to the MSISDN (Mobile Station International Subscriber Directory Number). In order to be globally unique it has to be formatted in international format, according to E.164 standard, prefixed with '+'.
type: string
pattern: '^\+[1-9][0-9]{4,14}$'
example: "+123456789"
sessionId:
description: Unique session identifier, assigned by the API GW Platform operator. Should include a domain associated with the company for easy recognition.
type: string
format: uuid
pattern: "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$" # Example "UUID@sponsor_domain.com"
CampaignNotification:
type: object
properties:
api_version:
description: Data Sponsored API Version (must be 1.0.0)
type: string
enum:
- '1.0.0'
datacontenttype:
description: 'media-type that describes the event payload encoding, must be "application/json" for CAMARA APIs'
type: string
enum:
- 'application/json'
sponsorId:
$ref: '#/components/schemas/sponsorId'
campaignId:
type: string
description: "Identificador de la campaña."
eventType:
type: string
description: "Tipo de evento que desencadenó la notificación."
enum:
- DATA_VOLUME_THRESHOLD_EXCEEDED (80%)
- DATA_VOLUME_EXHASTED
- CAMPAIGN_EXPIRED
timestamp:
type: string
format: date-time
description: "Fecha y hora en que ocurrió el evento."
ErrorInfo:
description: The error object used for error-cases.
type: object
required:
- status
- code
- message
properties:
status:
type: integer
description: HTTP response status code
code:
type: string
description: Code given to this error
message:
type: string
description: Detailed error description
webhookUrl:
type: string
format: url
description: The URL to which notifications about session status changes will be sent using the HTTP protocol. (e.g., session termination)
example: "https://sponsor.endpoint.example.com/webhook"
SponsorshipEndNotification:
type: object
properties:
api_version:
description: Data Sponsored API Version (must be 1.0.0)
type: string
enum:
- '1.0.0'
datacontenttype:
description: media-type that describes the event payload encoding, must be "application/json" for CAMARA APIs
type: string
enum:
- 'application/json'
sponsorId:
$ref: '#/components/schemas/sponsorId'
campaignId:
$ref: '#/components/schemas/campaignId'
sessionId:
$ref: '#/components/schemas/sessionId'
reason:
type: string
description: Reason for the termination of the sponsorship.
enum:
- EXPIRED
- TERMINATED_BY_SPONSOR
- DATA_EXHAUSTED
- USER_DEREGISTERED
- NOT_AVAILABLE
endTimestamp:
type: string