1 get:
2 operationId: GetCustomersIdAddresses
3 summary: List Addresses
4 description: >-
5 Retrieve a list of addresses in a customer. The addresses can be filtered by
6 fields like `query`. The addresses can also be paginated.
7 x-authenticated: true
8 parameters:
9 - name: id
10 in: path
11 description: The customer's ID.
12 required: true
13 schema:
14 type: string
15 - name: fields
16 in: query
17 description: >-
18 Comma-separated fields that should be included in the returned data. if
19 a field is prefixed with `+` it will be added to the default fields,
20 using `-` will remove it from the default fields. without prefix it will
21 replace the entire default fields. This API route restricts the fields
22 that can be selected. Learn how to override the retrievable fields in
23 the [Retrieve Custom
24 Links](https://docs.medusajs.com/learn/fundamentals/api-routes/retrieve-custom-links)
25 documentation.
26 required: false
27 schema:
28 type: string
29 title: fields
30 description: >-
31 Comma-separated fields that should be included in the returned data.
32 if a field is prefixed with `+` it will be added to the default
33 fields, using `-` will remove it from the default fields. without
34 prefix it will replace the entire default fields. This API route
35 restricts the fields that can be selected. Learn how to override the
36 retrievable fields in the [Retrieve Custom
37 Links](https://docs.medusajs.com/learn/fundamentals/api-routes/retrieve-custom-links)
38 documentation.
39 externalDocs:
40 url: '#select-fields-and-relations'
41 - name: offset
42 in: query
43 description: The number of items to skip when retrieving a list.
44 required: false
45 schema:
46 type: number
47 title: offset
48 description: The number of items to skip when retrieving a list.
49 externalDocs:
50 url: '#pagination'
51 - name: limit
52 in: query
53 description: Limit the number of items returned in the list.
54 required: false
55 schema:
56 type: number
57 title: limit
58 description: Limit the number of items returned in the list.
59 externalDocs:
60 url: '#pagination'
61 - name: order
62 in: query
63 description: >-
64 The field to sort the data by. By default, the sort order is ascending.
65 To change the order to descending, prefix the field name with `-`.
66 required: false
67 schema:
68 type: string
69 title: order
70 description: >-
71 The field to sort the data by. By default, the sort order is
72 ascending. To change the order to descending, prefix the field name
73 with `-`.
74 - name: q
75 in: query
76 description: Search term to apply on the address's searchable properties.
77 required: false
78 schema:
79 type: string
80 title: q
81 description: Search term to apply on the address's searchable properties.
82 - name: company
83 in: query
84 required: false
85 schema:
86 oneOf:
87 - type: string
88 title: company
89 description: Filter by a company.
90 - type: array
91 description: Filter by companies.
92 items:
93 type: string
94 title: company
95 description: A company's name.
96 - name: city
97 in: query
98 required: false
99 schema:
100 oneOf:
101 - type: string
102 title: city
103 description: Filter by a city.
104 - type: array
105 description: Filter by cities.
106 items:
107 type: string
108 title: city
109 description: A city's name.
110 - name: country_code
111 in: query
112 required: false
113 schema:
114 oneOf:
115 - type: string
116 title: country_code
117 description: Filter by a currency code.
118 - type: array
119 description: Filter by currency codes.
120 items:
121 type: string
122 title: country_code
123 description: A currency code.
124 - name: province
125 in: query
126 required: false
127 schema:
128 oneOf:
129 - type: string
130 title: province
131 description: Filter by an ISO 3166-2 province code. Must be lower-case.
132 example: us-ca
133 externalDocs:
134 url: https://en.wikipedia.org/wiki/ISO_3166-2
135 description: Learn more about ISO 3166-2
136 - type: array
137 description: Filter by ISO 3166-2 provinces.
138 items:
139 type: string
140 title: province
141 description: A ISO 3166-2 province code. Must be lower-case.
142 example: us-ca
143 externalDocs:
144 url: https://en.wikipedia.org/wiki/ISO_3166-2
145 description: Learn more about ISO 3166-2
146 - name: postal_code
147 in: query
148 required: false
149 schema:
150 oneOf:
151 - type: string
152 title: postal_code
153 description: Filter by a postal code.
154 - type: array
155 description: Filter by postal codes.
156 items:
157 type: string
158 title: postal_code
159 description: A postal code.
160 - name: $and
161 in: query
162 description: >-
163 Join query parameters with an AND condition. Each object's content is
164 the same type as the expected query parameters.
165 required: false
166 schema:
167 type: array
168 description: >-
169 Join query parameters with an AND condition. Each object's content is
170 the same type as the expected query parameters.
171 items:
172 type: object
173 title: $and
174 - name: $or
175 in: query
176 description: >-
177 Join query parameters with an OR condition. Each object's content is the
178 same type as the expected query parameters.
179 required: false
180 schema:
181 type: array
182 description: >-
183 Join query parameters with an OR condition. Each object's content is
184 the same type as the expected query parameters.
185 items:
186 type: object
187 title: $or
188 - name: with_deleted
189 in: query
190 description: Whether to include deleted records in the result.
191 required: false
192 schema:
193 type: boolean
194 title: with_deleted
195 description: Whether to include deleted records in the result.
196 security:
197 - api_token: []
198 - cookie_auth: []
199 - jwt_token: []
200 x-codeSamples:
201 - lang: JavaScript
202 label: JS SDK
203 source:
204 $ref: ../code_samples/JavaScript/admin_customers_{id}_addresses/get.js
205 - lang: Shell
206 label: cURL
207 source:
208 $ref: ../code_samples/Shell/admin_customers_{id}_addresses/get.sh
209 tags:
210 - Customers
211 responses:
212 '200':
213 description: OK
214 content:
215 application/json:
216 schema:
217 allOf:
218 - type: object
219 description: The paginated list of customer addresses.
220 required:
221 - limit
222 - offset
223 - count
224 properties:
225 limit:
226 type: number
227 title: limit
228 description: The maximum number of items returned.
229 offset:
230 type: number
231 title: offset
232 description: >-
233 The number of items skipped before retrieving the returned
234 items.
235 count:
236 type: number
237 title: count
238 description: The total number of items.
239 - type: object
240 description: The paginated list of customer addresses
241 required:
242 - addresses
243 properties:
244 addresses:
245 type: array
246 description: The customer addresses.
247 items:
248 $ref: ../components/schemas/AdminCustomerAddress.yaml
249 '400':
250 $ref: ../components/responses/400_error.yaml
251 '401':
252 $ref: ../components/responses/unauthorized.yaml
253 '404':
254 $ref: ../components/responses/not_found_error.yaml
255 '409':
256 $ref: ../components/responses/invalid_state_error.yaml
257 '422':
258 $ref: ../components/responses/invalid_request_error.yaml
259 '500':
260 $ref: ../components/responses/500_error.yaml
261 post:
262 operationId: PostCustomersIdAddresses
263 summary: Add a Customer Address
264 x-sidebar-summary: Add Address
265 description: Add an address to a customer.
266 x-authenticated: true
267 parameters:
268 - name: id
269 in: path
270 description: The customer's ID.
271 required: true
272 schema:
273 type: string
274 - name: fields
275 in: query
276 description: >-
277 Comma-separated fields that should be included in the returned data. if
278 a field is prefixed with `+` it will be added to the default fields,
279 using `-` will remove it from the default fields. without prefix it will
280 replace the entire default fields. This API route restricts the fields
281 that can be selected. Learn how to override the retrievable fields in
282 the [Retrieve Custom
283 Links](https://docs.medusajs.com/learn/fundamentals/api-routes/retrieve-custom-links)
284 documentation.
285 required: false
286 schema:
287 type: string
288 title: fields
289 description: >-
290 Comma-separated fields that should be included in the returned data.
291 if a field is prefixed with `+` it will be added to the default
292 fields, using `-` will remove it from the default fields. without
293 prefix it will replace the entire default fields. This API route
294 restricts the fields that can be selected. Learn how to override the
295 retrievable fields in the [Retrieve Custom
296 Links](https://docs.medusajs.com/learn/fundamentals/api-routes/retrieve-custom-links)
297 documentation.
298 externalDocs:
299 url: '#select-fields-and-relations'
300 security:
301 - api_token: []
302 - cookie_auth: []
303 - jwt_token: []
304 requestBody:
305 content:
306 application/json:
307 schema:
308 allOf:
309 - type: object
310 description: The address's details.
311 required:
312 - address_name
313 - company
314 - first_name
315 - last_name
316 - address_1
317 - address_2
318 - city
319 - country_code
320 - province
321 - postal_code
322 - phone
323 - metadata
324 properties:
325 address_name:
326 type: string
327 title: address_name
328 description: The name of the address.
329 is_default_shipping:
330 type: boolean
331 title: is_default_shipping
332 description: >-
333 Whether this address is used by default for shipping when
334 placing an order.
335 is_default_billing:
336 type: boolean
337 title: is_default_billing
338 description: >-
339 Whether this address is used by default for billing when
340 placing an order.
341 company:
342 type: string
343 title: company
344 description: The address's company.
345 first_name:
346 type: string
347 title: first_name
348 description: The address's first name.
349 last_name:
350 type: string
351 title: last_name
352 description: The address's last name.
353 address_1:
354 type: string
355 title: address_1
356 description: The address's first line.
357 address_2:
358 type: string
359 title: address_2
360 description: The address's second line.
361 city:
362 type: string
363 title: city
364 description: The address's city.
365 country_code:
366 type: string
367 title: country_code
368 description: The address's country code.
369 province:
370 type: string
371 title: province
372 description: The address's ISO 3166-2 province code. Must be lower-case.
373 example: us-ca
374 externalDocs:
375 url: https://en.wikipedia.org/wiki/ISO_3166-2
376 description: Learn more about ISO 3166-2
377 postal_code:
378 type: string
379 title: postal_code
380 description: The address's postal code.
381 phone:
382 type: string
383 title: phone
384 description: The address's phone.
385 metadata:
386 type: object
387 description: The address's metadata.
388 - type: object
389 description: The address's details.
390 properties:
391 additional_data:
392 type: object
393 description: >-
394 Pass additional custom data to the API route. This data is
395 passed to the underlying workflow under the
396 `additional_data` parameter.
397 description: The address's details.
398 x-codeSamples:
399 - lang: JavaScript
400 label: JS SDK
401 source:
402 $ref: ../code_samples/JavaScript/admin_customers_{id}_addresses/post.js
403 - lang: Shell
404 label: cURL
405 source:
406 $ref: ../code_samples/Shell/admin_customers_{id}_addresses/post.sh
407 tags:
408 - Customers
409 responses:
410 '200':
411 description: OK
412 content:
413 application/json:
414 schema:
415 $ref: ../components/schemas/AdminCustomerResponse.yaml
416 '400':
417 $ref: ../components/responses/400_error.yaml
418 '401':
419 $ref: ../components/responses/unauthorized.yaml
420 '404':
421 $ref: ../components/responses/not_found_error.yaml
422 '409':
423 $ref: ../components/responses/invalid_state_error.yaml
424 '422':
425 $ref: ../components/responses/invalid_request_error.yaml
426 '500':
427 $ref: ../components/responses/500_error.yaml
428 x-workflow: createCustomerAddressesWorkflow
429 x-events: []