1 post:
2 operationId: PostCustomersIdCustomerGroups
3 x-sidebar-summary: Manage Customer Groups
4 summary: Manage Customer Groups of Customer
5 description: >-
6 Manage the customer groups of a customer, adding or removing the customer
7 from those groups.
8 x-authenticated: true
9 parameters:
10 - name: id
11 in: path
12 description: The customer's ID.
13 required: true
14 schema:
15 type: string
16 - name: fields
17 in: query
18 description: >-
19 Comma-separated fields that should be included in the returned data.
20
21 if a field is prefixed with `+` it will be added to the default fields,
22 using `-` will remove it from the default fields.
23
24 without prefix it will replace the entire default fields. This API route
25 restricts the fields that can be selected. Learn how to override the
26 retrievable fields in
27
28 the [Retrieve Custom
29 Links](https://docs.medusajs.com/learn/fundamentals/api-routes/retrieve-custom-links)
30 documentation.
31 required: false
32 schema:
33 type: string
34 title: fields
35 description: >-
36 Comma-separated fields that should be included in the returned data.
37 If a field is prefixed with `+` it will be added to the default
38 fields, using `-` will remove it from the default fields. Without
39 prefix it will replace the entire default fields. This API route
40 restricts the fields that can be selected. Learn how to override the
41 retrievable fields in the [Retrieve Custom
42 Links](https://docs.medusajs.com/learn/fundamentals/api-routes/retrieve-custom-links)
43 documentation.
44 externalDocs:
45 url: '#select-fields-and-relations'
46 security:
47 - api_token: []
48 - cookie_auth: []
49 - jwt_token: []
50 requestBody:
51 content:
52 application/json:
53 schema:
54 $ref: ../components/schemas/AdminBatchLink.yaml
55 x-codeSamples:
56 - lang: JavaScript
57 label: JS SDK
58 source:
59 $ref: >-
60 ../code_samples/JavaScript/admin_customers_{id}_customer-groups/post.js
61 - lang: Shell
62 label: cURL
63 source:
64 $ref: ../code_samples/Shell/admin_customers_{id}_customer-groups/post.sh
65 tags:
66 - Customers
67 responses:
68 '200':
69 description: OK
70 content:
71 application/json:
72 schema:
73 $ref: ../components/schemas/AdminCustomerResponse.yaml
74 '400':
75 $ref: ../components/responses/400_error.yaml
76 '401':
77 $ref: ../components/responses/unauthorized.yaml
78 '404':
79 $ref: ../components/responses/not_found_error.yaml
80 '409':
81 $ref: ../components/responses/invalid_state_error.yaml
82 '422':
83 $ref: ../components/responses/invalid_request_error.yaml
84 '500':
85 $ref: ../components/responses/500_error.yaml
86 x-workflow: linkCustomerGroupsToCustomerWorkflow
87 x-events: []