-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapi-docs.php
More file actions
4507 lines (3966 loc) · 210 KB
/
Copy pathapi-docs.php
File metadata and controls
4507 lines (3966 loc) · 210 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
<?php
// Initialize
$guest = true;
include_once $_SERVER["DOCUMENT_ROOT"] . '/classes/initialize.php';
// HTML Head
$htmlHead = new htmlHead('API Documentation');
$htmlHead->addStylesheet('/assets/css/api-docs.css');
echo $htmlHead->html;
?>
<body data-bs-spy="scroll" data-bs-target="#ad-toc" data-bs-root-margin="0px 0px -55%">
<?php
// Navbar
echo $nav->navbar('');
?>
<div class="cb-page">
<div class="ad-layout">
<button class="ad-toc-toggle d-lg-none" type="button" data-bs-toggle="collapse" data-bs-target="#ad-toc" aria-expanded="false" aria-controls="ad-toc">On this page</button>
<nav class="ad-toc collapse d-lg-block" id="ad-toc" aria-label="API reference sections">
<div class="list-group">
<a class="list-group-item list-group-item-action" href="#url"><strong>API Basics</strong></a>
<a class="list-group-item list-group-item-action" href="#authentication"><strong>Authentication</strong></a>
<a class="list-group-item list-group-item-action" href="#errors"><strong>Errors</strong></a>
<a class="list-group-item list-group-item-action" href="#http-methods"><strong>HTTP Methods</strong></a>
<a class="list-group-item list-group-item-action" href="#brewer"><strong>Brewer</strong></a>
<a class="list-group-item list-group-item-action" href="#brewer-object">> Brewer Object</a>
<a class="list-group-item list-group-item-action" href="#brewer-create">> Add a Brewer</a>
<a class="list-group-item list-group-item-action" href="#brewer-update">> Update a Brewer (PUT)</a>
<a class="list-group-item list-group-item-action" href="#brewer-patch">> Update a Brewer (PATCH)</a>
<a class="list-group-item list-group-item-action" href="#brewer-delete">> Delete a Brewer</a>
<a class="list-group-item list-group-item-action" href="#brewer-retrieve">> Retrieve a Brewer</a>
<a class="list-group-item list-group-item-action" href="#brewer-list-all">> List all Brewers</a>
<a class="list-group-item list-group-item-action" href="#brewer-count">> Number of Brewers</a>
<a class="list-group-item list-group-item-action" href="#brewer-search">> Search Brewers</a>
<a class="list-group-item list-group-item-action" href="#brewer-beers">> List all Beers made by a Brewer</a>
<a class="list-group-item list-group-item-action" href="#brewer-locations">> List all the Locations for a Brewer</a>
<a class="list-group-item list-group-item-action" href="#brewer-permissions">> Your Permissions for a Brewer</a>
<a class="list-group-item list-group-item-action" href="#beer"><strong>Beer</strong></a>
<a class="list-group-item list-group-item-action" href="#beer-object">> Beer Object</a>
<a class="list-group-item list-group-item-action" href="#beer-create">> Add a Beer</a>
<a class="list-group-item list-group-item-action" href="#beer-update">> Update a Beer (PUT)</a>
<a class="list-group-item list-group-item-action" href="#beer-patch">> Update a Beer (PATCH)</a>
<a class="list-group-item list-group-item-action" href="#beer-delete">> Delete a Beer</a>
<a class="list-group-item list-group-item-action" href="#beer-retrieve">> Retrieve a Beer</a>
<a class="list-group-item list-group-item-action" href="#beer-list-all">> List all Beer</a>
<a class="list-group-item list-group-item-action" href="#beer-count">> Number of Beers</a>
<a class="list-group-item list-group-item-action" href="#beer-search">> Search Beer</a>
<a class="list-group-item list-group-item-action" href="#styles"><strong>Styles</strong></a>
<a class="list-group-item list-group-item-action" href="#style-confidence">> Style Confidence</a>
<a class="list-group-item list-group-item-action" href="#style-object">> The Style Object</a>
<a class="list-group-item list-group-item-action" href="#style-list">> List Styles</a>
<a class="list-group-item list-group-item-action" href="#style-detail">> Retrieve a Style</a>
<a class="list-group-item list-group-item-action" href="#style-search">> Search Styles</a>
<a class="list-group-item list-group-item-action" href="#style-parents">> List Families</a>
<a class="list-group-item list-group-item-action" href="#style-classes">> List Classes</a>
<a class="list-group-item list-group-item-action" href="#location"><strong>Location</strong></a>
<a class="list-group-item list-group-item-action" href="#location-object">> The Location Object</a>
<a class="list-group-item list-group-item-action" href="#location-add">> Add a Location</a>
<a class="list-group-item list-group-item-action" href="#location-update">> Update a Location (PUT)</a>
<a class="list-group-item list-group-item-action" href="#location-patch">> Update a Location (PATCH)</a>
<a class="list-group-item list-group-item-action" href="#location-delete">> Delete a Location</a>
<a class="list-group-item list-group-item-action" href="#location-add-address">> Add an Address to a Location</a>
<a class="list-group-item list-group-item-action" href="#location-replace-address">> Replace an Address (PUT)</a>
<a class="list-group-item list-group-item-action" href="#location-retrieve">> Retrieve a Location</a>
<a class="list-group-item list-group-item-action" href="#location-list-all">> List all Locations</a>
<a class="list-group-item list-group-item-action" href="#nearby-locations">> Find Nearby Locations</a>
<a class="list-group-item list-group-item-action" href="#location-zip">> Find Locations by ZIP Code</a>
<a class="list-group-item list-group-item-action" href="#location-city">> Find Locations by City</a>
<a class="list-group-item list-group-item-action" href="#usage"><strong>Usage</strong></a>
<a class="list-group-item list-group-item-action" href="#usage-object">> The Usage Object</a>
<a class="list-group-item list-group-item-action" href="#usage-my-usage">> Get My Usage</a>
<a class="list-group-item list-group-item-action" href="#billing"><strong>Billing</strong></a>
<a class="list-group-item list-group-item-action" href="#billing-object">> The Billing Object</a>
<a class="list-group-item list-group-item-action" href="#billing-retrieve">> Get Billing Status</a>
<a class="list-group-item list-group-item-action" href="#billing-checkout-session">> Create a Checkout Session</a>
<a class="list-group-item list-group-item-action" href="#billing-portal-session">> Create a Portal Session</a>
<a class="list-group-item list-group-item-action" href="#billing-update">> Update Spend Cap</a>
<a class="list-group-item list-group-item-action" href="#billing-disable">> Disable Billing</a>
<a class="list-group-item list-group-item-action" href="#us-address"><strong>US Addresses</strong></a>
<a class="list-group-item list-group-item-action" href="#us-address-object">> The US Address Object</a>
<a class="list-group-item list-group-item-action" href="#users"><strong>Users</strong></a>
<a class="list-group-item list-group-item-action" href="#users-object">> The User Object</a>
<a class="list-group-item list-group-item-action" href="#users-retrieve">> Retrieve a User</a>
<a class="list-group-item list-group-item-action" href="#users-api-key">> Get API Key</a>
<a class="list-group-item list-group-item-action" href="#users-patch">> Update a User (PATCH)</a>
<a class="list-group-item list-group-item-action" href="#users-delete">> Delete a User</a>
<a class="list-group-item list-group-item-action" href="#users-reset-password">> Request Password Reset</a>
<a class="list-group-item list-group-item-action" href="#users-password-reset">> Reset Password</a>
</div>
</nav>
<div class="ad-content">
<h1 id="top">API Reference</h1>
<p>Last Updated: August 3, 2026</p>
<h2 id="url">API Basics</h2>
<hr>
<p>The Catalog.beer API is organized around REST. We use HTTP response codes to indicate the success or failure of your request. We also use basic HTTP features like HTTP authentication and HTTP verbs.</p>
<p>The Catalog.beer API can be accessed using the following root URL:</p>
<pre class="api-code">https://api.catalog.beer</pre>
<p>When making an API request, be sure to include an <code>accept: application/json</code> header. All data returned by the API will be in JSON format.</p>
<p>Similarly, when making a PUT or POST request to the API, the body of your request must be in JSON as well. Be sure to include the <code>content-type: application/json</code> header in your request.</p>
<h2 id="authentication">Authentication</h2>
<hr>
<p>Authenticate your account when using the API by including your secret API key in the request. You can find your API key on your <a href="/account">Account</a> page. Your API key carries many privileges, so be sure to keep it secret! Do not share your secret API key in publicly accessible areas such GitHub, client-side code, and so forth.</p>
<p>Authentication to the API is performed via the <a href="https://en.wikipedia.org/wiki/Basic_access_authentication" target="_blank" rel="noopener">'Basic' HTTP authentication</a> scheme. <strong>Provide your API key as the username value.</strong> You do not need to provide a password.</p>
<p>When making a request using basic HTTP authentication, your request should contain a header field in the form of <code>Authorization: Basic <credentials></code>, where <code><credentials></code> is the <code>base64_encode('username:password')</code> (Recall that your username in this case is your API Key and the password field should be left blank).</p>
<p>For example, if your API Key is: <code>cadcbe6f-a80d-4e33-9f20-b53c2ed83845</code></p>
<pre class="api-code">base64_encode('cadcbe6f-a80d-4e33-9f20-b53c2ed83845:')</pre>
<p>Returning: <code>Y2FkY2JlNmYtYTgwZC00ZTMzLTlmMjAtYjUzYzJlZDgzODQ1Og==</code></p>
<p>Then your cURL request will look something like:</p>
<pre class="api-code">curl --location --request GET 'https://api.catalog.beer/brewer'
--header 'Accept: application/json'
--header 'Authorization: Basic Y2FkY2JlNmYtYTgwZC00ZTMzLTlmMjAtYjUzYzJlZDgzODQ1Og=='
</pre>
<p>All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.</p>
<h2 id="errors">Errors</h2>
<hr>
<p>Catalog.beer uses conventional HTTP response codes to indicate the success or failure of an API request. In general, codes in the <var>2xx</var> range indicate success, codes in the <var>4xx</var> range indicate an error that failed given the information provided (e.g., a required parameter was omitted), and codes in the <var>5xx</var> range indicate an error with Catalog.beer’s servers.</p>
<p>The following parameters are returned in JSON format when an error occurs</p>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th scope="col">Parameter</th>
<th scope="col">Type</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><var>error</var></td>
<td>Boolean</td>
<td><var>true</var> or <var>false</var>. Indicates an error occurred in processing your request.</td>
</tr>
<tr>
<td><var>error_msg</var><br><small class="text-muted">(optional)</small></td>
<td>string</td>
<td>A message relaying additional information about the error.</td>
</tr>
<tr>
<td><var>valid_state</var><br><small class="text-muted">(optional)</small></td>
<td>array</td>
<td>An array containing the attribute names and their validation state. A field’s state is binary: either ‘valid’ or ‘invalid’. You can use this parameter to help target which attributes are invalid. ‘valid’ means the field passed validation — not that it was saved. When any attribute is ‘invalid’ the whole write is rejected and nothing is stored.</td>
</tr>
<tr>
<td><var>valid_msg</var><br><small class="text-muted">(optional)</small></td>
<td>array</td>
<td>An array containing the attribute names and the corresponding error message for that attribute. You can use this information to show help text next to the attributes that were invalid.</td>
</tr>
<tr>
<td><var>suggestions</var><br><small class="text-muted">(optional)</small></td>
<td>array</td>
<td>Keyed by attribute name, like <var>valid_state</var> and <var>valid_msg</var>. Where we can work out what an invalid value probably meant, this carries the values that would fix it, so you can retry without a second lookup. Present only when we have candidates — always treat it as optional. Currently returned for <var>style</var> on <a href="#beer">/beer</a> writes; see <a href="#styles">Styles</a>.</td>
</tr>
</tbody>
</table>
</div>
<p>Sample error JSON returned for a POST request to /brewer:</p>
<pre class="api-code">
{
"error": true,
"error_msg": "",
"valid_state": {
"name": "invalid",
"url": "valid",
"description": "valid",
"short_description": "valid"
},
"valid_msg": {
"name": "Please give us the name of the brewery you'd like to add.",
"url": "",
"description": "",
"short_description": ""
}
}
</pre>
<p><a href="#top">^ Return to top</a></p>
<h2 id="http-methods">HTTP Methods</h2>
<hr>
<p>The Catalog.beer API supports the following HTTP methods for creating, reading, updating, and deleting resources.</p>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th scope="col">Method</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>GET</strong></td>
<td>Retrieve a resource or list of resources.</td>
</tr>
<tr>
<td><strong>POST</strong></td>
<td>Create a new resource.</td>
</tr>
<tr>
<td><strong>PUT</strong></td>
<td>Full replacement of a resource. All required fields must be present. Omitted optional fields are <strong>cleared to null</strong>. If the resource does not exist, it will be created (returns <var>201 Created</var>). If the resource already exists, it will be replaced (returns <var>200 OK</var>).</td>
</tr>
<tr>
<td><strong>PATCH</strong></td>
<td>Partial update of a resource. Only the fields you provide will be modified; all other fields remain unchanged. The resource must already exist (returns <var>404 Not Found</var> otherwise). A PATCH is applied <strong>all or nothing</strong>: if any field in the request fails validation, the response is a <var>400 Bad Request</var> and none of the fields are written — including the ones <var>valid_state</var> reports as valid.</td>
</tr>
<tr>
<td><strong>DELETE</strong></td>
<td>Remove a resource. Returns <var>204 No Content</var> with no response body on success.</td>
</tr>
</tbody>
</table>
</div>
<p>If you send a request using an HTTP method that is not supported by the endpoint, the API will return a <var>405 Method Not Allowed</var> response. The <code>Allow</code> header on the response will list the methods that the endpoint does support.</p>
<p><a href="#top">^ Return to top</a></p>
<h2 id="brewer">Brewer</h2>
<hr>
<p>The brewer object is the central piece of the beer data puzzle. Brewers can have beers and locations associated with them. And in order to add a beer or location to the database, there must be a brewer to associate them with.</p>
<h3 id="brewer-object">The Brewer Object</h3>
<p>Whether you’re retrieving information on a specific brewer, adding a new brewer, or updating an existing brewer, successful requests will return the brewer object in JSON format. That object has the following parameters.</p>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th scope="col">Parameter</th>
<th scope="col">Type</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><var>id</var></td>
<td>string</td>
<td>The brewer_id; a unique identifier for the brewer.</td>
</tr>
<tr>
<td><var>object</var></td>
<td>string</td>
<td>The name of the object. In this case: “brewer”.</td>
</tr>
<tr>
<td><var>name</var></td>
<td>string</td>
<td>The name of the brewer.</td>
</tr>
<tr>
<td><var>description</var></td>
<td>string</td>
<td>A description of the brewer. Plain text, which may contain new line characters — those are meaningful and worth preserving. It is not markup: catalog.beer displays it as written, with line breaks kept and nothing else interpreted.</td>
</tr>
<tr>
<td><var>short_description</var></td>
<td>string</td>
<td>A short, max 160 character, description of the brewer.</td>
</tr>
<tr>
<td><var>url</var></td>
<td>string</td>
<td>The URL of the brewer’s website.</td>
</tr>
<tr>
<td><var>cb_verified</var></td>
<td>Boolean</td>
<td>A <var>true</var> or <var>false</var> value denoting whether or not a Catalog.beer administrator has verified the brewer’s information.</td>
</tr>
<tr>
<td><var>brewer_verified</var></td>
<td>Boolean</td>
<td>A <var>true</var> or <var>false</var> value denoting whether or not the brewer themselves has contributed and verified their information.</td>
</tr>
<tr>
<td><var>last_modified</var></td>
<td>integer</td>
<td>A Unix timestamp indicating when the brewer was last modified.</td>
</tr>
</tbody>
</table>
</div>
<h4>Sample</h4>
<pre class="api-code">
{
"id": "ce7d83f5-0c3d-42f4-9162-ca97019e89d1",
"object": "brewer",
"name": "HopSaint Brewing Company",
"description": "HopSaint was born after one too many late nights navigating a crowded bar just to have a great beer unceremoniously poured into a dirty pint glass. We believe fresh draft beer shouldn't be confined to the pub. You should choose when, where, how, and with whom you enjoy a fresh, crafted beer. That's at the heart of HopSaint - a community that fosters lasting relationships & enriches our hometown through the production of honest, real beer. A community built on craft beer.",
"short_description": "A brewery in Torrance, CA.",
"url": "https://www.hopsaint.com/",
"cb_verified": true,
"brewer_verified": false,
"last_modified": 1783639445
}
</pre>
<p><a href="#top">^ Return to top</a></p>
<h3 id="brewer-create">Add a Brewer</h3>
<p>To add a brewer, send a <strong>POST</strong> request to the <code>/brewer</code> endpoint with the following parameters encoded in the body of the request as JSON. Successful requests will return a <a href="#brewer-object">brewer object</a>.</p>
<pre class="api-code">POST https://api.catalog.beer/brewer</pre>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th scope="col">Parameter</th>
<th scope="col">Type</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><var>name</var></td>
<td>string</td>
<td>The name of the brewer.</td>
</tr>
<tr>
<td><var>description</var><br><small class="text-muted">(optional)</small></td>
<td>string</td>
<td>A description of the brewer. This should be like the “About” page posted by the brewer. A brief origin story coupled with who they are. Send plain text: we store the bytes you send, and catalog.beer displays them with your line breaks kept. Markup is not interpreted, so formatting syntax will show up literally.</td>
</tr>
<tr>
<td><var>short_description</var><br><small class="text-muted">(optional)</small></td>
<td>string</td>
<td>A short description of the brewer; max 160 characters. Describe the brewer as you might in a tweet. Short and sweet.</td>
</tr>
<tr>
<td><var>url</var><br><small class="text-muted">(optional)</small></td>
<td>string</td>
<td>The URL of the brewer’s website.</td>
</tr>
</tbody>
</table>
</div>
<h4>Sample Request</h4>
<pre class="api-code">
curl -X POST \
https://api.catalog.beer/brewer \
-H 'accept: application/json' \
-H 'authorization: Basic {secret_key}' \
-H 'content-type: application/json' \
-d '{"name":"HopSaint Brewing Company","description":"HopSaint was born after one too many late nights navigating a crowded bar just to have a great beer unceremoniously poured into a dirty pint glass. We believe fresh draft beer shouldn\u0027t be confined to the pub. You should choose when, where, how, and with whom you enjoy a fresh, crafted beer. That\u0027s at the heart of HopSaint - a community that fosters lasting relationships & enriches our hometown through the production of honest, real beer. A community built on craft beer.","short_description":"A brewery in Torrance, CA.","url":"https://www.hopsaint.com/"}'
</pre>
<p><a href="#top">^ Return to top</a></p>
<h3 id="brewer-update">Update a Brewer (PUT)</h3>
<p>To replace a brewer’s data, send a <strong>PUT</strong> request to the <code>/brewer</code> endpoint with the <var>brewer_id</var> appended to the path. All required fields must be present. Omitted optional fields will be cleared to null. If the brewer does not exist, it will be created and a <var>201 Created</var> response will be returned. Successful requests return a <a href="#brewer-object">brewer object</a>.</p>
<pre class="api-code">PUT https://api.catalog.beer/brewer/{brewer_id}</pre>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th scope="col">Parameter</th>
<th scope="col">Type</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><var>name</var></td>
<td>string</td>
<td>The name of the brewer.</td>
</tr>
<tr>
<td><var>description</var><br><small class="text-muted">(optional)</small></td>
<td>string</td>
<td>A description of the brewer. Cleared if omitted.</td>
</tr>
<tr>
<td><var>short_description</var><br><small class="text-muted">(optional)</small></td>
<td>string</td>
<td>A short description of the brewer; max 160 characters. Cleared if omitted.</td>
</tr>
<tr>
<td><var>url</var><br><small class="text-muted">(optional)</small></td>
<td>string</td>
<td>The URL of the brewer’s website. Cleared if omitted.</td>
</tr>
</tbody>
</table>
</div>
<h4>Sample Request</h4>
<pre class="api-code">
curl -X PUT \
https://api.catalog.beer/brewer/ce7d83f5-0c3d-42f4-9162-ca97019e89d1 \
-H 'accept: application/json' \
-H 'authorization: Basic {secret_key}' \
-H 'content-type: application/json' \
-d '{"name":"HopSaint Brewing Company","description":"HopSaint was born after one too many late nights navigating a crowded bar just to have a great beer unceremoniously poured into a dirty pint glass. We believe fresh draft beer shouldn\u0027t be confined to the pub. You should choose when, where, how, and with whom you enjoy a fresh, crafted beer. That\u0027s at the heart of HopSaint - a community that fosters lasting relationships & enriches our hometown through the production of honest, real beer. A community built on craft beer.","short_description":"A brewery in Torrance, CA.","url":"https://www.hopsaint.com/"}'
</pre>
<p><a href="#top">^ Return to top</a></p>
<h3 id="brewer-patch">Update a Brewer (PATCH)</h3>
<p>To partially update a brewer, send a <strong>PATCH</strong> request to the <code>/brewer</code> endpoint with the <var>brewer_id</var> appended to the path. Only the fields you include will be updated; all other fields remain unchanged. Successful requests return a <a href="#brewer-object">brewer object</a>.</p>
<pre class="api-code">PATCH https://api.catalog.beer/brewer/{brewer_id}</pre>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th scope="col">Parameter</th>
<th scope="col">Type</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><var>name</var><br><small class="text-muted">(optional)</small></td>
<td>string</td>
<td>The name of the brewer.</td>
</tr>
<tr>
<td><var>description</var><br><small class="text-muted">(optional)</small></td>
<td>string</td>
<td>A description of the brewer.</td>
</tr>
<tr>
<td><var>short_description</var><br><small class="text-muted">(optional)</small></td>
<td>string</td>
<td>A short description of the brewer; max 160 characters.</td>
</tr>
<tr>
<td><var>url</var><br><small class="text-muted">(optional)</small></td>
<td>string</td>
<td>The URL of the brewer’s website.</td>
</tr>
</tbody>
</table>
</div>
<h4>Sample Request</h4>
<pre class="api-code">
curl -X PATCH \
https://api.catalog.beer/brewer/ce7d83f5-0c3d-42f4-9162-ca97019e89d1 \
-H 'accept: application/json' \
-H 'authorization: Basic {secret_key}' \
-H 'content-type: application/json' \
-d '{"short_description":"A brewery in Torrance, CA."}'
</pre>
<p><a href="#top">^ Return to top</a></p>
<h3 id="brewer-delete">Delete a Brewer</h3>
<p>To delete a brewer, send a <strong>DELETE</strong> request to the <code>/brewer</code> endpoint with the <var>brewer_id</var> appended to the path. No request body is required. Successful requests return a <var>204 No Content</var> response with no body. Deleting a brewer also permanently deletes all of its beers and locations. Deleting is limited to brewery staff — check <a href="#brewer-permissions">your permissions</a> before attempting it.</p>
<pre class="api-code">DELETE https://api.catalog.beer/brewer/{brewer_id}</pre>
<h4>Sample Request</h4>
<pre class="api-code">
curl -X DELETE \
https://api.catalog.beer/brewer/ce7d83f5-0c3d-42f4-9162-ca97019e89d1 \
-H 'accept: application/json' \
-H 'authorization: Basic {secret_key}' \
</pre>
<p><a href="#top">^ Return to top</a></p>
<h3 id="brewer-retrieve">Retrieve a Brewer</h3>
<p>To retrieve a brewer, send a <strong>GET</strong> request to the <code>/brewer</code> endpoint with the <var>{brewer_id}</var> parameter appended to the path.</p>
<pre class="api-code">GET https://api.catalog.beer/brewer/{brewer_id}</pre>
<p>A <a href="#brewer-object">brewer object</a> will be returned for successful requests.</p>
<h4>Sample Request</h4>
<pre class="api-code">
curl -X GET \
https://api.catalog.beer/brewer/ce7d83f5-0c3d-42f4-9162-ca97019e89d1 \
-H 'accept: application/json' \
-H 'authorization: Basic {secret_key}' \
</pre>
<p><a href="#top">^ Return to top</a></p>
<h3 id="brewer-list-all">List all Brewers</h3>
<p>If you want a list of all the brewers in the database, send a <strong>GET</strong> request to the <code>/brewer</code> endpoint.</p>
<pre class="api-code">GET https://api.catalog.beer/brewer</pre>
<h4>Query Parameters</h4>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Type</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><var>cursor</var><br><small class="text-muted">(optional)</small></td>
<td>string</td>
<td>An opaque string value that indicates where the results should start from. This value is returned as <var>next_cursor</var> after an initial query to the endpoint.</td>
</tr>
<tr>
<td><var>count</var><br><small class="text-muted">(optional)</small></td>
<td>integer</td>
<td>The number of results you would like returned from your request. The default value is 500.</td>
</tr>
</tbody>
</table>
</div>
<p>A sample request with query parameters. Be sure to encode all non-alphanumeric characters except <code>-_</code>.</p>
<pre class="api-code">GET https://api.catalog.beer/brewer?count=5&cursor=NQ%3D%3D</pre>
<h4>Response</h4>
<p>This request returns a list object with the following parameters.</p>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th scope="col">Parameter</th>
<th scope="col">Type</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><var>object</var></td>
<td>string</td>
<td>The name of the object. In this case: “list”.</td>
</tr>
<tr>
<td><var>url</var></td>
<td>string</td>
<td>The API endpoint accessed to retrieve this object. In this case: <code>/brewer</code>.</td>
</tr>
<tr>
<td><var>has_more</var></td>
<td>Boolean</td>
<td>Whether or not there is more data available after this set. If <var>false</var>, you have reached the last items on the list.</td>
</tr>
<tr>
<td><var>next_cursor</var><br><small class="text-muted">(optional)</small></td>
<td>string</td>
<td>To retrieve the next set of results, provide this value as the <var>cursor</var> parameter on your subsequent API request.</td>
</tr>
<tr>
<td><var>data</var></td>
<td>array</td>
<td>An array containing all the brewers in the database sorted alphabetically by name. Each array object has the following attributes: <var>id</var>, <var>name</var>, and <var>last_modified</var>, described below.</td>
</tr>
<tr>
<td><var>id</var></td>
<td>string</td>
<td>The <var>brewer_id</var>.</td>
</tr>
<tr>
<td><var>name</var></td>
<td>string</td>
<td>The name of the brewer.</td>
</tr>
<tr>
<td><var>last_modified</var></td>
<td>integer</td>
<td>A Unix timestamp representing the date and time the brewer was last modified.</td>
</tr>
</tbody>
</table>
</div>
<h4>Sample Request</h4>
<pre class="api-code">
curl -X GET \
'https://api.catalog.beer/brewer?count=2' \
-H 'accept: application/json' \
-H 'authorization: Basic {secret_key}' \
</pre>
<h4>Sample Response</h4>
<pre class="api-code">
{
"object": "list",
"url": "/brewer",
"has_more": true,
"next_cursor": "Mg==",
"data": [
{
"id": "19555c52-ade8-43fe-a7a8-5888af0842e9",
"name": "'t Hofbrouwerijke",
"last_modified": 1588448205
},
{
"id": "d150fff4-ff71-4171-bd36-fb6dc8a83377",
"name": "(512) Brewing Company",
"last_modified": 1588448205
}
]
}
</pre>
<p><a href="#top">^ Return to top</a></p>
<h3 id="brewer-count">Number of Brewers</h3>
<p>You can retrieve the total number of brewers that are in the database by sending a <strong>GET</strong> request the endpoint <code>/brewer/count</code>. A JSON object with the following parameters will be returned.</p>
<pre class="api-code">GET https://api.catalog.beer/brewer/count</pre>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th scope="col">Parameter</th>
<th scope="col">Type</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><var>object</var></td>
<td>string</td>
<td>The name of the object. In this case: “count”.</td>
</tr>
<tr>
<td><var>url</var></td>
<td>string</td>
<td>The API endpoint accessed to retrieve this object. In this case: <code>/brewer/count</code>.</td>
</tr>
<tr>
<td><var>value</var></td>
<td>integer</td>
<td>The number of brewers in the database.</td>
</tr>
</tbody>
</table>
</div>
<h4>Sample Request</h4>
<pre class="api-code">
curl -X GET \
https://api.catalog.beer/brewer/count \
-H 'accept: application/json' \
-H 'authorization: Basic {secret_key}' \
</pre>
<h4>Sample Response</h4>
<pre class="api-code">
{
"object": "count",
"url": "/brewer/count",
"value": 6760
}
</pre>
<p><a href="#top">^ Return to top</a></p>
<h3 id="brewer-search">Search Brewers</h3>
<p>Search for brewers by name or description using full-text search. To search, send a <strong>GET</strong> request to the <code>/brewer/search</code> endpoint with a <var>q</var> query parameter.</p>
<pre class="api-code">GET https://api.catalog.beer/brewer/search?q={query}</pre>
<h4>Query Parameters</h4>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Type</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><var>q</var></td>
<td>string</td>
<td>The search query string. Maximum 255 characters.</td>
</tr>
<tr>
<td><var>count</var><br><small class="text-muted">(optional)</small></td>
<td>integer</td>
<td>The number of results you would like returned. The default value is 25. Maximum is 100.</td>
</tr>
<tr>
<td><var>cursor</var><br><small class="text-muted">(optional)</small></td>
<td>string</td>
<td>An opaque string value that indicates where the results should start from. This value is returned as <var>next_cursor</var> after an initial query to the endpoint.</td>
</tr>
</tbody>
</table>
</div>
<p>A sample request with query parameters. Be sure to encode all non-alphanumeric characters except <code>-_</code>.</p>
<pre class="api-code">GET https://api.catalog.beer/brewer/search?q=stone+brewing&count=5</pre>
<h4>Response</h4>
<p>This request returns a list object with the following parameters. Results are sorted by relevance to the search query.</p>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th scope="col">Parameter</th>
<th scope="col">Type</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><var>object</var></td>
<td>string</td>
<td>The name of the object. In this case: “list”.</td>
</tr>
<tr>
<td><var>url</var></td>
<td>string</td>
<td>The API endpoint accessed to retrieve this object. In this case: <code>/brewer/search</code>.</td>
</tr>
<tr>
<td><var>query</var></td>
<td>string</td>
<td>The search query that was submitted.</td>
</tr>
<tr>
<td><var>has_more</var></td>
<td>Boolean</td>
<td>Whether or not there are more results available. If <var>false</var>, you have reached the last items in the result set.</td>
</tr>
<tr>
<td><var>next_cursor</var><br><small class="text-muted">(optional)</small></td>
<td>string</td>
<td>To retrieve the next set of results, provide this value as the <var>cursor</var> parameter on your subsequent API request. Only present when <var>has_more</var> is <var>true</var>.</td>
</tr>
<tr>
<td><var>data</var></td>
<td>array</td>
<td>An array of <a href="#brewer-object">brewer objects</a> matching the search query, sorted by relevance. Each result additionally carries a <var>match</var> field describing why it matched: <code>exact</code> (the name equals the query), <code>all_terms</code> (every query term matches the start of a word in the name), <code>partial</code> (at least one query term matches the name), or <code>description</code> (the name matched nothing — the hit is in the description text). When checking whether a brewer already exists, only the first three values are evidence of a name match.</td>
</tr>
</tbody>
</table>
</div>
<h4>Sample Request</h4>
<pre class="api-code">
curl -X GET \
'https://api.catalog.beer/brewer/search?q=stone&count=1' \
-H 'accept: application/json' \
-H 'authorization: Basic {secret_key}' \
</pre>
<h4>Sample Response</h4>
<pre class="api-code">
{
"object": "list",
"url": "/brewer/search",
"query": "stone",
"has_more": true,
"next_cursor": "MQ==",
"data": [
{
"id": "a751e1bb-e738-4a3a-906b-6a707e082908",
"object": "brewer",
"name": "Stone Coast Brewing",
"description": null,
"short_description": null,
"url": "http://www.stonecoast.com/",
"cb_verified": false,
"brewer_verified": false,
"last_modified": 1588448205,
"match": "all_terms"
}
]
}
</pre>
<p><a href="#top">^ Return to top</a></p>
<h3 id="brewer-beers">List all Beers made by a Brewer</h3>
<p>If you would like a list of all the beers made by a brewer, send a request to the <code>/brewer/{brewer_id}/beer</code> endpoint. </p>
<p>This request returns a list object with the following parameters.</p>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th scope="col">Parameter</th>
<th scope="col">Type</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><var>object</var></td>
<td>string</td>
<td>The name of the object. In this case: “list”.</td>
</tr>
<tr>
<td><var>url</var></td>
<td>string</td>
<td>The API endpoint accessed to retrieve this object. In this case: <code>/brewer/{brewer_id}/beer</code>.</td>
</tr>
<tr>
<td><var>has_more</var></td>
<td>Boolean</td>
<td>As of this writing, this will always return <var>false</var>. In the future, if pagination of results is required, this value may become <var>true</var>.</td>
</tr>
<tr>
<td><var>brewer</var></td>
<td>object</td>
<td>A <a href="#brewer-object">brewer object</a> containing information for the requested <var>{brewer_id}</var>.</td>
</tr>
<tr>
<td><var>data</var></td>
<td>array</td>
<td>An array containing all the beers associated with this brewer in the database sorted alphabetically by name. Each array object has the following attributes: <var>id</var>, <var>name</var>, <var>style</var>, <var>style_id</var>, <var>parent</var>, <var>class</var>, <var>beverage_type</var>, <var>abv</var>, <var>cb_verified</var>, and <var>brewer_verified</var> described below.</td>
</tr>
<tr>
<td><var>id</var></td>
<td>string</td>
<td>The <var>beer_id</var>.</td>
</tr>
<tr>
<td><var>name</var></td>
<td>string</td>
<td>The name of the beer.</td>
</tr>
<tr>
<td><var>style</var></td>
<td>string</td>
<td>The style of the beer (human-readable label).</td>
</tr>
<tr>
<td><var>style_id</var></td>
<td>string</td>
<td>The canonical <a href="#styles">style</a> id, or <var>null</var> if filed at the family/class level.</td>
</tr>
<tr>
<td><var>parent</var></td>
<td>string</td>
<td>The canonical family id (e.g. <var>porter</var>).</td>
</tr>
<tr>
<td><var>class</var></td>
<td>string</td>
<td>The super-class (<var>ale</var>/<var>lager</var>), or <var>null</var>.</td>
</tr>
<tr>
<td><var>beverage_type</var></td>
<td>string</td>
<td><var>beer</var>, <var>cider</var>, <var>perry</var>, or <var>mead</var>.</td>
</tr>
<tr>
<td><var>abv</var></td>
<td>number</td>
<td>The alcohol by volume (ABV) of the beer, expressed as a percentage.</td>
</tr>
<tr>
<td><var>cb_verified</var></td>
<td>Boolean</td>
<td>Whether the beer’s information has been verified by Catalog.beer against the brewery’s website.</td>
</tr>
<tr>
<td><var>brewer_verified</var></td>
<td>Boolean</td>
<td>Whether the beer’s information was provided by the brewery (first-party data).</td>
</tr>
</tbody>
</table>
</div>
<h4>Sample Request</h4>
<pre class="api-code">
curl -X GET \
https://api.catalog.beer/brewer/ab94abb7-a3e8-4cce-8945-4758cac66a53/beer \
-H 'accept: application/json' \
-H 'authorization: Basic {secret_key}' \
</pre>
<h4>Sample Response</h4>
<pre class="api-code">
{
"object": "list",
"url": "/brewer/ab94abb7-a3e8-4cce-8945-4758cac66a53/beer",
"has_more": false,
"brewer": {
"id": "ab94abb7-a3e8-4cce-8945-4758cac66a53",
"object": "brewer",
"name": "Ballast Point Brewing Company",
"description": null,
"short_description": null,
"url": "https://www.ballastpoint.com/",
"cb_verified": false,
"brewer_verified": false,
"last_modified": 1541544607
},
"data": [
{
"id": "650f8973-7c09-4cbf-99cd-857e095d84b0",
"name": "Abandon Ship With Chipotle",
"style": "Smoke Beer (Lager or Ale)",
"style_id": "smoke-beer",
"parent": "smoked-beer",
"class": null,
"beverage_type": "beer",
"abv": 7,
"cb_verified": false,
"brewer_verified": false
},
{
"id": "36ebef31-f05b-4c78-b7c1-731ed136fe11",
"name": "Ballast Point Belgian-Style Tripel",
"style": "Belgian-Style Tripel",
"style_id": "belgian-tripel",
"parent": "belgian-strong-ale",
"class": "ale",
"beverage_type": "beer",
"abv": 9.7,
"cb_verified": false,
"brewer_verified": false
},
{
"id": "e778b401-0c2b-4bc0-8b53-ccb59860c1bf",
"name": "Ballast Point Red Velvet Cake",
"style": "Chocolate / Cocoa-Flavored Beer",
"style_id": "chocolate-beer",
"parent": "flavored-beer",
"class": null,
"beverage_type": "beer",
"abv": 5.5,
"cb_verified": false,
"brewer_verified": false
}
]
}
</pre>
<p><small class="text-muted">Response truncated for documentation — this brewer has 81 beers in its <var>data</var> array.</small></p>
<p><a href="#top">^ Return to top</a></p>
<h3 id="brewer-locations">List all the Locations for a Brewer</h3>
<p>If you would like to know all the locations associated with a brewer, send a request to the <code>/brewer/{brewer_id}/locations</code> endpoint.</p>
<p>This request returns a list object with the following parameters.</p>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th scope="col">Parameter</th>
<th scope="col">Type</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>