-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathswagger-config.yaml
816 lines (816 loc) · 27.4 KB
/
swagger-config.yaml
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
openapi: 3.0.0
info:
version: 1.0.0
title: Consumer Complaint Database API
description: The API for searching the Consumer Complaint Database
termsOfService: 'https://cfpb.github.io/source-code-policy/'
contact:
name: Report API Issues
url: https://github.com/cfpb/ccdb5-api/issues
license:
name: Creative Commons License CC0
url: 'https://github.com/cfpb/ccdb5-api/blob/main/LICENSE'
paths:
/:
get:
tags:
- Complaints
summary: Search consumer complaints
description: Search the contents of the consumer complaint database
parameters:
- $ref: '#/components/parameters/search_term'
- $ref: '#/components/parameters/field'
- $ref: '#/components/parameters/from'
- $ref: '#/components/parameters/size'
- $ref: '#/components/parameters/sort'
- $ref: '#/components/parameters/format'
- $ref: '#/components/parameters/no_aggs'
- $ref: '#/components/parameters/no_highlight'
- $ref: '#/components/parameters/company'
- $ref: '#/components/parameters/company_public_response'
- $ref: '#/components/parameters/company_received_max'
- $ref: '#/components/parameters/company_received_min'
- $ref: '#/components/parameters/company_response'
- $ref: '#/components/parameters/consumer_consent_provided'
- $ref: '#/components/parameters/consumer_disputed'
- $ref: '#/components/parameters/date_received_max'
- $ref: '#/components/parameters/date_received_min'
- $ref: '#/components/parameters/has_narrative'
- $ref: '#/components/parameters/issue'
- $ref: '#/components/parameters/product'
- $ref: '#/components/parameters/state'
- $ref: '#/components/parameters/submitted_via'
- $ref: '#/components/parameters/tags'
- $ref: '#/components/parameters/timely'
- $ref: '#/components/parameters/zip_code'
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/SearchResult'
text/csv:
schema:
$ref: '#/components/schemas/SearchResult'
'400':
description: Invalid status value
/_suggest:
get:
tags:
- Typeahead
summary: Suggest possible searches
description: The endpoint for the main search box in the UI
parameters:
- $ref: '#/components/parameters/size'
- $ref: '#/components/parameters/suggest_text'
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/SuggestResult'
'400':
description: Invalid input
/_suggest_company:
get:
tags:
- Typeahead
summary: Suggest possible companies
description: Provide a list of companies that match the input text
parameters:
- $ref: '#/components/parameters/suggest_text'
- $ref: '#/components/parameters/size'
- $ref: '#/components/parameters/company_public_response'
- $ref: '#/components/parameters/company_received_max'
- $ref: '#/components/parameters/company_received_min'
- $ref: '#/components/parameters/company_response'
- $ref: '#/components/parameters/consumer_consent_provided'
- $ref: '#/components/parameters/consumer_disputed'
- $ref: '#/components/parameters/date_received_max'
- $ref: '#/components/parameters/date_received_min'
- $ref: '#/components/parameters/has_narrative'
- $ref: '#/components/parameters/issue'
- $ref: '#/components/parameters/product'
- $ref: '#/components/parameters/state'
- $ref: '#/components/parameters/submitted_via'
- $ref: '#/components/parameters/tags'
- $ref: '#/components/parameters/timely'
- $ref: '#/components/parameters/zip_code'
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/SuggestResult'
'400':
description: Invalid input
/_suggest_zip:
get:
tags:
- Typeahead
summary: Suggest possible zip codes
description: Provide a list of zip codes that match the input text
parameters:
- $ref: '#/components/parameters/suggest_text'
- $ref: '#/components/parameters/size'
- $ref: '#/components/parameters/company_public_response'
- $ref: '#/components/parameters/company_received_max'
- $ref: '#/components/parameters/company_received_min'
- $ref: '#/components/parameters/company_response'
- $ref: '#/components/parameters/consumer_consent_provided'
- $ref: '#/components/parameters/consumer_disputed'
- $ref: '#/components/parameters/date_received_max'
- $ref: '#/components/parameters/date_received_min'
- $ref: '#/components/parameters/has_narrative'
- $ref: '#/components/parameters/issue'
- $ref: '#/components/parameters/product'
- $ref: '#/components/parameters/state'
- $ref: '#/components/parameters/submitted_via'
- $ref: '#/components/parameters/tags'
- $ref: '#/components/parameters/timely'
- $ref: '#/components/parameters/zip_code'
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/SuggestResult'
'400':
description: Invalid input
'/{complaintId}':
get:
tags:
- Complaints
summary: Find consumer complaint by ID
description: Get complaint details for a specific ID
parameters:
- name: complaintId
in: path
description: ID of the complaint
required: true
schema:
type: integer
format: int64
minimum: 0
maximum: 9999999999
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Complaint'
'400':
description: Invalid ID supplied
'404':
description: Complaint not found
/geo/states:
get:
tags:
- Complaints
summary: Get the state-by-state information
description: Get complaint information broken down by states
parameters:
- $ref: '#/components/parameters/search_term'
- $ref: '#/components/parameters/field'
- $ref: '#/components/parameters/company'
- $ref: '#/components/parameters/company_public_response'
- $ref: '#/components/parameters/company_received_max'
- $ref: '#/components/parameters/company_received_min'
- $ref: '#/components/parameters/company_response'
- $ref: '#/components/parameters/consumer_consent_provided'
- $ref: '#/components/parameters/consumer_disputed'
- $ref: '#/components/parameters/date_received_max'
- $ref: '#/components/parameters/date_received_min'
- $ref: '#/components/parameters/has_narrative'
- $ref: '#/components/parameters/issue'
- $ref: '#/components/parameters/product'
- $ref: '#/components/parameters/state'
- $ref: '#/components/parameters/submitted_via'
- $ref: '#/components/parameters/tags'
- $ref: '#/components/parameters/timely'
- $ref: '#/components/parameters/zip_code'
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/StatesResult'
/trends:
get:
tags:
- Trends
summary: "List trends"
description: "Return specific aggregations for a search"
parameters:
- $ref: '#/components/parameters/search_term'
- $ref: '#/components/parameters/field'
- $ref: '#/components/parameters/company'
- $ref: '#/components/parameters/company_public_response'
- $ref: '#/components/parameters/company_received_max'
- $ref: '#/components/parameters/company_received_min'
- $ref: '#/components/parameters/company_response'
- $ref: '#/components/parameters/consumer_consent_provided'
- $ref: '#/components/parameters/consumer_disputed'
- $ref: '#/components/parameters/date_received_max'
- $ref: '#/components/parameters/date_received_min'
- $ref: '#/components/parameters/focus'
- $ref: '#/components/parameters/has_narrative'
- $ref: '#/components/parameters/issue'
- $ref: '#/components/parameters/lens'
- $ref: '#/components/parameters/product'
- $ref: '#/components/parameters/state'
- $ref: '#/components/parameters/submitted_via'
- $ref: '#/components/parameters/sub_lens'
- $ref: '#/components/parameters/sub_lens_depth'
- $ref: '#/components/parameters/tags'
- $ref: '#/components/parameters/timely'
- $ref: '#/components/parameters/trend_depth'
- $ref: '#/components/parameters/trend_interval'
- $ref: '#/components/parameters/zip_code'
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/TrendsResult'
text/csv:
schema:
$ref: '#/components/schemas/TrendsResult'
'400':
description: Invalid status value
tags:
- name: Complaints
description: These endpoints provide access to consumer complaints
- name: Trends
description: These endpoints provide access aggregated consumer complaint data
- name: Typeahead
description: These endpoints support the typeahead boxes in the UI
externalDocs:
description: Additional API Information
url: 'https://cfpb.github.io/api/ccdb/'
servers:
- url: 'https://www.consumerfinance.gov/data-research/consumer-complaints/search/api/v1/'
components:
parameters:
company:
name: company
in: query
description: Filter the results to only return these companies
explode: true
schema:
type: array
items:
type: string
company_public_response:
name: company_public_response
in: query
description: Filter the results to only return these types of public response by the company
explode: true
schema:
type: array
items:
type: string
company_received_max:
name: company_received_max
in: query
description: Return results with date < company_received_max (i.e. 2017-03-04)
schema:
type: string
format: date
company_received_min:
name: company_received_min
in: query
description: Return results with date >= company_received_min (i.e. 2017-03-04)
schema:
type: string
format: date
company_response:
name: company_response
in: query
description: Filter the results to only return these types of response by the company
explode: true
schema:
type: array
items:
type: string
consumer_consent_provided:
name: consumer_consent_provided
in: query
description: Filter the results to only return these types of consent consumer provided
explode: true
schema:
type: array
items:
type: string
consumer_disputed:
name: consumer_disputed
in: query
description: Filter the results to only return the specified state of consumer disputed, i.e. yes, no
explode: true
schema:
type: array
items:
type: string
date_received_max:
name: date_received_max
in: query
description: Return results with date < date_received_max (i.e. 2017-03-04)
schema:
type: string
format: date
date_received_min:
name: date_received_min
in: query
description: Return results with date >= date_received_min (i.e. 2017-03-04)
schema:
type: string
format: date
field:
name: field
in: query
description: If the parameter "search_term" has a value, use "field" to specify which field is searched. If not specified, "complaint_what_happened" will be searched.
schema:
type: string
enum:
- complaint_what_happened
- company_public_response
- all
default: complaint_what_happened
focus:
name: focus
in: query
description: The name of the product or company on which to focus charts for products and issues
explode: true
schema:
type: array
items:
type: string
format:
name: format
in: query
description: Format to be returned, if this parameter is not specified, frm/size parameters can be used properly, but if a format is specified for exporting, frm/size will be ignored
schema:
type: string
enum:
- json
- csv
default: json
from:
name: frm
in: query
description: Return results starting from a specific index, only if format parameter is not specified, ignore otherwise
schema:
type: integer
format: int64
minimum: 1
maximum: 100000
default: 0
has_narrative:
name: has_narrative
in: query
description: Filter the results to only return the specified state of whether it has narrative in the complaint or not, i.e. yes, no
explode: true
schema:
type: array
items:
type: string
issue:
name: issue
in: query
description: 'Filter the results to only return these types of issue and subissue, i.e. product-only: Getting a Loan, subproduct needs to include product, separated by ''•'', Getting a Loan•Can''t qualify for a loan'
explode: true
schema:
type: array
items:
type: string
lens:
name: lens
in: query
required: true
description: The data lens through which to view complaint trends over time.
schema:
type: string
enum:
- overview
- issue
- product
- tags
default: overview
no_aggs:
name: no_aggs
in: query
description: Include aggregations in result or not, True means no aggregations will be included, False means aggregations will be included.
schema:
type: boolean
default: false
no_highlight:
name: no_highlight
in: query
description: Include highlight of search term in result or not, True means no highlighting will be included, False means highlighting will be included.
schema:
type: boolean
default: false
product:
name: product
in: query
description: 'Filter the results to only return these types of product and subproduct, i.e. product-only: Mortgage, subproduct needs to include product, separated by ''•'', Mortgage•FHA mortgage'
explode: true
schema:
type: array
items:
type: string
search_term:
name: search_term
in: query
description: Return results containing specific term
schema:
type: string
size:
name: size
in: query
description: Limit the size of the results
schema:
type: integer
format: int64
minimum: 1
maximum: 100
default: 10
sort:
name: sort
in: query
description: Return results sort in a particular order
schema:
type: string
enum:
- relevance_desc
- relevance_asc
- created_date_desc
- created_date_asc
default: relevance_desc
state:
name: state
in: query
description: Filter the results to only return these states (use abbreviation, i.e. CA, VA)
explode: true
schema:
type: array
items:
type: string
sub_lens:
name: sub_lens
in: query
description: The sub-lens through which to view complaint trends over time.
schema:
type: string
enum:
- issue
- product
- sub_product
- sub_issue
- tags
sub_lens_depth:
name: sub_lens_depth
in: query
description: The top X trend sub aggregations will be returned, where X is the supplied sub_lens_depth.
schema:
type: integer
maximum: 10000000
minimum: 5
format: int64
default: 10
submitted_via:
name: submitted_via
in: query
description: Filter the results to only return these types of way consumers submitted their complaints
explode: true
schema:
type: array
items:
type: string
suggest_text:
name: text
in: query
description: text to use for suggestions
required: true
schema:
type: string
tags:
name: tags
in: query
description: Filter the results to only return these types of tag
explode: true
schema:
type: array
items:
type: string
timely:
name: timely
in: query
description: Filter the results to show whether a response was timely
explode: true
schema:
type: array
items:
type: string
trend_depth:
name: trend_depth
in: query
description: The top X trend aggregations will be returned, where X is the supplied trend_depth.
schema:
type: integer
maximum: 10000000
minimum: 5
format: int64
default: 10
trend_interval:
name: trend_interval
in: query
description: The interval of time to use for trends aggregations histograms. When using day intervals, we recommend querying for date_received_min / max periods of less than one year.
required: true
schema:
type: string
enum:
- year
- quarter
- month
- week
- day
zip_code:
name: zip_code
in: query
description: Filter the results to only return these zip codes
explode: true
schema:
type: array
items:
type: string
schemas:
Aggregation:
type: object
description: An Elasticsearch aggregation
properties:
doc_count:
type: integer
description: The total number of complaints covered in this aggregation
field:
type: object
description: The name of the ` being aggregated
properties:
buckets:
type: array
items:
$ref: '#/components/schemas/Bucket'
doc_count_error_upper_bound:
type: integer
description: The number of possible errors that occurred when searching the shards
sum_other_doc_count:
type: integer
description: The number of complaints that were not included in this aggregation.
AggregationDate:
type: object
properties:
value_as_string:
type: string
format: date-time
description: ISO-8601 formatted date (yyyy-mm-ddTHH:MM:SSZZ)
value:
type: number
description: Seconds since 1970 (Unix Epoch)
Bucket:
type: object
properties:
doc_count:
type: integer
description: The number of complaints that match this key
key:
type: string
Complaint:
type: object
externalDocs:
description: Official documentation
url: 'https://cfpb.github.io/api/ccdb/fields.html'
properties:
company:
type: string
description: The complaint is about this company
company_public_response:
type: string
description: 'The company''s optional, public-facing response to a consumer''s complaint'
company_response:
type: string
description: The response from the company about this complaint
complaint_id:
type: integer
description: The unique identification number for a complaint
complaint_what_happened:
type: string
description: A description of the complaint provided by the consumer
consumer_consent_provided:
type: string
description: Identifies whether the consumer opted in to publish their complaint narrative
consumer_disputed:
type: string
description: Whether the consumer disputed the company's response
date_received:
type: string
format: date
description: The date the CFPB received the complaint
date_sent_to_company:
type: string
description: The date the CFPB sent the complaint to the company
has_narrative:
type: boolean
description: Indicates this complaint has a narrative
issue:
type: string
description: The issue the consumer identified in the complaint
product:
type: string
description: The type of product the consumer identified in the complaint
state:
type: string
description: The state of the mailing address provided by the consumer
sub_issue:
type: string
description: The sub-issue the consumer identified in the complaint
sub_product:
type: string
description: The type of sub-product the consumer identified in the complaint
submitted_via:
type: string
description: How the complaint was submitted to the CFPB
tags:
type: string
description: Data that supports easier searching and sorting of complaints
timely:
type: string
description: Indicates whether the company gave a timely response or not
zip_code:
type: string
description: The mailing ZIP code provided by the consumer
Hit:
type: object
description: A single Elasticsearch result
properties:
_source:
$ref: '#/components/schemas/Complaint'
Hits:
type: object
description: A set of complaints that matched the query
properties:
hits:
type: array
items:
$ref: '#/components/schemas/Hit'
max_score:
type: number
description: The highest score in the results
format: float
total:
type: object
properties:
value:
type: integer
description: "The count of matching hits, accurate in our code even above 10,000 hits"
relation:
type: string
description: "Indicates the accuracy of the default ES response, whether the value is accurate (eq) or a lower bound (gte)"
Meta:
type: object
properties:
has_data_issue:
type: boolean
description: Indicates there has been an issue with the most recent data load
is_data_stale:
type: boolean
description: Indicates the most recent data is over 5 business days old
is_narrative_stale:
type: boolean
description: Indicates the most recent narratives are over 5 busines days old
last_indexed:
type: string
description: The timestamp of the most recently indexed complaint
format: dateTime
last_updated:
type: string
description: The timestamp of the most recent complaint
format: dateTime
license:
type: string
description: The open source license under which the API operates
total_record_count:
type: integer
description: The total number of complaints currently indexed
MultiLevelAggregation:
properties:
doc_count:
type: integer
description: The total number of complaints covered in this aggregation
field:
type: object
description: The name of the field being aggregated
properties:
buckets:
type: array
items:
$ref: '#/components/schemas/MultiLevelBucket'
doc_count_error_upper_bound:
type: integer
description: The number of possible errors that occurred when searching the shards
sum_other_doc_count:
type: integer
description: The number of complaints that were not included in this aggregation.
MultiLevelBucket:
type: object
properties:
doc_count:
type: integer
description: The number of complaints that match this key
field.raw:
type: object
description: The next level of aggregations
properties:
buckets:
type: array
items:
$ref: '#/components/schemas/Aggregation'
key:
type: string
SearchResult:
type: object
properties:
_meta:
$ref: '#/components/schemas/Meta'
aggregations:
type: object
properties:
company_public_response:
$ref: '#/components/schemas/Aggregation'
company_response:
$ref: '#/components/schemas/Aggregation'
consumer_consent_provided:
$ref: '#/components/schemas/Aggregation'
consumer_disputed:
$ref: '#/components/schemas/Aggregation'
has_narrative:
$ref: '#/components/schemas/Aggregation'
issue:
$ref: '#/components/schemas/MultiLevelAggregation'
product:
$ref: '#/components/schemas/MultiLevelAggregation'
state:
$ref: '#/components/schemas/Aggregation'
submitted_via:
$ref: '#/components/schemas/Aggregation'
tags:
$ref: '#/components/schemas/Aggregation'
timely:
$ref: '#/components/schemas/Aggregation'
zip_code:
$ref: '#/components/schemas/Aggregation'
hits:
$ref: '#/components/schemas/Hits'
StatesResult:
type: object
properties:
aggregations:
type: object
properties:
issue:
$ref: '#/components/schemas/MultiLevelAggregation'
product:
$ref: '#/components/schemas/MultiLevelAggregation'
state:
$ref: '#/components/schemas/MultiLevelAggregation'
SuggestResult:
type: array
items:
type: string
TrendsResult:
type: object
properties:
aggregations:
type: object
properties:
company:
$ref: '#/components/schemas/MultiLevelAggregation'
issue:
$ref: '#/components/schemas/MultiLevelAggregation'
product:
$ref: '#/components/schemas/MultiLevelAggregation'
sub_issue:
$ref: '#/components/schemas/MultiLevelAggregation'
sub_product:
$ref: '#/components/schemas/MultiLevelAggregation'
tags:
$ref: '#/components/schemas/MultiLevelAggregation'
links: {}
callbacks: {}
security: []