1 get:
2 operationId: GetRegions
3 summary: List Regions
4 description: >-
5 Retrieve a list of regions. The regions can be filtered by fields such as
6 `id`. The regions can also be sorted or paginated.
7 x-authenticated: false
8 externalDocs:
9 url: https://docs.medusajs.com/resources/storefront-development/regions/list
10 description: 'Storefront guide: How to retrieve a list of regions.'
11 parameters:
12 - name: x-publishable-api-key
13 in: header
14 description: Publishable API Key created in the Medusa Admin.
15 required: true
16 schema:
17 type: string
18 externalDocs:
19 url: https://docs.medusajs.com/api/store#publishable-api-key
20 - name: x-medusa-locale
21 in: header
22 description: The locale in BCP 47 format to retrieve localized content.
23 required: false
24 schema:
25 type: string
26 example: en-US
27 externalDocs:
28 url: >-
29 https://docs.medusajs.com/resources/commerce-modules/translation/storefront
30 description: Learn more in the Serve Translations in Storefront guide.
31 - name: fields
32 in: query
33 description: >-
34 Comma-separated fields that should be included in the returned data. if
35 a field is prefixed with `+` it will be added to the default fields,
36 using `-` will remove it from the default fields. without prefix it will
37 replace the entire default fields.
38 required: false
39 schema:
40 type: string
41 title: fields
42 description: >-
43 Comma-separated fields that should be included in the returned data.
44 if a field is prefixed with `+` it will be added to the default
45 fields, using `-` will remove it from the default fields. without
46 prefix it will replace the entire default fields.
47 externalDocs:
48 url: '#select-fields-and-relations'
49 - name: offset
50 in: query
51 description: The number of items to skip when retrieving a list.
52 required: false
53 schema:
54 type: number
55 title: offset
56 description: The number of items to skip when retrieving a list.
57 externalDocs:
58 url: '#pagination'
59 - name: limit
60 in: query
61 description: Limit the number of items returned in the list.
62 required: false
63 schema:
64 type: number
65 title: limit
66 description: Limit the number of items returned in the list.
67 externalDocs:
68 url: '#pagination'
69 - name: order
70 in: query
71 description: >-
72 The field to sort the data by. By default, the sort order is ascending.
73 To change the order to descending, prefix the field name with `-`.
74 required: false
75 schema:
76 type: string
77 title: order
78 description: >-
79 The field to sort the data by. By default, the sort order is
80 ascending. To change the order to descending, prefix the field name
81 with `-`.
82 - name: q
83 in: query
84 description: Search term to filter the region's searchable properties.
85 required: false
86 schema:
87 type: string
88 title: q
89 description: Search term to filter the region's searchable properties.
90 - name: id
91 in: query
92 required: false
93 schema:
94 oneOf:
95 - type: string
96 title: id
97 description: Filter by a region's ID.
98 - type: array
99 description: Filter by region IDs.
100 items:
101 type: string
102 title: id
103 description: A region's ID.
104 - name: name
105 in: query
106 required: false
107 schema:
108 oneOf:
109 - type: string
110 title: name
111 description: Filter by a region name.
112 - type: array
113 description: Filter by region names.
114 items:
115 type: string
116 title: name
117 description: A region's name.
118 - name: currency_code
119 in: query
120 required: false
121 schema:
122 oneOf:
123 - type: string
124 title: currency_code
125 description: Filter by a currency code to retrieve regions that use that code.
126 - type: array
127 description: >-
128 Filter by currency codes to retrieve regions that use one of these
129 codes.
130 items:
131 type: string
132 title: currency_code
133 description: A currency code.
134 - name: $and
135 in: query
136 description: >-
137 Join query parameters with an AND condition. Each object's content is
138 the same type as the expected query parameters.
139 required: false
140 schema:
141 type: array
142 description: >-
143 Join query parameters with an AND condition. Each object's content is
144 the same type as the expected query parameters.
145 items:
146 type: object
147 title: $and
148 - name: $or
149 in: query
150 description: >-
151 Join query parameters with an OR condition. Each object's content is the
152 same type as the expected query parameters.
153 required: false
154 schema:
155 type: array
156 description: >-
157 Join query parameters with an OR condition. Each object's content is
158 the same type as the expected query parameters.
159 items:
160 type: object
161 title: $or
162 - name: with_deleted
163 in: query
164 description: Whether to include deleted records in the result.
165 required: false
166 schema:
167 type: boolean
168 title: with_deleted
169 description: Whether to include deleted records in the result.
170 - name: locale
171 in: query
172 description: The locale in BCP 47 format to retrieve localized content.
173 required: false
174 schema:
175 type: string
176 example: en-US
177 externalDocs:
178 url: >-
179 https://docs.medusajs.com/resources/commerce-modules/translation/storefront
180 description: Learn more in the Serve Translations in Storefront guide.
181 x-codeSamples:
182 - lang: JavaScript
183 label: JS SDK
184 source:
185 $ref: ../code_samples/JavaScript/store_regions/get.js
186 - lang: Shell
187 label: cURL
188 source:
189 $ref: ../code_samples/Shell/store_regions/get.sh
190 tags:
191 - Regions
192 responses:
193 '200':
194 description: OK
195 content:
196 application/json:
197 schema:
198 allOf:
199 - type: object
200 description: The paginated list of regions.
201 required:
202 - limit
203 - offset
204 - count
205 properties:
206 limit:
207 type: number
208 title: limit
209 description: The maximum number of items returned.
210 offset:
211 type: number
212 title: offset
213 description: >-
214 The number of items skipped before retrieving the returned
215 items.
216 count:
217 type: number
218 title: count
219 description: The total number of items.
220 - type: object
221 description: The paginated list of regions.
222 required:
223 - regions
224 properties:
225 regions:
226 type: array
227 description: The list of regions.
228 items:
229 $ref: ../components/schemas/StoreRegion.yaml
230 '400':
231 $ref: ../components/responses/400_error.yaml
232 '401':
233 $ref: ../components/responses/unauthorized.yaml
234 '404':
235 $ref: ../components/responses/not_found_error.yaml
236 '409':
237 $ref: ../components/responses/invalid_state_error.yaml
238 '422':
239 $ref: ../components/responses/invalid_request_error.yaml
240 '500':
241 $ref: ../components/responses/500_error.yaml
242 x-allowed:
243 - id
244 - name
245 - currency_code
246 - created_at
247 - updated_at
248 - deleted_at
249 - metadata
250 - countries
251 - countries.id
252 - countries.iso_2
253 - countries.iso_3
254 - countries.num_code
255 - countries.name
256 - countries.display_name
257 - payment_providers
258 - payment_providers.id
259 - payment_providers.is_enabled